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