00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "global.hpp"
00016
00017 #include "reports.hpp"
00018
00019 #include <cassert>
00020 #include <map>
00021
00022 namespace {
00023 const std::string report_names[] = {
00024 "unit_name", "unit_type",
00025 "unit_race", "unit_level", "unit_side", "unit_amla",
00026 "unit_traits", "unit_status", "unit_alignment", "unit_abilities",
00027 "unit_hp", "unit_xp", "unit_advancement_options", "unit_moves",
00028 "unit_weapons", "unit_image", "unit_profile", "time_of_day",
00029 "turn", "gold", "villages", "num_units", "upkeep", "expenses",
00030 "income", "terrain", "position", "side_playing", "observers",
00031 "report_countdown", "report_clock",
00032 "selected_terrain", "edit_left_button_function"
00033 };
00034 }
00035
00036 namespace reports {
00037
00038 const std::string& report_name(TYPE type)
00039 {
00040 assert(sizeof(report_names)/sizeof(*report_names) == NUM_REPORTS);
00041 assert(type < NUM_REPORTS);
00042
00043 return report_names[type];
00044 }
00045
00046 void report::add_text(std::stringstream& text, std::stringstream& tooltip) {
00047 add_text(text.str(), tooltip.str());
00048
00049 text.str("");
00050 tooltip.str("");
00051 }
00052
00053 void report::add_text(const std::string& text, const std::string& tooltip) {
00054 this->push_back(element(text,"",tooltip));
00055 }
00056
00057 void report::add_image(std::stringstream& image, std::stringstream& tooltip) {
00058 add_image(image.str(), tooltip.str());
00059
00060 image.str("");
00061 tooltip.str("");
00062 }
00063
00064 void report::add_image(const std::string& image, const std::string& tooltip) {
00065 this->push_back(element("",image,tooltip));
00066 }
00067
00068 }