Pol  Revision:cb584c9
Pol::Multi::UHouse Class Reference

#include <house.h>

+ Inheritance diagram for Pol::Multi::UHouse:

Public Member Functions

virtual ~UHouse ()
 
void AcceptHouseCommit (Mobile::Character *chr, bool accept)
 
bool add_component (Items::Item *item, s32 xoff, s32 yoff, s16 zoff)
 
bool add_component (Component component)
 
void ClearSquatters ()
 
void CustomHouseSetInitialState ()
 
void CustomHousesQuit (Mobile::Character *chr, bool drop_changes)
 
void destroy_components ()
 
virtual size_t estimatedSize () const POL_OVERRIDE
 
bool IsCustom () const
 
bool IsEditing () const
 
bool IsWaitingForAccept () const
 
virtual void register_object (Core::UObject *obj) POL_OVERRIDE
 
void SetCustom (bool custom)
 
virtual void unregister_object (Core::UObject *obj) POL_OVERRIDE
 
virtual void walk_on (Mobile::Character *chr) POL_OVERRIDE
 
- Public Member Functions inherited from Pol::Multi::UMulti
virtual ~UMulti ()
 
virtual class UBoatas_boat ()
 
virtual void double_click (Network::Client *client) POL_OVERRIDE
 
Bscript::BStructfootprint () const
 
virtual Bscript::BObjectImpmake_ref () POL_OVERRIDE
 
const MultiDefmultidef () const
 
virtual bool readobjects (Core::StaticList &vec, s16 rx, s16 ry, s16 zbase)
 
virtual bool readshapes (Plib::MapShapeList &vec, s16 rx, s16 ry, s16 zbase)
 
virtual void register_object (UObject *obj)
 
virtual void unregister_object (UObject *obj)
 
- Public Member Functions inherited from Pol::Items::Item
virtual ~Item ()
 
void add_to_self (Item *&item)
 
bool amount_to_remove_is_partial (u16 amount_to_remove) const
 
virtual void builtin_on_use (Network::Client *client)
 
u32 buyprice () const
 
void buyprice (u32)
 
Bscript::BObject call_custom_method (const char *methodname, Bscript::BObjectImpRefVec &pmore)
 
Bscript::BObject call_custom_method (const char *methodname)
 
bool can_add_to_self (unsigned short amount, bool force_stacking) const
 
bool can_add_to_self (const Item &item, bool force_stacking) const
 
bool can_decay () const
 
bool check_equip_script (Mobile::Character *chr, bool startup)
 
bool check_equiptest_scripts (Mobile::Character *chr, bool startup=false)
 
bool check_test_scripts (Mobile::Character *chr, const std::string &script_ecl, bool startup)
 
bool check_unequip_script ()
 
bool check_unequiptest_scripts (Mobile::Character *chr)
 
bool check_unequiptest_scripts ()
 
virtual Itemclone () const
 
virtual Bscript::BObjectImpcustom_script_method (const char *methodname, Bscript::Executor &ex) POL_OVERRIDE
 
bool default_insured () const
 
bool default_invisible () const
 
bool default_movable () const
 
bool default_newbie () const
 
bool default_no_drop () const
 
virtual std::string description () const POL_OVERRIDE
 
void disable_decay ()
 
 DYN_PROPERTY (maxhp_mod, s16, Core::PROP_MAXHP_MOD, 0)
 
 DYN_PROPERTY (name_suffix, std::string, Core::PROP_NAME_SUFFIX,"")
 
 DYN_PROPERTY_POINTER (gotten_by, Mobile::Character *, Core::PROP_GOTTEN_BY)
 
 DYN_PROPERTY_POINTER (process, Module::UOExecutorModule *, Core::PROP_PROCESS)
 
 DYN_PROPERTY_POINTER (house, Multi::UHouse *, Core::PROP_HOUSE)
 
void extricate ()
 
virtual u16 get_senditem_amount () const
 
std::string get_use_script_name () const
 
u16 getamount () const
 
bool getbuyprice (u32 &buyprice) const
 
Mobile::CharacterGetCharacterOwner ()
 
virtual double getQuality () const
 
bool has_equip_script () const
 
bool has_only_default_cprops (const ItemDesc *compare=nullptr) const
 
bool insured () const
 
void insured (bool newvalue)
 
bool inuse () const
 
void inuse (bool newvalue)
 
bool invisible () const
 
void invisible (bool newvalue)
 
virtual unsigned int item_count () const
 
const ItemDescitemdesc () const
 
unsigned short maxhp () const
 
std::string merchant_description () const
 
bool movable () const
 
void movable (bool newvalue)
 
virtual std::string name () const POL_OVERRIDE
 
bool newbie () const
 
void newbie (bool newvalue)
 
bool no_drop () const
 
void no_drop (bool newvalue)
 
virtual void on_color_changed () POL_OVERRIDE
 
virtual void on_facing_changed () POL_OVERRIDE
 
void on_invisible_changed ()
 
void on_movable_changed ()
 
virtual UObjectowner () POL_OVERRIDE
 
virtual const UObjectowner () const POL_OVERRIDE
 
Itemremove_part_of_stack (u16 amount_to_remove)
 
void reset_slot ()
 
void restart_decay_timer ()
 
Bscript::BObjectImprun_equip_script (Mobile::Character *chr, bool startup)
 
Bscript::BObjectImprun_unequip_script (Mobile::Character *who)
 
u32 sellprice () const
 
void sellprice (u32)
 
void set_decay_after (unsigned int seconds)
 
virtual Bscript::BObjectImpset_script_member (const char *membername, const std::string &value) POL_OVERRIDE
 id test More...
 
virtual Bscript::BObjectImpset_script_member (const char *membername, int value) POL_OVERRIDE
 
virtual Bscript::BObjectImpset_script_member_double (const char *membername, double value) POL_OVERRIDE
 id test More...
 
virtual Bscript::BObjectImpset_script_member_id (const int id, const std::string &value) POL_OVERRIDE
 
virtual Bscript::BObjectImpset_script_member_id (const int id, int value) POL_OVERRIDE
 id test More...
 
virtual Bscript::BObjectImpset_script_member_id_double (const int id, double value) POL_OVERRIDE
 
void set_use_script (const std::string &scriptname)
 
void setamount (u16 amount)
 
virtual bool setcolor (u16 newcolor) POL_OVERRIDE
 
virtual void setfacing (u8 newfacing) POL_OVERRIDE
 
virtual bool setgraphic (u16 newobjtype) POL_OVERRIDE
 
bool setlayer (unsigned char layer)
 
virtual void setQuality (double value)
 
bool should_decay (unsigned int gameclock) const
 
Itemslice_stacked_item (u16 this_item_new_amount)
 
u8 slot_index () const
 
bool slot_index (u8 newvalue)
 
virtual void spill_contents (Multi::UMulti *supporting_multi)
 
bool stackable () const
 
void subamount (u16 amount_subtract)
 
virtual const char * target_tag () const POL_OVERRIDE
 
virtual UObjecttoplevel_owner () POL_OVERRIDE
 
virtual const UObjecttoplevel_owner () const POL_OVERRIDE
 
bool use_insurance ()
 Returns current insurance value and resets it to false. More...
 
virtual unsigned int weight () const POL_OVERRIDE
 
unsigned int weight_of (unsigned short amount) const
 
- Public Member Functions inherited from Pol::Core::UObject
ref_countedas_ref_counted ()
 
void clear_dirty () const
 
void copyprops (const UObject &obj)
 
void copyprops (const PropertyList &proplist)
 
virtual void destroy ()
 
bool dirty () const
 
 DYN_PROPERTY (maxhp_mod, s16, PROP_MAXHP_MOD, 0)
 
 DYN_PROPERTY (fire_resist, ValueModPack, PROP_RESIST_FIRE, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (cold_resist, ValueModPack, PROP_RESIST_COLD, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (energy_resist, ValueModPack, PROP_RESIST_ENERGY, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (poison_resist, ValueModPack, PROP_RESIST_POISON, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (physical_resist, ValueModPack, PROP_RESIST_PHYSICAL, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (fire_damage, ValueModPack, PROP_DAMAGE_FIRE, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (cold_damage, ValueModPack, PROP_DAMAGE_COLD, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (energy_damage, ValueModPack, PROP_DAMAGE_ENERGY, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (poison_damage, ValueModPack, PROP_DAMAGE_POISON, ValueModPack::DEFAULT)
 
 DYN_PROPERTY (physical_damage, ValueModPack, PROP_DAMAGE_PHYSICAL, ValueModPack::DEFAULT)
 
void eraseprop (const std::string &propname)
 
virtual void fixInvalidGraphic ()
 Fixes invalid graphic, moving here to allow it to be overridden in subclass (see Multi) More...
 
bool getprop (const std::string &propname, std::string &propvalue) const
 
void getpropnames (std::vector< std::string > &propnames) const
 
const PropertyListgetprops () const
 
void increv ()
 
virtual void printOn (Clib::StreamWriter &) const
 
virtual void printOnDebug (Clib::StreamWriter &sw) const
 
virtual void printSelfOn (Clib::StreamWriter &sw) const
 
void ref_counted_add_ref ()
 
unsigned ref_counted_count () const
 
void ref_counted_release ()
 
u32 rev () const
 
bool saveonexit () const
 
void saveonexit (bool newvalue)
 
virtual UObjectself_as_owner ()
 
virtual const UObjectself_as_owner () const
 
void set_dirty ()
 
void setname (const std::string &)
 
void setprop (const std::string &propname, const std::string &propvalue)
 
bool specific_name () const
 
- Public Member Functions inherited from Pol::Core::ULWObject
bool isa (UOBJ_CLASS uobj_class) const
 
bool isitem () const
 
bool ismobile () const
 
bool ismulti () const
 
u8 look_height () const
 
bool orphan () const
 
- Public Member Functions inherited from Pol::Core::DynamicPropsHolder
 DynamicPropsHolder ()
 
size_t estimateSizeDynProps () const
 
template<typename V >
bool getmember (DynPropTypes member, V *value) const
 
bool hasmember (DynPropTypes member) const
 
template<typename V >
void setmember (DynPropTypes member, const V &value, const V &defaultvalue)
 
template<typename V >
void setmemberPointer (DynPropTypes member, V value)
 

Static Public Member Functions

static UHouseFindWorkingHouse (u32 chrserial)
 
static void list_contents (const UHouse *house, ItemList &items_in, MobileList &chrs_in)
 
static Bscript::BObjectImpscripted_create (const Items::ItemDesc &descriptor, u16 x, u16 y, s8 z, Realms::Realm *realm, int flags)
 
- Static Public Member Functions inherited from Pol::Multi::UMulti
static UMulticreate (const Items::ItemDesc &descriptor, u32 serial=0)
 
static Bscript::BObjectImpscripted_create (const Items::ItemDesc &descriptor, u16 x, u16 y, s8 z, Realms::Realm *realm, int flags)
 
- Static Public Member Functions inherited from Pol::Items::Item
static Itemcreate (u32 objtype, u32 serial=0)
 
static Itemcreate (const ItemDesc &itemdesc, u32 serial=0)
 

Public Attributes

CustomHouseDesign BackupDesign
 
std::vector< u8CurrentCompressed
 
CustomHouseDesign CurrentDesign
 
bool editing
 
int editing_floor_num
 
u32 revision
 
bool waiting_for_accept
 
std::vector< u8WorkingCompressed
 
CustomHouseDesign WorkingDesign
 
- Public Attributes inherited from Pol::Multi::UMulti
u16 multiid
 
- Public Attributes inherited from Pol::Items::Item
Core::UContainercontainer
 
unsigned short hp_
 
u8 layer
 
u8 tile_layer
 
- Public Attributes inherited from Pol::Core::UObject
u16 color
 
u8 facing
 
const u32 objtype_
 
u32 serial_ext
 
- Public Attributes inherited from Pol::Core::ULWObject
u16 graphic
 
u8 height
 
Realms::Realmrealm
 
u32 serial
 
u16 x
 
u16 y
 
s8 z
 

Protected Member Functions

 UHouse (const Items::ItemDesc &itemdesc)
 
virtual class UHouseas_house () POL_OVERRIDE
 
Bscript::ObjArraycomponent_list () const
 
void create_components ()
 
Componentsget_components ()
 
virtual Bscript::BObjectImpget_script_member (const char *membername) const POL_OVERRIDE
 
virtual Bscript::BObjectImpget_script_member_id (const int id) const POL_OVERRIDE
 id test More...
 
Bscript::ObjArrayitems_list () const
 
Bscript::ObjArraymobiles_list () const
 
virtual void printProperties (Clib::StreamWriter &sw) const POL_OVERRIDE
 
virtual bool readobjects (Core::StaticList &vec, short obj_x, short obj_y, short zbase) POL_OVERRIDE
 
virtual void readProperties (Clib::ConfigElem &elem) POL_OVERRIDE
 
virtual bool readshapes (Plib::MapShapeList &vec, short shape_x, short shape_y, short zbase) POL_OVERRIDE
 
virtual bool script_isa (unsigned isatype) const POL_OVERRIDE
 id test More...
 
virtual Bscript::BObjectImpscript_method (const char *membername, Bscript::Executor &ex) POL_OVERRIDE
 
virtual Bscript::BObjectImpscript_method_id (const int id, Bscript::Executor &ex) POL_OVERRIDE
 
- Protected Member Functions inherited from Pol::Multi::UMulti
 UMulti (const Items::ItemDesc &itemdesc)
 
virtual const char * classname () const POL_OVERRIDE
 
- Protected Member Functions inherited from Pol::Items::Item
 Item (const ItemDesc &itemdesc, Core::UOBJ_CLASS uobj_class)
 
virtual void printDebugProperties (Clib::StreamWriter &sw) const POL_OVERRIDE
 
- Protected Member Functions inherited from Pol::Core::UObject
 UObject (u32 objtype, UOBJ_CLASS uobj_class)
 
virtual ~UObject ()
 
- Protected Member Functions inherited from ref_counted
 ref_counted ()
 
 ~ref_counted ()=default
 
unsigned int add_ref ()
 
unsigned int count () const
 
unsigned int release ()
 
- Protected Member Functions inherited from Pol::Core::ULWObject
 ULWObject (UOBJ_CLASS uobj_class)
 
 ULWObject (const ULWObject &)=delete
 
 ~ULWObject ()=default
 
ULWObjectoperator= (const ULWObject &)=delete
 
bool isa (UOBJ_CLASS uobj_class) const
 
bool isitem () const
 
bool ismobile () const
 
bool ismulti () const
 
u8 look_height () const
 
bool orphan () const
 
- Protected Member Functions inherited from Pol::Core::DynamicPropsHolder
 ~DynamicPropsHolder ()=default
 
 DynamicPropsHolder ()
 
size_t estimateSizeDynProps () const
 
template<typename V >
bool getmember (DynPropTypes member, V *value) const
 
bool hasmember (DynPropTypes member) const
 
template<typename V >
void setmember (DynPropTypes member, const V &value, const V &defaultvalue)
 
template<typename V >
void setmemberPointer (DynPropTypes member, V value)
 

Protected Attributes

bool custom
 
- Protected Attributes inherited from Pol::Items::Item
const ItemDesc_itemdesc
 
u16 amount_
 
unsigned int decayat_gameclock_
 
boost_utils::script_name_flystring equip_script_
 
boost_utils::script_name_flystring on_use_script_
 
u8 slot_index_
 
boost_utils::script_name_flystring unequip_script_
 
- Protected Attributes inherited from Pol::Core::UObject
AttributeFlags< OBJ_FLAGSflags_
 
boost_utils::object_name_flystring name_
 
- Protected Attributes inherited from ref_counted
std::atomic< unsigned int > _count
 
- Protected Attributes inherited from Pol::Core::ULWObject
const UOBJ_CLASS uobj_class_
 
u16 graphic
 
u8 height
 
Realms::Realmrealm
 
u32 serial
 
u16 x
 
u16 y
 
s8 z
 

Private Types

typedef UMulti base
 
typedef Core::ItemRef Component
 
typedef std::vector< ComponentComponents
 
typedef Core::UObjectRef Squatter
 
typedef std::vector< SquatterSquatters
 

Private Member Functions

void add_component_no_check (Component item)
 
bool can_add_component (const Items::Item *item)
 

Private Attributes

Components components_
 
Squatters squatters_
 

Friends

class CustomHouseDesign
 
class UMulti
 

Additional Inherited Members

- Static Public Attributes inherited from Pol::Core::UObject
static std::atomic< unsigned int > clean_writes
 
static std::atomic< unsigned int > dirty_writes
 
- Static Protected Attributes inherited from Pol::Items::Item
static const u32 BUYPRICE_DEFAULT = UINT_MAX
 
static const u32 SELLPRICE_DEFAULT = UINT_MAX
 

Detailed Description

Definition at line 64 of file house.h.

Member Typedef Documentation

Definition at line 66 of file house.h.

Definition at line 70 of file house.h.

typedef std::vector<Component> Pol::Multi::UHouse::Components
private

Definition at line 71 of file house.h.

Definition at line 138 of file house.h.

typedef std::vector<Squatter> Pol::Multi::UHouse::Squatters
private

Definition at line 139 of file house.h.

Constructor & Destructor Documentation

virtual Pol::Multi::UHouse::~UHouse ( )
inlinevirtual

Definition at line 107 of file house.h.

References POL_OVERRIDE.

Pol::Multi::UHouse::UHouse ( const Items::ItemDesc itemdesc)
explicitprotected

Definition at line 88 of file house.cpp.

Referenced by scripted_create().

Member Function Documentation

bool Pol::Multi::UHouse::add_component ( Items::Item item,
s32  xoff,
s32  yoff,
s16  zoff 
)

Moves the item into the house, adding it as house component (change item coordinates, set it unmovable, etc...)

Parameters
itemPointer to the item to be added
xoffThe X offset inside the house
yoffThe Y offset inside the house
zoffThe Z offset inside the house
Returns
true on success, false when the item can't be added

Definition at line 144 of file house.cpp.

References add_component_no_check(), Pol::Core::add_item_to_world(), can_add_component(), Pol::Items::Item::disable_decay(), Pol::Items::Item::movable(), POLLOG_ERROR, Pol::Core::ULWObject::realm, Pol::Core::ULWObject::serial, Pol::Core::update_item_to_inrange(), Pol::Core::ULWObject::x, Pol::Core::ULWObject::y, and Pol::Core::ULWObject::z.

Referenced by create_components(), Pol::Multi::CustomHouseDesign::FillComponents(), readProperties(), and script_method_id().

bool Pol::Multi::UHouse::add_component ( Component  item)

(Re-)Adds a component to the House, without modifying it: the item must already be inside the house, it just gets added to the components list

Parameters
itemReference to the item being added
Returns
true on success, false when the item can't be added

Definition at line 185 of file house.cpp.

References add_component_no_check(), and can_add_component().

void Pol::Multi::UHouse::add_component_no_check ( Component  item)
inlineprivate

Adds an Item as component, performs no checks, internal usage

Definition at line 152 of file house.h.

Referenced by add_component().

UHouse * Pol::Multi::UHouse::as_house ( )
protectedvirtual

Reimplemented from Pol::Multi::UMulti.

Definition at line 244 of file house.cpp.

Referenced by Pol::Realms::Realm::walkheight(), and Pol::Core::write_multis().

bool Pol::Multi::UHouse::can_add_component ( const Items::Item item)
inlineprivate

Checks if item can be added as component: an Item can't be a component in two houses

Parameters
itemPointer to the item to be added

Definition at line 148 of file house.h.

Referenced by add_component().

void Pol::Multi::UHouse::ClearSquatters ( )

Definition at line 959 of file house.cpp.

References squatters_.

Referenced by Pol::Multi::destroy_house().

Bscript::ObjArray * Pol::Multi::UHouse::component_list ( ) const
protected

Returns list of house components by allocating a new Array to be used by scripts

Returns
ObjArray* pointer to the newly allocated array

Definition at line 199 of file house.cpp.

References components_, and Pol::Core::ULWObject::orphan().

Referenced by get_script_member_id().

void Pol::Multi::UHouse::create_components ( )
protected
void Pol::Multi::UHouse::CustomHouseSetInitialState ( )
size_t Pol::Multi::UHouse::estimatedSize ( ) const
virtual
Components* Pol::Multi::UHouse::get_components ( )
inlineprotected
Bscript::BObjectImp * Pol::Multi::UHouse::get_script_member ( const char *  membername) const
protectedvirtual
bool Pol::Multi::UHouse::IsEditing ( ) const
inline

Definition at line 88 of file house.h.

Referenced by Pol::Multi::destroy_house(), get_script_member_id(), and script_method_id().

bool Pol::Multi::UHouse::IsWaitingForAccept ( ) const
inline
Bscript::ObjArray * Pol::Multi::UHouse::items_list ( ) const
protected

Definition at line 214 of file house.cpp.

References components_, and list_contents().

Referenced by get_script_member_id().

Bscript::ObjArray * Pol::Multi::UHouse::mobiles_list ( ) const
protected

Definition at line 231 of file house.cpp.

References list_contents().

Referenced by get_script_member_id().

void Pol::Multi::UHouse::register_object ( Core::UObject obj)
virtual

Definition at line 937 of file house.cpp.

References Pol::Core::UObject::set_dirty(), and squatters_.

bool Pol::Multi::UHouse::script_isa ( unsigned  isatype) const
protectedvirtual

id test

Reimplemented from Pol::Multi::UMulti.

Definition at line 4649 of file uoscrobj.cpp.

References Pol::Core::POLCLASS_HOUSE.

Bscript::BObjectImp * Pol::Multi::UHouse::script_method ( const char *  membername,
Bscript::Executor ex 
)
protectedvirtual

Reimplemented from Pol::Items::Item.

Definition at line 470 of file house.cpp.

References Pol::Bscript::getKnownObjMethod(), Pol::Bscript::ObjMethod::id, and script_method_id().

void Pol::Multi::UHouse::SetCustom ( bool  custom)

Definition at line 1063 of file customhouses.cpp.

Referenced by script_method_id().

void Pol::Multi::UHouse::unregister_object ( Core::UObject obj)
virtual

Definition at line 948 of file house.cpp.

References Pol::Core::UObject::set_dirty(), and squatters_.

Friends And Related Function Documentation

friend class CustomHouseDesign
friend

Definition at line 132 of file house.h.

friend class UMulti
friend

Definition at line 131 of file house.h.

Member Data Documentation

CustomHouseDesign Pol::Multi::UHouse::BackupDesign
Components Pol::Multi::UHouse::components_
private

Stores ItemRefs that are part of this house (eg. sign, doors, etc...)

Warning
Do not add items directly, use add_component(component) instead, because the mattching house() dinamyc property must be set on the item being added
See also
add_component

Definition at line 165 of file house.h.

Referenced by component_list(), destroy_components(), estimatedSize(), items_list(), printProperties(), and script_method_id().

std::vector<u8> Pol::Multi::UHouse::CurrentCompressed
bool Pol::Multi::UHouse::custom
protected

Definition at line 135 of file house.h.

Referenced by printProperties(), readobjects(), readProperties(), and readshapes().

Squatters Pol::Multi::UHouse::squatters_
private

Definition at line 140 of file house.h.

Referenced by ClearSquatters(), estimatedSize(), register_object(), and unregister_object().

bool Pol::Multi::UHouse::waiting_for_accept

Definition at line 91 of file house.h.

Referenced by AcceptHouseCommit(), and Pol::Multi::CustomHousesCommit().


The documentation for this class was generated from the following files: