Small changes to lock command (If no valid lockLevel exists, defaults to 100)

actorid
Thomas 11 years ago
parent cac8e52154
commit 420163d35f

@ -132,6 +132,10 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime); MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer lockLevel = ptr.getCellRef().mLockLevel; Interpreter::Type_Integer lockLevel = ptr.getCellRef().mLockLevel;
if(lockLevel<0) { //no lock level was ever set, set to 100 as default
ptr.getCellRef().mLockLevel = 100;
lockLevel = 100;
}
if (arg0==1) if (arg0==1)
{ {

@ -54,8 +54,15 @@ void ESM::CellRef::load (ESMReader& esm, bool wideRefNum)
else else
mTeleport = false; mTeleport = false;
mLockLevel = -1; mLockLevel = -999; //Set to impossible value to indicate no lock
mLocked = false;
esm.getHNOT (mLockLevel, "FLTV"); esm.getHNOT (mLockLevel, "FLTV");
if(mLockLevel < 0 && mLockLevel != -999) //Unlocked lock, save lock level properly
mLockLevel*=-1;
else if(mLockLevel != -999){
mLocked = true;
}
mKey = esm.getHNOString ("KNAM"); mKey = esm.getHNOString ("KNAM");
mTrap = esm.getHNOString ("TNAM"); mTrap = esm.getHNOString ("TNAM");
@ -113,8 +120,12 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) cons
esm.writeHNOCString("DNAM", mDestCell); esm.writeHNOCString("DNAM", mDestCell);
} }
if (mLockLevel != -1 && !inInventory) if (mLockLevel != -999 && !inInventory) {
esm.writeHNT("FLTV", mLockLevel); if(mLocked)
esm.writeHNT("FLTV", mLockLevel);
else //If it's not locked we simply flip the locklevel to indicate it's locked
esm.writeHNT("FLTV", -mLockLevel);
}
if (!inInventory) if (!inInventory)
esm.writeHNOCString ("KNAM", mKey); esm.writeHNOCString ("KNAM", mKey);
@ -151,6 +162,7 @@ void ESM::CellRef::blank()
mGoldValue = 0; mGoldValue = 0;
mDestCell.clear(); mDestCell.clear();
mLockLevel = 0; mLockLevel = 0;
mLocked = false;
mKey.clear(); mKey.clear();
mTrap.clear(); mTrap.clear();
mReferenceBlocked = 0; mReferenceBlocked = 0;

@ -71,6 +71,7 @@ namespace ESM
// Lock level for doors and containers // Lock level for doors and containers
int mLockLevel; int mLockLevel;
bool mLocked; //Door locked/unlocked
std::string mKey, mTrap; // Key and trap ID names, if any std::string mKey, mTrap; // Key and trap ID names, if any
// This corresponds to the "Reference Blocked" checkbox in the construction set, // This corresponds to the "Reference Blocked" checkbox in the construction set,

Loading…
Cancel
Save