From 8f393ff70e60172c632efc81694433568df2862b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 25 Dec 2014 15:58:24 +0000 Subject: Added a core::Level type, added a level attribute to core::Entity and core::Info, updated core::Player to use the new type. --- src/core/entity.h | 77 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 21 deletions(-) (limited to 'src/core/entity.h') diff --git a/src/core/entity.h b/src/core/entity.h index 5a028bf..27d888c 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -12,6 +12,7 @@ #include #include +#include "core/level.h" #include "model/model.h" #include "math/axis.h" #include "math/mathlib.h" @@ -118,32 +119,38 @@ public: /*----- inspectors ------------------------------------------------ */ /// entity id - inline const unsigned int id() const { + inline const unsigned int id() const + { return entity_id; } /// module type id - inline const unsigned int moduletype() const { + inline const unsigned int moduletype() const + { return entity_moduletypeid; } /// core type id - virtual inline const unsigned int type() const { + virtual inline const unsigned int type() const + { return Default; } /// entity flags - inline const unsigned int flags() const { + inline const unsigned int flags() const + { return entity_flags; } /// returns true of a flag is set - inline const bool has_flag(const Flags flag) const { + inline const bool has_flag(const Flags flag) const + { return ((entity_flags & (unsigned int)flag) == (unsigned int)flag); } /// pointer to the model, is used client-side - inline model::Model * model() const { + inline model::Model * model() const + { return entity_model; } @@ -153,50 +160,67 @@ public: } /// pointer to the zone the entity belongs to - inline Zone *zone() const { + inline Zone *zone() const + { return entity_zone; } /// the zone the entity left in case of a zone change - inline Zone *oldzone() const { + inline Zone *oldzone() const + { return entity_oldzone; } /// dirty flag - inline bool dirty() const { + inline bool dirty() const + { return entity_dirty; } /// entity location - inline const math::Vector3f& location() const { + inline const math::Vector3f& location() const + { return entity_location; } - /// local coordinate system of the entity - inline const math::Axis& axis() const { + /// local coordinates system of the entity + inline const math::Axis& axis() const + { return entity_axis; } - /// primary color of the entity - inline const math::Color& color() const { + /// primary entity color + inline const math::Color& color() const + { return entity_color; } - /// secondary - inline const math::Color& color_second() const { + /// secondary entity color + inline const math::Color& color_second() const + { return entity_color_second; } /// base shape of the entity - inline const Shape shape() const { + inline const Shape shape() const + { return entity_shape; } /// base radius of the entity - inline const float radius() const { + inline const float radius() const + { return entity_radius; } + /** + * @brief current entity level + * */ + inline const Level level() const + { + return entity_level; + } + /** * @brief current speed of the entity in game units per second * For a normal entity, speed is always 0. Use the EntityDynamic @@ -335,14 +359,24 @@ public: * and removes it to the new one, if it is not 0 */ virtual void set_zone(Zone *zone); + + /** + * @brief set the entity level + * */ + inline void set_level(const Level level) + { + entity_level = level; + } /// set visibility - inline void set_visible(const bool visible = true) { + inline void set_visible(const bool visible = true) + { entity_visible = visible; } /// set as server-side entity - inline void set_serverside(const bool serverside = true) { + inline void set_serverside(const bool serverside = true) + { entity_serverside = serverside; } @@ -584,9 +618,10 @@ private: math::Color entity_color; math::Color entity_color_second; + + Level entity_level; std::string entity_modelname; - model::Model* entity_model; Menus entity_menus; -- cgit v1.2.3