Author: jhinrichs
Date: Wed Apr 29 22:08:49 2009
New Revision: 35332

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35332&view=rev
Log:
Savegame refactoring: Removes some more references to dialogs.hpp.

Modified:
    trunk/src/dialogs.cpp
    trunk/src/dialogs.hpp
    trunk/src/savegame.cpp
    trunk/src/savegame.hpp

Modified: trunk/src/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/dialogs.cpp?rev=35332&r1=35331&r2=35332&view=diff
==============================================================================
--- trunk/src/dialogs.cpp (original)
+++ trunk/src/dialogs.cpp Wed Apr 29 22:08:49 2009
@@ -240,15 +240,6 @@
                        ).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. */

Modified: trunk/src/dialogs.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/dialogs.hpp?rev=35332&r1=35331&r2=35332&view=diff
==============================================================================
--- trunk/src/dialogs.hpp (original)
+++ trunk/src/dialogs.hpp Wed Apr 29 22:08:49 2009
@@ -50,9 +50,6 @@
 bool animate_unit_advancement(unit_map& units, map_location loc, game_display& 
gui, size_t choice);
 
 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

Modified: trunk/src/savegame.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.cpp?rev=35332&r1=35331&r2=35332&view=diff
==============================================================================
--- trunk/src/savegame.cpp (original)
+++ trunk/src/savegame.cpp Wed Apr 29 22:08:49 2009
@@ -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 @@
        // 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 @@
        }
 
        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 @@
        }
 }
 
+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;
 }
 

Modified: trunk/src/savegame.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.hpp?rev=35332&r1=35331&r2=35332&view=diff
==============================================================================
--- trunk/src/savegame.hpp (original)
+++ trunk/src/savegame.hpp Wed Apr 29 22:08:49 2009
@@ -169,6 +169,9 @@
        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() {}


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to