Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-03-03 23:15:39 +0000
committerStijn Buys <ingar@osirion.org>2012-03-03 23:15:39 +0000
commit8fbb2425220389ee69749ccd93407a0db73678fd (patch)
tree3ef7b7615711f9dd552760fbf0c26a801421082b /src/core/entity.h
parentf0a4a7d7213b61714542d64a7559648a086df26a (diff)
Added core::Slots class template, replaced Entity::set_inventory() with Entity::add_inventory().
Diffstat (limited to 'src/core/entity.h')
-rw-r--r--src/core/entity.h24
1 files changed, 15 insertions, 9 deletions
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;