allow the 'lock' and 'unlock' script commands to work on containers, like in morrowind

This commit is contained in:
scrawl 2012-06-18 00:21:55 +02:00
parent 447158e9d6
commit de3daf3dc1
2 changed files with 19 additions and 0 deletions

View file

@ -192,4 +192,17 @@ namespace MWClass
{
return getContainerStore (ptr).getWeight();
}
void Container::lock (const MWWorld::Ptr& ptr, int lockLevel) const
{
if (lockLevel<0)
lockLevel = 0;
ptr.getCellRef().lockLevel = lockLevel;
}
void Container::unlock (const MWWorld::Ptr& ptr) const
{
ptr.getCellRef().lockLevel = 0;
}
}

View file

@ -44,6 +44,12 @@ namespace MWClass
///< Returns total weight of objects inside this object (including modifications from magic
/// effects). Throws an exception, if the object can't hold other objects.
virtual void lock (const MWWorld::Ptr& ptr, int lockLevel) const;
///< Lock object
virtual void unlock (const MWWorld::Ptr& ptr) const;
///< Unlock object
static void registerSelf();
};
}