Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef DIALOGS_H_INCLUDED
00016 #define DIALOGS_H_INCLUDED
00017
00018 class attack_type;
00019 class config;
00020 class display;
00021 class game_display;
00022 class unit;
00023 class unit_map;
00024 class unit_type;
00025
00026 #include "map_location.hpp"
00027 #include "construct_dialog.hpp"
00028 #include "network.hpp"
00029
00030 namespace dialogs {
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 void advance_unit(const map_location &loc, bool random_choice = false, bool add_replay_event = false);
00047
00048
00049
00050
00051
00052 int advance_unit_dialog(const map_location &loc);
00053
00054
00055
00056
00057
00058
00059
00060 bool animate_unit_advancement(const map_location &loc, size_t choice, const bool &fire_event = true);
00061
00062 void show_objectives(const config &level, const std::string &objectives);
00063
00064
00065
00066
00067
00068
00069
00070 std::string load_game_dialog(display& disp, const config& terrain_config, bool* select_difficulty, bool* show_replay, bool* cancel_orders);
00071
00072
00073 class unit_preview_pane : public gui::preview_pane
00074 {
00075 public:
00076 enum TYPE { SHOW_ALL, SHOW_BASIC };
00077 struct details {
00078 details();
00079
00080 surface image;
00081 std::string name, type_name, race;
00082 int level;
00083 std::string alignment, traits;
00084 std::vector<t_string> abilities;
00085 int hitpoints, max_hitpoints;
00086 int experience, max_experience;
00087 std::string hp_color, xp_color;
00088 int movement_left, total_movement;
00089 std::vector<attack_type> attacks;
00090 };
00091
00092 unit_preview_pane(const gui::filter_textbox *filter = NULL,
00093 TYPE type = SHOW_ALL, bool left_side = true);
00094
00095 bool show_above() const;
00096 bool left_side() const;
00097 void set_selection(int index);
00098
00099 handler_vector handler_members();
00100
00101 protected:
00102 int index_;
00103 gui::button details_button_;
00104
00105 private:
00106 virtual size_t size() const = 0;
00107 virtual const details get_details() const = 0;
00108 virtual void process_event() = 0;
00109
00110 void draw_contents();
00111
00112 const gui::filter_textbox* filter_;
00113 bool weapons_;
00114 bool left_;
00115 };
00116
00117 class units_list_preview_pane : public dialogs::unit_preview_pane
00118 {
00119 public:
00120 units_list_preview_pane(const unit *u, TYPE type = SHOW_ALL, bool left_side = true);
00121 units_list_preview_pane(const std::vector<const unit *> &units,
00122 const gui::filter_textbox *filter = NULL,
00123 TYPE type = SHOW_ALL, bool left_side = true);
00124 units_list_preview_pane(const std::vector<unit> &units,
00125 const gui::filter_textbox *filter = NULL,
00126 TYPE type = SHOW_ALL, bool left_side = true);
00127
00128 private:
00129 size_t size() const;
00130 const details get_details() const;
00131 void process_event();
00132
00133 std::vector<const unit *> units_;
00134 };
00135
00136
00137 class unit_types_preview_pane : public dialogs::unit_preview_pane
00138 {
00139 public:
00140 unit_types_preview_pane(
00141 std::vector<const unit_type*>& unit_types, const gui::filter_textbox* filterbox=NULL,
00142 int side = 1, TYPE type=SHOW_ALL, bool left_side=true);
00143
00144 private:
00145 size_t size() const;
00146 const details get_details() const;
00147 void process_event();
00148
00149 std::vector<const unit_type*>* unit_types_;
00150 int side_;
00151 };
00152
00153
00154 void show_unit_description(const unit_type &t);
00155 void show_unit_description(const unit &u);
00156
00157 network::connection network_send_dialog(display& disp, const std::string& msg, config& cfg, network::connection connection_num=0);
00158 network::connection network_receive_dialog(display& disp, const std::string& msg, config& cfg, network::connection connection_num=0);
00159 network::connection network_connect_dialog(display& disp, const std::string& msg, const std::string& hostname, int port);
00160
00161 }
00162
00163 #endif