Avoids making a copy of the gamestate when loading a savegame...

...ingame and removes an include that is not needed.
This commit is contained in:
Jörg Hinrichs 2009-08-24 22:12:18 +00:00
parent 6aa660a77a
commit 40dee0d2b7
2 changed files with 7 additions and 6 deletions

View File

@ -336,8 +336,7 @@ void play_controller::save_map(){
}
void play_controller::load_game(){
game_state state_copy(gamestate_); //we pass a copy of the gamestate, as cancelling the load dialog would clear gamestate_
loadgame load(*gui_, game_config_, state_copy);
loadgame load(*gui_, game_config_, gamestate_);
load.load_game();
}

View File

@ -33,7 +33,7 @@
#include "serialization/parser.hpp"
#include "sound.hpp"
#include "statistics.hpp"
#include "unit.hpp"
//#include "unit.hpp"
#include "unit_id.hpp"
#include "version.hpp"
@ -383,9 +383,7 @@ loadgame::loadgame(display& gui, const config& game_config, game_state& gamestat
, load_config_()
, show_replay_(false)
, cancel_orders_(false)
{
gamestate_ = game_state();
}
{}
void loadgame::show_dialog(bool show_replay, bool cancel_orders)
{
@ -399,6 +397,7 @@ void loadgame::show_dialog(bool show_replay, bool cancel_orders)
filename_ = load_dialog.filename();
show_replay_ = load_dialog.show_replay();
cancel_orders_ = load_dialog.cancel_orders();
gamestate_ = game_state();
}
}
else
@ -408,6 +407,9 @@ void loadgame::show_dialog(bool show_replay, bool cancel_orders)
filename_ = dialogs::load_game_dialog(gui_, game_config_, &show_replay_dialog, &cancel_orders_dialog);
show_replay_ = show_replay_dialog;
cancel_orders_ = cancel_orders_dialog;
if (filename_ != "")
gamestate_ = game_state();
}
}