From 9ce4282b3c309bb838888264f2e68c0b458224ac Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 7 Oct 2012 21:38:00 +0000 Subject: Updated code comments, added zone information record. --- src/core/zone.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 12 deletions(-) (limited to 'src/core/zone.h') diff --git a/src/core/zone.h b/src/core/zone.h index 79e4a6c..644620d 100644 --- a/src/core/zone.h +++ b/src/core/zone.h @@ -64,16 +64,34 @@ public: static inline Registry & registry() { return zone_registry; } + + /// default infotype for zones + static inline const InfoType *infotype() { + return zone_infotype; + } + + /// set the default infotype for zones + static inline void set_infotype(const InfoType *infotype) { + zone_infotype = infotype; + } /* ---- Zone class ----------------------------------------- */ - /// create a new zone + /** + * @brief create a new zone + * This is a server-side constructor + * */ Zone(std::string const & label); - /// create a zone from stream data + /** + * @brief create a zone from stream data + * This is a client-side constructor + * */ Zone(std::istream & is); - /// delete a zone + /** + * @brief default destructor + * */ virtual ~Zone(); /* ---- inspectors ----------------------------------------- */ @@ -96,10 +114,22 @@ public: return zone_sky; } - /// default zone view + /// default zone view, returns 0 if not set inline Entity *default_view() { return zone_defaultview; } + + /// zone information record, returns 0 if not set + inline const Info *info() const { + return zone_info; + } + + /** + * @brief returns the galactic location of this zone + * */ + const math::Vector3f & location() const { + return zone_location; + } /// find an entity inside a zone Entity *find_entity(const Entity *entity); @@ -115,32 +145,66 @@ public: /* ---- mutators ------------------------------------------- */ - /// set the skybox name + /** + * @brief set the skybox name + * */ inline void set_sky(std::string const & sky) { zone_sky.assign(sky); } - /// set the ambient light color + /** + * @brief set the ambient light color + * */ inline void set_ambient_color(const math::Color & ambient_color) { zone_ambient_color.assign(ambient_color); } - /// set the ambient light color + /** + * @brief set the ambient light color + * @param r red value [0-1] + * @param g green value [0-1] + * @param b blue value [0-1] + * */ inline void set_ambient_color(float r, float g, float b) { zone_ambient_color.assign(r, g, b); } - /// set the default view + /** + * @brief set the default view for this zone + * */ inline void set_default_view(Entity *entity) { zone_defaultview = entity; } + + /** + * @brief set the galactic location for this zone + * */ + inline void set_location(float x, float y, float z) { + zone_location.assign(x, y, z); + } + + /** + * @brief set the galactic location for this zone + * */ + inline void set_location(const math::Vector3f & location) { + zone_location.assign(location); + } + + /** + * @brief set the information record for this zone + * */ + void set_info(const Info *info); /* ---- serializers ---------------------------------------- */ - /// serialize a server-to-client update on a stream + /** + * @brief serialize the zone's state to a server-to-client update message on a stream + * */ void serialize_server_update(std::ostream & os) const; - /// receive a server-to-client update from a stream + /** + * @brief deserialize the zone's state from a server-to-client update message on a stream + * */ void receive_server_update(std::istream &is); /* ---- zone content --------------------------------------- */ @@ -183,10 +247,9 @@ private: std::string zone_sky; math::Color zone_ambient_color; + math::Vector3f zone_location; Content zone_content; - static Registry zone_registry; - Entity *zone_defaultview; btAxisSweep3 *zone_bullet_cache; @@ -195,6 +258,11 @@ private: math::BoundingBox3f zone_keepalive_box; bool zone_keepalive_run; + + const Info* zone_info; + + static const InfoType *zone_infotype; + static Registry zone_registry; }; } -- cgit v1.2.3