Ensures nothing bad will happen if we try to lock a door that never had a lock level

deque
Thomas 11 years ago
parent b3ffd5b868
commit 7697b9e868

@ -262,8 +262,12 @@ namespace MWClass
{ {
if(lockLevel!=0) if(lockLevel!=0)
ptr.getCellRef().setLockLevel(abs(lockLevel)); //Changes lock to locklevel, in positive ptr.getCellRef().setLockLevel(abs(lockLevel)); //Changes lock to locklevel, in positive
else else {
ptr.getCellRef().setLockLevel(abs(ptr.getCellRef().getLockLevel())); //No locklevel given, just flip the original one if(abs(ptr.getCellRef().getLockLevel())!=0)
ptr.getCellRef().setLockLevel(abs(ptr.getCellRef().getLockLevel())); //No locklevel given, just flip the origional one
else
ptr.getCellRef().setLockLevel(100); //There never was a locklevel, give it the default biggest one
}
} }
void Container::unlock (const MWWorld::Ptr& ptr) const void Container::unlock (const MWWorld::Ptr& ptr) const

@ -192,8 +192,12 @@ namespace MWClass
{ {
if(lockLevel!=0) if(lockLevel!=0)
ptr.getCellRef().setLockLevel(abs(lockLevel)); //Changes lock to locklevel, in positive ptr.getCellRef().setLockLevel(abs(lockLevel)); //Changes lock to locklevel, in positive
else else {
ptr.getCellRef().setLockLevel(abs(ptr.getCellRef().getLockLevel())); //No locklevel given, just flip the origional one if(abs(ptr.getCellRef().getLockLevel())!=0)
ptr.getCellRef().setLockLevel(abs(ptr.getCellRef().getLockLevel())); //No locklevel given, just flip the origional one
else
ptr.getCellRef().setLockLevel(100);
}
} }
void Door::unlock (const MWWorld::Ptr& ptr) const void Door::unlock (const MWWorld::Ptr& ptr) const

Loading…
Cancel
Save