diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 07a265ae0f2..41b0c9e3b99 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -240,15 +240,6 @@ void show_objectives(game_display& disp, const config& level, const std::string& ).show(); } -bool is_illegal_file_char(char c) -{ - return c == '/' || c == '\\' || c == ':' - #ifdef _WIN32 - || c == '?' || c == '|' || c == '<' || c == '>' || c == '*' || c == '"' - #endif - ; -} - namespace { /** Class to handle deleting a saved game. */ diff --git a/src/dialogs.hpp b/src/dialogs.hpp index e13c9b7bf5b..81f173ed51c 100644 --- a/src/dialogs.hpp +++ b/src/dialogs.hpp @@ -51,9 +51,6 @@ bool animate_unit_advancement(unit_map& units, map_location loc, game_display& g void show_objectives(game_display& disp, const config& level, const std::string& objectives); -/** check if a character is valid for a filename. */ -bool is_illegal_file_char(char c); - /** * Allow user to select the game they want to load. Returns the name of the * save they want to load. Stores whether the user wants to show a replay of diff --git a/src/savegame.cpp b/src/savegame.cpp index f1d244746a1..f194896d3bc 100644 --- a/src/savegame.cpp +++ b/src/savegame.cpp @@ -15,7 +15,7 @@ #include "savegame.hpp" -#include "dialogs.hpp" +#include "dialogs.hpp" //FIXME: get rid of this as soon as the two remaining dialogs are moved to gui2 #include "foreach.hpp" #include "game_end_exceptions.hpp" #include "game_events.hpp" @@ -391,9 +391,7 @@ void loadgame::check_version_compatibility() // do not load if too old, if either the savegame or the current game // has the version 'test' allow loading if(!game_config::is_compatible_savegame_version(gamestate_.version)) { - /* GCC-3.3 needs a temp var otherwise compilation fails */ - gui::message_dialog dlg(gui_, "", _("This save is from a version too old to be loaded.")); - dlg.show(); + gui2::show_message(gui_.video(), "", _("This save is from a version too old to be loaded.")); throw load_game_cancelled_exception(); } @@ -446,9 +444,7 @@ void loadgame::load_multiplayer_game() } if(gamestate_.campaign_type != "multiplayer") { - /* GCC-3.3 needs a temp var otherwise compilation fails */ - gui::message_dialog dlg(gui_, "", _("This is not a multiplayer save")); - dlg.show(); + gui2::show_message(gui_.video(), "", _("This is not a multiplayer save")); throw load_game_cancelled_exception(); } @@ -576,10 +572,19 @@ void savegame::check_filename(const std::string& filename, CVideo& video) } } +bool savegame::is_illegal_file_char(char c) +{ + return c == '/' || c == '\\' || c == ':' + #ifdef _WIN32 + || c == '?' || c == '|' || c == '<' || c == '>' || c == '*' || c == '"' + #endif + ; +} + void savegame::set_filename(std::string filename) { filename.erase(std::remove_if(filename.begin(), filename.end(), - dialogs::is_illegal_file_char), filename.end()); + is_illegal_file_char), filename.end()); filename_ = filename; } diff --git a/src/savegame.hpp b/src/savegame.hpp index f249ffb8e06..c95acf6b09e 100644 --- a/src/savegame.hpp +++ b/src/savegame.hpp @@ -169,6 +169,9 @@ protected: virtual void before_save(); private: + /** Checks if a certain character is allowed in a savefile name. */ + static bool is_illegal_file_char(char c); + /** Build the filename according to the specific savegame's needs. Subclasses will have to override this to take effect. */ virtual void create_filename() {}