mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 02:15:34 +00:00
Small changes to lock command (If no valid lockLevel exists, defaults to 100)
This commit is contained in:
parent
cac8e52154
commit
420163d35f
3 changed files with 20 additions and 3 deletions
|
@ -132,6 +132,10 @@ namespace MWScript
|
|||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -54,8 +54,15 @@ void ESM::CellRef::load (ESMReader& esm, bool wideRefNum)
|
|||
else
|
||||
mTeleport = false;
|
||||
|
||||
mLockLevel = -1;
|
||||
mLockLevel = -999; //Set to impossible value to indicate no lock
|
||||
mLocked = false;
|
||||
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");
|
||||
mTrap = esm.getHNOString ("TNAM");
|
||||
|
||||
|
@ -113,8 +120,12 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) cons
|
|||
esm.writeHNOCString("DNAM", mDestCell);
|
||||
}
|
||||
|
||||
if (mLockLevel != -1 && !inInventory)
|
||||
esm.writeHNT("FLTV", mLockLevel);
|
||||
if (mLockLevel != -999 && !inInventory) {
|
||||
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)
|
||||
esm.writeHNOCString ("KNAM", mKey);
|
||||
|
@ -151,6 +162,7 @@ void ESM::CellRef::blank()
|
|||
mGoldValue = 0;
|
||||
mDestCell.clear();
|
||||
mLockLevel = 0;
|
||||
mLocked = false;
|
||||
mKey.clear();
|
||||
mTrap.clear();
|
||||
mReferenceBlocked = 0;
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace ESM
|
|||
|
||||
// Lock level for doors and containers
|
||||
int mLockLevel;
|
||||
bool mLocked; //Door locked/unlocked
|
||||
std::string mKey, mTrap; // Key and trap ID names, if any
|
||||
|
||||
// This corresponds to the "Reference Blocked" checkbox in the construction set,
|
||||
|
|
Loading…
Reference in a new issue