Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-09-22 21:32:34 +0000
committerStijn Buys <ingar@osirion.org>2010-09-22 21:32:34 +0000
commita6f9773c358dd7d091ff64cbda504ab8d8066dd3 (patch)
tree226e23c4656957e908623ccda9d3d1c50240a0b4 /src/core/info.cc
parentbbb43d1c15f2858573f5abb595aa62f8224e4d76 (diff)
full trading support for networked games
Diffstat (limited to 'src/core/info.cc')
-rw-r--r--src/core/info.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/info.cc b/src/core/info.cc
index 16e68f5..cc1720e 100644
--- a/src/core/info.cc
+++ b/src/core/info.cc
@@ -53,6 +53,23 @@ InfoType *InfoType::find(const std::string & label)
return 0;
}
+void InfoType::list()
+{
+ if (infotype_registry.size()) {
+ con_print << " ";
+ for (Registry::const_iterator it = infotype_registry.begin(); it != infotype_registry.end(); it++) {
+ InfoType *infotype = (*it);
+
+ con_print << infotype->label() << " ";
+ }
+ con_print << std::endl;
+ }
+ con_print << "^B " << infotype_registry.size() << " info types" << std::endl;
+
+ infotype_registry.clear();
+}
+
+
/* ---- class Info ------------------------------------------------- */
unsigned int info_id_counter = 0;
@@ -158,7 +175,10 @@ void Info::clear_text()
void Info::serialize_server_update(std::ostream & os) const
{
- os << '"' << name() << "\" \"" << modelname() << "\" " << info_text.size() << " ";
+ os << '"' << name() << "\" \"" << modelname() << "\" "
+ << price() << " "
+ << volume() << " "
+ << info_text.size() << " ";
for (Text::const_iterator it = info_text.begin(); it != info_text.end(); it++) {
if (it != info_text.begin())
@@ -186,6 +206,9 @@ void Info::receive_server_update(std::istream &is)
while ((is.get(c)) && (c != '"'))
n += c;
set_modelname(n);
+
+ is >> info_price;
+ is >> info_volume;
// read info text
size_t s;
@@ -377,6 +400,7 @@ void Info::list(const Info *info)
void Info::list()
{
+ InfoType::list();
list_header();
for (Registry::iterator it = info_registry.begin(); it != info_registry.end(); it++) {
Info *info = (*it);