From 8fbb2425220389ee69749ccd93407a0db73678fd Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 3 Mar 2012 23:15:39 +0000 Subject: Added core::Slots class template, replaced Entity::set_inventory() with Entity::add_inventory(). --- src/core/entity.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/core/entity.h') diff --git a/src/core/entity.h b/src/core/entity.h index 94cd09f..d071c06 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -190,7 +190,7 @@ public: return entity_visible; } - ///entity inventory + /// entity inventory inline Inventory *inventory() const { return entity_inventory; } @@ -327,11 +327,12 @@ public: /** * @brief add an inventory to this entity - * Entity takes ownership over the inventory pointer + * If this entity already has an inventory, + * the current inventory will be return */ - void set_inventory(Inventory *inventory); - - void set_info(const Info *info); + Inventory *add_inventory(); + + void set_info(const Info *info); /// set the timestamp when the entity was last alive void set_keepalive(unsigned long timestamp) { @@ -617,7 +618,7 @@ class EntityControlable : public EntityDynamic public: /// control flags - enum ControlFlags {ControlFlagNone = 0, ControlFlagImpulse = 1}; + enum ControlFlags {ControlFlagNone = 0, ControlFlagFire = 1}; /// bullet action interface class class ActionInterface: public btActionInterface { @@ -659,9 +660,14 @@ public: } /// control flags - inline unsigned int control_flags() const { + inline int control_flags() const { return entity_control_flags; } + + /// returns true if the specified control flag is set + inline bool control_flag_is_set(ControlFlags flag) const { + return ((flag && entity_control_flags) == flag); + } /// physics action inline ActionInterface *actioninterface() { @@ -682,7 +688,7 @@ public: /*----- mutators -------------------------------------------------- */ /// set all control flags - inline void set_control_flags(unsigned int control_flags) { + inline void set_control_flags(int control_flags) { entity_control_flags = control_flags; } @@ -788,7 +794,7 @@ protected: float target_vstrafe; - unsigned int entity_control_flags; + int entity_control_flags; ActionInterface *entity_actioninterface; -- cgit v1.2.3