From 4896428eefa6e621523168a42dceda4f8f2b0097 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 7 Nov 2013 13:38:11 +0000 Subject: Added core:: support for entity factions and player reputation (single-player only). --- src/core/entity.h | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'src/core/entity.h') diff --git a/src/core/entity.h b/src/core/entity.h index e1a952d..adeac0f 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -250,6 +250,12 @@ public: return entity_keepalive; } + + inline const Info *faction() const + { + return entity_faction; + } + /* ---- mutators -------------------------------------------------- */ /// assign shape @@ -384,9 +390,18 @@ public: /** * @brief set the timestamp when the entity was last alive * */ - void set_keepalive(unsigned long timestamp) { + inline void set_keepalive(unsigned long timestamp) + { entity_keepalive = timestamp; } + + /** + * @brief set the faction this entity belongs to. + * */ + inline void set_faction(const Info *faction) + { + entity_faction = faction; + } /* ---- actors ---------------------------------------------------- */ @@ -558,6 +573,8 @@ private: unsigned long entity_keepalive; + const Info *entity_faction; + static Registry entity_registry; static size_t entity_nextid; @@ -821,12 +838,16 @@ public: /// receive a server-to-client update from a stream virtual void receive_server_update(std::istream &is); - /// set the player who owns this entity + /** + * @brief set the player who owns this entity + * */ void set_owner(Player *owner); - /// set thrust + /** + * @brief set thrust + * */ void set_thrust(float thrust); - + protected: /// physics action interface callback @@ -878,7 +899,6 @@ protected: private: /// owner of the entity Player *entity_owner; - }; } // namespace core -- cgit v1.2.3