added diagnostics which log all network messages
This commit is contained in:
parent
6743e126fa
commit
5b35e46674
5 changed files with 30 additions and 2 deletions
|
@ -279,6 +279,11 @@ connection receive_data(config& cfg, connection connection_num, int timeout)
|
|||
assert(schema != schemas.end());
|
||||
|
||||
cfg.read_compressed(buffer,schema->second.incoming);
|
||||
|
||||
std::cerr << "--- RECEIVED DATA from " << ((int)*i) << ": '"
|
||||
<< cfg.write() << "'\n--- END RECEIVED DATA\n";
|
||||
|
||||
|
||||
return *i;
|
||||
}
|
||||
}
|
||||
|
@ -334,6 +339,9 @@ void send_data(const config& cfg, connection connection_num, size_t max_size)
|
|||
std::string value(4,'x');
|
||||
value += cfg.write_compressed(schema->second.outgoing);
|
||||
|
||||
std::cerr << "--- SEND DATA to " << ((int)connection_num) << ": '"
|
||||
<< cfg.write() << "'\n--- END SEND DATA\n";
|
||||
|
||||
char buf[4];
|
||||
SDLNet_Write32(value.size()+1-4,buf);
|
||||
std::copy(buf,buf+4,value.begin());
|
||||
|
|
|
@ -1263,7 +1263,7 @@ void turn_info::unit_description()
|
|||
return;
|
||||
}
|
||||
|
||||
const std::string description = un->second.type().unit_description()
|
||||
const std::string description = un->second.unit_description()
|
||||
+ "\n\n" + string_table["see_also"];
|
||||
|
||||
std::vector<std::string> options;
|
||||
|
|
|
@ -85,7 +85,7 @@ report generate_report(TYPE type, const gamemap& map, const unit_map& units,
|
|||
case UNIT_DESCRIPTION:
|
||||
return report(u->second.description());
|
||||
case UNIT_TYPE:
|
||||
return report(u->second.type().language_name(),"",u->second.type().unit_description());
|
||||
return report(u->second.type().language_name(),"",u->second.unit_description());
|
||||
case UNIT_LEVEL:
|
||||
str << u->second.type().level();
|
||||
break;
|
||||
|
|
12
src/unit.cpp
12
src/unit.cpp
|
@ -176,6 +176,15 @@ const std::string& unit::underlying_description() const
|
|||
return underlying_description_;
|
||||
}
|
||||
|
||||
const std::string& unit::unit_description() const
|
||||
{
|
||||
if(custom_unit_description_ != "") {
|
||||
return custom_unit_description_;
|
||||
} else {
|
||||
return type().unit_description();
|
||||
}
|
||||
}
|
||||
|
||||
void unit::rename(const std::string& new_description)
|
||||
{
|
||||
description_ = new_description;
|
||||
|
@ -497,6 +506,8 @@ void unit::read(game_data& data, const config& cfg)
|
|||
description_ = underlying_description_;
|
||||
}
|
||||
|
||||
custom_unit_description_ = cfg["unit_description"];
|
||||
|
||||
traitsDescription_ = cfg["traits_description"];
|
||||
const std::map<std::string,std::string>::const_iterator recruit_itor =
|
||||
cfg.values.find("canrecruit");
|
||||
|
@ -591,6 +602,7 @@ void unit::write(config& cfg) const
|
|||
|
||||
cfg["user_description"] = description_;
|
||||
cfg["description"] = underlying_description_;
|
||||
cfg["unit_description"] = custom_unit_description_;
|
||||
|
||||
cfg["traits_description"] = traitsDescription_;
|
||||
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
const std::string& description() const;
|
||||
const std::string& underlying_description() const;
|
||||
|
||||
//information about the unit -- a detailed description of it
|
||||
const std::string& unit_description() const;
|
||||
|
||||
void rename(const std::string& new_description);
|
||||
|
||||
int hitpoints() const;
|
||||
|
@ -152,6 +155,11 @@ private:
|
|||
|
||||
std::string underlying_description_, description_;
|
||||
|
||||
//this field is used if the scenario creator places a custom unit description
|
||||
//with a certain unit. If this field is empty, then the more general unit description
|
||||
//from the unit's base type will be used
|
||||
std::string custom_unit_description_;
|
||||
|
||||
bool recruit_;
|
||||
|
||||
std::string role_;
|
||||
|
|
Loading…
Add table
Reference in a new issue