2016-01-28 14:52:40 +01:00
|
|
|
/** @file
|
|
|
|
|
*
|
|
|
|
|
* @par History
|
|
|
|
|
*/
|
2016-02-11 22:54:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "lockable.h"
|
|
|
|
|
|
|
|
|
|
#include "../clib/cfgelem.h"
|
|
|
|
|
#include "../clib/streamsaver.h"
|
2018-10-13 00:03:40 +02:00
|
|
|
#include "globals/uvars.h"
|
2018-01-29 21:55:48 +01:00
|
|
|
#include "uobject.h"
|
2016-02-11 22:54:43 +01:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
namespace Pol
|
|
|
|
|
{
|
|
|
|
|
namespace Core
|
|
|
|
|
{
|
|
|
|
|
ULockable::ULockable( const Items::ItemDesc& itemdesc, UOBJ_CLASS uobj_class )
|
2016-12-07 23:34:16 +01:00
|
|
|
: Item( itemdesc, uobj_class )
|
2016-02-19 19:26:35 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ULockable::readProperties( Clib::ConfigElem& elem )
|
|
|
|
|
{
|
|
|
|
|
base::readProperties( elem );
|
2016-12-07 23:34:16 +01:00
|
|
|
locked( elem.remove_bool( "Locked", false ) );
|
2016-02-19 19:26:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ULockable::printProperties( Clib::StreamWriter& sw ) const
|
|
|
|
|
{
|
|
|
|
|
base::printProperties( sw );
|
|
|
|
|
|
2016-12-07 23:34:16 +01:00
|
|
|
if ( locked() )
|
|
|
|
|
sw() << "\tLocked\t" << locked() << pf_endl;
|
2016-02-19 19:26:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// dave 12-20
|
|
|
|
|
Items::Item* ULockable::clone() const
|
|
|
|
|
{
|
|
|
|
|
ULockable* item = static_cast<ULockable*>( base::clone() );
|
|
|
|
|
|
2016-12-07 23:34:16 +01:00
|
|
|
item->locked( locked() );
|
2016-02-19 19:26:35 +01:00
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t ULockable::estimatedSize() const
|
|
|
|
|
{
|
2016-12-07 23:34:16 +01:00
|
|
|
return base::estimatedSize();
|
|
|
|
|
}
|
2018-10-13 00:03:40 +02:00
|
|
|
|
|
|
|
|
bool ULockable::get_method_hook( const char* methodname, Bscript::Executor* ex,
|
|
|
|
|
Core::ExportScript** hook, unsigned int* PC ) const
|
|
|
|
|
{
|
|
|
|
|
if ( Core::gamestate.system_hooks.get_method_hook(
|
|
|
|
|
Core::gamestate.system_hooks.lockable_method_script.get(), methodname, ex, hook, PC ) )
|
|
|
|
|
return true;
|
|
|
|
|
return base::get_method_hook( methodname, ex, hook, PC );
|
|
|
|
|
}
|
2016-02-19 19:26:35 +01:00
|
|
|
}
|
|
|
|
|
}
|