removed globally available parameters from oos_savegame() and...

...save_game_interactive()
This commit is contained in:
Gunter Labes 2009-10-01 08:08:16 +00:00
parent ae7aa4aed7
commit c51fdceb1d
7 changed files with 20 additions and 20 deletions

View File

@ -316,7 +316,7 @@ void play_controller::save_game(){
if(save_blocker::try_block()) {
save_blocker::save_unblocker unblocker;
savegame::game_savegame save(gamestate_, *gui_, to_config(), preferences::compress_saves());
save.save_game_interactive((*gui_).video(), "", gui::OK_CANCEL);
save.save_game_interactive("", gui::OK_CANCEL);
} else {
save_blocker::on_unblock(this,&play_controller::save_game);
}
@ -326,7 +326,7 @@ void play_controller::save_replay(){
if(save_blocker::try_block()) {
save_blocker::save_unblocker unblocker;
savegame::replay_savegame save(gamestate_, preferences::compress_saves());
save.save_game_interactive((*gui_).video(), "", gui::OK_CANCEL);
save.save_game_interactive("", gui::OK_CANCEL);
} else {
save_blocker::on_unblock(this,&play_controller::save_replay);
}
@ -1193,7 +1193,7 @@ void play_controller::process_oos(const std::string& msg) const
message << "The game is out of sync. It might not make much sense to continue.\n\nDo you want to save your game?";
message << "Error details:\n\n" << msg;
savegame::oos_savegame save(*resources::state_of_game, *resources::screen, to_config(), preferences::compress_saves());
save.save_game_interactive(resources::screen->video(), message.str(), gui::YES_NO); // can throw end_level_exception
savegame::oos_savegame save(to_config());
save.save_game_interactive(message.str(), gui::YES_NO); // can throw end_level_exception
}

View File

@ -586,9 +586,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
while(retry) {
retry = false;
retry = !save.save_game_interactive(disp,
_("Do you want to save your game?"),
gui::YES_NO)
retry = !save.save_game_interactive(_("Do you want to save your game?"), gui::YES_NO)
}
#else
save.save_game_automatic(disp.video());

View File

@ -526,8 +526,8 @@ void playmp_controller::process_oos(const std::string& err_msg) const {
temp_buf << " \n";
}
savegame::oos_savegame save(gamestate_, *gui_, to_config(), preferences::compress_saves());
save.save_game_interactive((*gui_).video(), temp_buf.str(), gui::YES_NO);
savegame::oos_savegame save(to_config());
save.save_game_interactive(temp_buf.str(), gui::YES_NO);
}
void playmp_controller::handle_generic_event(const std::string& name){

View File

@ -480,7 +480,8 @@ LEVEL_RESULT playsingle_controller::play_scenario(
}
savegame::game_savegame save(gamestate_, *gui_, to_config(), preferences::compress_saves());
save.save_game_interactive((*gui_).video(), _("A network disconnection has occurred, and the game\ncannot continue. Do you want to save the game?"), gui::YES_NO);
/** @todo FIXME: remove the odd linebreak after the string freeze */
save.save_game_interactive(_("A network disconnection has occurred, and the game\ncannot continue. Do you want to save the game?"), gui::YES_NO);
if(disconnect) {
throw network::error();
} else {

View File

@ -222,8 +222,8 @@ void replay_controller::process_oos(const std::string& msg) const
message << "The replay is corrupt/out of sync. It might not make much sense to continue.\n\nDo you want to save the game?";
message << "Error details:\n\n" << msg;
savegame::oos_savegame save(*resources::state_of_game, *resources::screen, to_config(), preferences::compress_saves());
save.save_game_interactive(resources::screen->video(), message.str(), gui::YES_NO); // can throw end_level_exception
savegame::oos_savegame save(to_config());
save.save_game_interactive(message.str(), gui::YES_NO); // can throw end_level_exception
}
void replay_controller::replay_show_everything(){

View File

@ -19,6 +19,7 @@
#include "foreach.hpp"
#include "game_display.hpp"
#include "game_end_exceptions.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "gui/dialogs/game_load.hpp"
#include "gui/dialogs/game_save.hpp"
@ -28,6 +29,7 @@
#include "map.hpp"
#include "map_label.hpp"
#include "replay.hpp"
#include "resources.hpp"
#include "serialization/binary_or_text.hpp"
#include "serialization/parser.hpp"
#include "statistics.hpp"
@ -622,15 +624,16 @@ bool savegame::save_game_automatic(CVideo& video, bool ask_for_overwrite, const
overwrite = check_overwrite(video);
if (!overwrite)
return save_game_interactive(video, "", gui::OK_CANCEL);
return save_game_interactive("", gui::OK_CANCEL);
}
return save_game(&video);
}
bool savegame::save_game_interactive(CVideo& video, const std::string& message,
bool savegame::save_game_interactive(const std::string& message,
gui::DIALOG_TYPE dialog_type)
{
CVideo& video = resources::screen->video();
show_confirmation_ = true;
create_filename();
@ -978,9 +981,8 @@ void autosave_savegame::create_filename()
set_filename(filename);
}
oos_savegame::oos_savegame(game_state &gamestate,
game_display& gui, const config& snapshot_cfg, const bool compress_saves)
: game_savegame(gamestate, gui, snapshot_cfg, compress_saves)
oos_savegame::oos_savegame(const config& snapshot_cfg)
: game_savegame(*resources::state_of_game, *resources::screen, snapshot_cfg, preferences::compress_saves())
{}
int oos_savegame::show_save_dialog(CVideo& video, const std::string& message, const gui::DIALOG_TYPE /*dialog_type*/)

View File

@ -157,7 +157,7 @@ public:
/** Save a game interactively through the savegame dialog. Used for manual midgame and replay
saves. The return value denotes, if the save was successful or not. */
bool save_game_interactive(CVideo& video, const std::string& message,
bool save_game_interactive(const std::string& message,
gui::DIALOG_TYPE dialog_type);
const std::string& filename() const { return filename_; }
@ -277,8 +277,7 @@ private:
class oos_savegame : public game_savegame
{
public:
oos_savegame(game_state &gamestate,
game_display& gui, const config& snapshot_cfg, const bool compress_saves);
oos_savegame(const config& snapshot_cfg);
private:
/** Display the save game dialog. */