From c62fe609a69058e2e30f757e9a06f72a98464232 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 17 Sep 2010 15:19:34 +0000 Subject: Bump network protocol version to 19, menudescriptions use the info infrastructure, client-side lazy info update requests. Updated ROADMAP --- src/core/info.cc | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'src/core/info.cc') diff --git a/src/core/info.cc b/src/core/info.cc index 5615f8b..1a4f68f 100644 --- a/src/core/info.cc +++ b/src/core/info.cc @@ -8,6 +8,7 @@ #include "core/info.h" #include "sys/sys.h" #include "core/info.h" +#include "core/gameinterface.h" #include @@ -16,11 +17,8 @@ namespace core /* ---- class InfoType --------------------------------------------- */ -InfoType::InfoType(const char *label) +InfoType::InfoType(const char *label) : Label(label) { - if (label) - set_label(label); - infotype_registry.push_back(this); } @@ -59,7 +57,7 @@ InfoType *InfoType::find(const std::string & label) unsigned int info_id_counter = 0; // server-side constructor, assigns an id -Info::Info(const InfoType *type) +Info::Info(const InfoType *type, const char *label) : Label(label) { info_id_counter++; info_id = info_id_counter; @@ -71,30 +69,19 @@ Info::Info(const InfoType *type) info_price = 0; } -// client-side constructor, does not assign an id -Info::Info(const InfoType *type, const std::string & label) -{ - info_id = 0; - info_type = type; - info_registry.push_back(this); - - info_model = 0; - info_timestamp = 0; - info_price = 0; - - set_label(label); -} - -// client-side constructor, does not assign an id +// client-side constructor, id is passed as param Info::Info(const unsigned int id) { info_id = id; info_type = 0; info_registry.push_back(this); - info_model = 0; - info_timestamp = 0; + info_model = 0; info_price = 0; + + info_timestamp = 1; + + add_text("Requesting server information..."); } Info::~Info() @@ -209,6 +196,9 @@ void Info::receive_server_update(std::istream &is) add_text(n); } + + // set timestamp to 0 + info_timestamp = 0; } void Info::print() const -- cgit v1.2.3