From 14ea3d9d037175d4d5326ac9c83fe69ddcd0d9c4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 8 Oct 2012 19:58:08 +0000 Subject: added zone flags, renamed Entity::flag_is_set() to Entity::has_flag() --- src/core/zone.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/core/zone.h') diff --git a/src/core/zone.h b/src/core/zone.h index 644620d..22440c4 100644 --- a/src/core/zone.h +++ b/src/core/zone.h @@ -76,6 +76,8 @@ public: } /* ---- Zone class ----------------------------------------- */ + + enum Flags { Hidden = 1 }; /** * @brief create a new zone @@ -103,6 +105,18 @@ public: inline unsigned int id() const { return zone_id; } + + /// zone flags + inline const unsigned int flags() const { + return zone_flags; + } + + /** + * @brief returns true if a specified flag is set + * */ + inline const bool has_flag(const Flags flag) const { + return ((zone_flags & (unsigned int) flag) == (unsigned int) flag); + } /// ambient light color inline math::Color const & ambient_color() { @@ -144,6 +158,20 @@ public: Entity *search_entity(const std::string & label); /* ---- mutators ------------------------------------------- */ + + /** + * @brief set flag + * */ + inline void set_flag(Flags flag) { + zone_flags |= (unsigned int) flag; + } + + /** + * @brief unset flag + * */ + inline void unset_flag(Flags flag) { + zone_flags &= ~((unsigned int) flag); + } /** * @brief set the skybox name @@ -244,6 +272,7 @@ public: private: unsigned int zone_id; + unsigned int zone_flags; std::string zone_sky; math::Color zone_ambient_color; -- cgit v1.2.3