Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef MENU_EVENTS_H_INCLUDED
00018 #define MENU_EVENTS_H_INCLUDED
00019
00020 #include "global.hpp"
00021 #include "chat_events.hpp"
00022 #include "floating_textbox.hpp"
00023 #include "unit_map.hpp"
00024
00025 class game_state;
00026 class gamemap;
00027 class tod_manager;
00028
00029 namespace events {
00030 class mouse_handler;
00031 }
00032
00033 struct fallback_ai_to_human_exception {};
00034
00035 namespace events {
00036
00037 class menu_handler : private chat_handler {
00038 public:
00039 menu_handler(game_display* gui, unit_map& units, std::vector<team>& teams,
00040 const config& level, const gamemap& map,
00041 const config& game_config, const tod_manager& tod_mng, game_state& gamestate);
00042 virtual ~menu_handler();
00043
00044 gui::floating_textbox& get_textbox();
00045 void set_gui(game_display* gui) { gui_ = gui; }
00046
00047 std::string get_title_suffix(int side_num);
00048 void objectives(int side_num);
00049 void show_statistics(int side_num);
00050 void unit_list();
00051 void status_table(int selected=0);
00052 void save_map();
00053 void preferences();
00054 void show_chat_log();
00055 void show_help();
00056 void speak();
00057 void whisper();
00058 void shout();
00059 void recruit(int side_num, const map_location &last_hex);
00060 void repeat_recruit(int side_num, const map_location &last_hex);
00061 void recall(int side_num, const map_location& last_hex);
00062 void undo(int side_num);
00063 void redo(int side_num);
00064 void show_enemy_moves(bool ignore_units, int side_num);
00065 void toggle_shroud_updates(int side_num);
00066 void update_shroud_now(int side_num);
00067 bool end_turn(int side_num);
00068 void goto_leader(int side_num);
00069 void unit_description();
00070 void rename_unit();
00071 void create_unit(mouse_handler& mousehandler);
00072 void create_unit_2(mouse_handler& mousehandler);
00073 void change_side(mouse_handler& mousehandler);
00074 void label_terrain(mouse_handler& mousehandler, bool team_only);
00075 void clear_labels();
00076 void continue_move(mouse_handler &mousehandler, int side_num);
00077 void execute_gotos(mouse_handler &mousehandler, int side_num);
00078 void toggle_ellipses();
00079 void toggle_grid();
00080 void unit_hold_position(mouse_handler &mousehandler, int side_num);
00081 void end_unit_turn(mouse_handler &mousehandler, int side_num);
00082 void search();
00083 void request_control_change(int side_num, const std::string &player);
00084 void user_command();
00085 void custom_command();
00086 void ai_formula();
00087 void clear_messages();
00088 std::vector<std::string> get_commands_list();
00089
00090 unit_map::iterator current_unit();
00091 unit_map::const_iterator current_unit() const
00092 { return const_cast<menu_handler *>(this)->current_unit(); }
00093 void move_unit_to_loc(const unit_map::iterator& ui, const map_location& target,
00094 bool continue_move, int side_num, mouse_handler &mousehandler);
00095
00096 bool do_recruit(const std::string& name, int side_num, const map_location& last_hex);
00097
00098 bool do_recall(const unit& un, int side_num, const map_location& recall_location, const map_location& recall_from);
00099 void do_speak();
00100 void do_search(const std::string& new_search);
00101 void do_command(const std::string &str);
00102 void do_ai_formula(const std::string &str, int side_num, mouse_handler &mousehandler);
00103 void clear_undo_stack(int side_num);
00104 protected:
00105 void add_chat_message(const time_t& time, const std::string& speaker,
00106 int side, const std::string& message,
00107 events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE);
00108 void send_chat_message(const std::string& message, bool allies_only=false);
00109 private:
00110
00111
00112 friend class console_handler;
00113
00114
00115
00116 bool has_friends() const;
00117 bool clear_shroud(int side_num);
00118 static void change_controller(const std::string& side, const std::string& controller);
00119 static void change_side_controller(const std::string& side, const std::string& player);
00120 void scenario_settings_table(int selected=0);
00121
00122 game_display* gui_;
00123 unit_map& units_;
00124 std::vector<team>& teams_;
00125 const config& level_;
00126 const gamemap& map_;
00127 const config& game_config_;
00128 const tod_manager& tod_manager_;
00129 game_state& gamestate_;
00130
00131 gui::floating_textbox textbox_info_;
00132 std::string last_search_;
00133 map_location last_search_hit_;
00134
00135 std::string last_recruit_;
00136 };
00137
00138 }
00139 #endif