From 4293e8854a30443e4d5818fc55df404976dbfd9b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 14 Nov 2009 14:14:21 +0000 Subject: update the info system, fixes network info exchange --- src/core/info.h | 64 +++++++++++---------------------------------------------- 1 file changed, 12 insertions(+), 52 deletions(-) (limited to 'src/core/info.h') diff --git a/src/core/info.h b/src/core/info.h index 13f38f8..0296ec9 100644 --- a/src/core/info.h +++ b/src/core/info.h @@ -19,62 +19,40 @@ namespace core { /** - * @brief an object class information record - * Describes a class of object + * @brief an information record type + * The InfoType groups information records of the same type */ class InfoType : public Label { public: /** - * @brief create a server side object class information record + * @brief create a new information record type + * The constructor automaticly adds the instance to the registry */ InfoType(const char* label); - /** - * @brief create a client side object class information record - */ - InfoType(const unsigned int id); - - virtual ~InfoType(); - - /* ---- inspectors ------------------------------------------------- */ - - inline const unsigned int id() const { - return infotype_id; - } - -private: - - unsigned int infotype_id; - + virtual ~InfoType(); /* ---- static infoclass registry ---------------------------------- */ - -public: + /// clear infotype registry static void clear(); /// search the infotype registry for a label static InfoType *find(const std::string & label); - /// search the infotype registry for an id - static InfoType *find(const unsigned int id); - - private: /// info registry type definition typedef std::vector Registry; static Registry infotype_registry; - static unsigned int infotype_id_counter; - }; // class InfoType /** * @brief an information record * An information record holds extended information about a specific entity or item class. - * This information isexchanged between server and the client, and can be used to build - * HUD widgets/ + * This information is exchanged between server and the client, and can be used to build + * HUD widgets. */ class Info : public Label { @@ -83,26 +61,16 @@ public: typedef std::deque Text; /** - * @brief create a new server-side information record - * This is a server-side constructor and assigns an id + * @brief create a new information record + * The constructor automaticly adds the instance to the registry */ - Info(); + Info(const InfoType *type = 0); - /** - * @brief create a new client-side information record - * This is a client-side constructor - */ - Info(const unsigned int id); - /// delete the information record virtual ~Info(); /* ---- inspectors ------------------------------------------------- */ - inline const unsigned int id() const { - return info_id; - } - inline const InfoType* type() const { return info_type; } @@ -173,7 +141,6 @@ public: private: const InfoType* info_type; - unsigned int info_id; long info_price; unsigned long info_timestamp; std::string info_modelname; @@ -199,9 +166,6 @@ public: /// search the info registry for a label static Info *find(const std::string & label); - /// search the info registry for an id - static Info *find(const unsigned int id); - /// search the info registry for a record with a matching label or name static Info *search(const std::string & searchstr); @@ -211,9 +175,6 @@ public: /// search the info registry for a label, belonging to a specific class static Info *find(const InfoType *type, const std::string & label); - /// search the info registry for an id, belonging to a specific class - static Info *find(const InfoType *type, const unsigned int id); - /// search the info registry for a record with a matching label or name and belonging to a specific class static Info *search(const InfoType *type, const std::string & searchstr); @@ -224,11 +185,10 @@ public: static void list(); /// list a single class in the info registry - static void list_class(const InfoType *type); + static void list(const InfoType *type); private: static Registry info_registry; - static unsigned int info_id_counter; }; } -- cgit v1.2.3