00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef REPORTS_HPP_INCLUDED
00016 #define REPORTS_HPP_INCLUDED
00017
00018 #include <set>
00019 #include <string>
00020 #include <vector>
00021
00022 #include "image.hpp"
00023 #include "team.hpp"
00024
00025
00026
00027 namespace reports {
00028 enum TYPE { UNIT_NAME, UNIT_TYPE, UNIT_RACE, UNIT_LEVEL,
00029 UNIT_SIDE, UNIT_AMLA, UNIT_TRAITS, UNIT_STATUS,
00030 UNIT_ALIGNMENT, UNIT_ABILITIES, UNIT_HP, UNIT_XP,
00031 UNIT_ADVANCEMENT_OPTIONS, UNIT_MOVES, UNIT_WEAPONS,
00032 UNIT_IMAGE, UNIT_PROFILE, TIME_OF_DAY,
00033 TURN, GOLD, VILLAGES, NUM_UNITS, UPKEEP, EXPENSES,
00034 INCOME, TERRAIN, POSITION, SIDE_PLAYING, OBSERVERS,
00035 REPORT_COUNTDOWN, REPORT_CLOCK, SELECTED_TERRAIN,
00036 EDIT_LEFT_BUTTON_FUNCTION, NUM_REPORTS};
00037
00038 enum { UNIT_REPORTS_BEGIN=UNIT_NAME, UNIT_REPORTS_END=UNIT_PROFILE+1 };
00039 enum { STATUS_REPORTS_BEGIN=TIME_OF_DAY, STATUS_REPORTS_END=NUM_REPORTS };
00040
00041 const std::string& report_name(TYPE type);
00042
00043 struct element {
00044 private:
00045
00046 element();
00047 public:
00048 explicit element(const std::string& text) :
00049 image(),
00050 text(text),
00051 tooltip()
00052 {}
00053
00054
00055
00056
00057 image::locator image;
00058 std::string text;
00059
00060 std::string tooltip;
00061 element(const std::string& text, const std::string& image, const std::string& tooltip) :
00062 image(image), text(text), tooltip(tooltip) {}
00063
00064 element(const std::string& text, const image::locator& image, const std::string& tooltip) :
00065 image(image), text(text), tooltip(tooltip) {}
00066 element(const std::string& text, const char* image, const std::string& tooltip) :
00067 image(image), text(text), tooltip(tooltip) {}
00068
00069 bool operator==(const element& o) const {
00070 return o.text == text && o.image == image && o.tooltip == tooltip;
00071 }
00072 bool operator!=(const element& o) const { return !(o == *this); }
00073 };
00074 struct report : public std::vector<element> {
00075 report() {}
00076 explicit report(const std::string& text) { this->push_back(element(text)); }
00077 report(const std::string& text, const std::string& image, const std::string& tooltip) {
00078 this->push_back(element(text, image, tooltip));
00079 }
00080 report(const std::string& text, const char* image, const std::string& tooltip) {
00081 this->push_back(element(text, image, tooltip));
00082 }
00083 report(const std::string& text, const image::locator& image, const std::string& tooltip) {
00084 this->push_back(element(text, image, tooltip));
00085 }
00086
00087
00088 void add_text(std::stringstream& text, std::stringstream& tooltip);
00089 void add_text(const std::string& text, const std::string& tooltip);
00090 void add_image(const std::string& image, const std::string& tooltip);
00091 void add_image(std::stringstream& image, std::stringstream& tooltip);
00092 };
00093
00094 report generate_report(TYPE type,
00095 std::map<reports::TYPE, std::string> report_contents,
00096 const gamemap& map, unit_map& units,
00097 const std::vector<team>& teams, const team& current_team,
00098 unsigned int current_side, int unsigned active_side,
00099 const gamemap::location& loc, const gamemap::location& mouseover, const gamemap::location& displayed_unit_hex,
00100 const gamestatus& status, const std::set<std::string>& observers,
00101 const config& level);
00102 }
00103
00104 #endif