remove game_state from menu_handler

This commit is contained in:
gfgtdf 2014-06-09 02:59:12 +02:00
parent e7573db2fe
commit 0beb8a1e79
4 changed files with 14 additions and 10 deletions

View File

@ -83,14 +83,13 @@ namespace events{
menu_handler::menu_handler(game_display* gui, game_board & board,
const config& level,
const config& game_config, game_state& gamestate) :
const config& game_config) :
gui_(gui),
units_(board.units_),
teams_(board.teams_),
level_(level),
map_(board.map()),
game_config_(game_config),
gamestate_(gamestate),
textbox_info_(),
last_search_(),
last_search_hit_()
@ -2920,10 +2919,7 @@ void console_handler::do_benchmark() {
menu_handler_.gui_->toggle_benchmark();
}
void console_handler::do_save() {
savegame::ingame_savegame save(menu_handler_.gamestate_, *menu_handler_.gui_,
resources::controller->to_config(),
preferences::save_compression_format());
save.save_game_automatic(menu_handler_.gui_->video(), true, get_data());
resources::controller->do_consolesave(get_data());
}
void console_handler::do_save_quit() {
do_save();

View File

@ -22,7 +22,6 @@
#include "unit_map.hpp"
class game_board;
class game_state;
class gamemap;
namespace events {
@ -37,7 +36,7 @@ class menu_handler : private chat_handler {
public:
menu_handler(game_display* gui, game_board & board,
const config& level,
const config& game_config, game_state& gamestate);
const config& game_config);
virtual ~menu_handler();
gui::floating_textbox& get_textbox();
@ -119,7 +118,6 @@ private:
const config& level_;
const gamemap& map_;
const config& game_config_;
game_state& gamestate_;
gui::floating_textbox textbox_info_;
std::string last_search_;

View File

@ -108,7 +108,7 @@ play_controller::play_controller(const config& level, game_state& state_of_game,
labels_manager_(),
help_manager_(&game_config),
mouse_handler_(NULL, gameboard_),
menu_handler_(NULL, gameboard_, level, game_config, state_of_game),
menu_handler_(NULL, gameboard_, level, game_config),
soundsources_manager_(),
tod_manager_(level),
pathfind_manager_(),
@ -1528,3 +1528,11 @@ void play_controller::do_autosave()
}
void play_controller::do_consolesave(const std::string& filename)
{
savegame::ingame_savegame save(gamestate_, *gui_,
to_config(), preferences::save_compression_format());
save.save_game_automatic(gui_->video(), true, filename);
}

View File

@ -164,6 +164,8 @@ public:
void do_autosave();
void do_consolesave(const std::string& filename);
events::mouse_handler& get_mouse_handler_base();
events::menu_handler& get_menu_handler() { return menu_handler_; }