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
|
|
|
|
2026-01-17 10:30:21 +01:00
|
|
|
|
|
|
|
|
namespace Pol::Core
|
2016-02-19 19:26:35 +01:00
|
|
|
{
|
|
|
|
|
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() )
|
Savefile rewrite (#601)
* rewrite of saving, replaced operator way with a generic add method, thus
not everywhere the formating of the savefiles is hardcoded.
since its the last spot which uses the old formating lib, remobed the
lib
* removed cmake of old format lib
* testscripts for load/save of UObject,Item,Armor,Weapon
* fixed: member faster_cast_recovery and faster_cast_recovery_mod getter returned
a wrong value
* wrong/missing docs
* test containers, lockable, map, spellbooks
fixed save bug in map and spellbook
removed ancient savestrategy experiments
* added corpse test
splitted testfiles
* fixed loading (ancient bug) and saving (PR bug) of Reportables
added tests for houses, boats, accounts and chars
* fixed include
* fix shutdown leak
* added npc tests
upload complete coretest folder also on failure
* do not write and load RegisteredHouse for NPCs two times
readded extra newline between accounts
* tests for guild, party, realm
added resource cfgs, but a test is not really possible since nothing of
interest is stored
* added datafile, storage test
* activated resource loading, 25year old bug, but since the stored values
are senseless it makes no real difference.
added a few wtf comments
catch all exceptions during formatting of log lines
* replaced .write with explixit .begin, .end and .comment.
for leftovers.txt the StreamSaver was also used, since the format is
different use directly ofstream
* added corechanges
2024-01-24 18:49:06 +01:00
|
|
|
sw.add( "Locked", locked() );
|
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 );
|
|
|
|
|
}
|
2026-01-17 10:30:21 +01:00
|
|
|
} // namespace Pol::Core
|