mail[Wesnoth-commits] r34363 - in /trunk/src: menu_events.cpp savegame.cpp savegame.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by joerg . hinrichs on March 31, 2009 - 23:36:
Author: jhinrichs
Date: Tue Mar 31 23:36:23 2009
New Revision: 34363

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34363&view=rev
Log:
Savegame reorganization Step 1: Providing a simpler interface to saving and 
loading.
Restore the autosave logging skipped with the last commit.

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

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=34363&r1=34362&r2=34363&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Tue Mar 31 23:36:23 2009
@@ -740,15 +740,14 @@
                write_game_snapshot(snapshot);
 
                try {
-                       ::save_autosave(turn, snapshot, gamestate_);
+                       std::string savename = ::save_autosave(turn, 
snapshot, gamestate_);
+                       end = SDL_GetTicks();
+                       LOG_NG << "Milliseconds to save " << savename << ": " 
<< end - start << "\n";
                } catch(game::save_game_failed&) {
                        gui::message_dialog(*gui_,"",_("Could not auto save 
the game. Please save the game manually.")).show();
                        //do not bother retrying, since the user can just 
save the game
                        //maybe show a yes-no dialog for "disable autosaves 
now"?
                }
-               end = SDL_GetTicks();
-               LOG_NG << "Milliseconds to save Autosave: " << end - start << 
"\n";
-               //LOG_NG << "Milliseconds to save " << savename << ": " << 
end - start << "\n";
 
                remove_old_auto_saves();
        }

Modified: trunk/src/savegame.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.cpp?rev=34363&r1=34362&r2=34363&view=diff
==============================================================================
--- trunk/src/savegame.cpp (original)
+++ trunk/src/savegame.cpp Tue Mar 31 23:36:23 2009
@@ -66,7 +66,7 @@
 }
 
 /** Autosave */
-void save_autosave(unsigned turn, const config& snapshot, game_state& 
gamestate)
+std::string save_autosave(unsigned turn, const config& snapshot, game_state& 
gamestate)
 {
        std::string filename;
        if (gamestate.label.empty())
@@ -75,6 +75,8 @@
                filename = gamestate.label + "-" + _("Auto-Save") + 
lexical_cast<std::string>(turn);
 
        save_game(filename, snapshot, gamestate);
+
+       return filename;
 }
 
 void save_game(std::string& filename, const config& snapshot, game_state& 
gamestate)

Modified: trunk/src/savegame.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.hpp?rev=34363&r1=34362&r2=34363&view=diff
==============================================================================
--- trunk/src/savegame.hpp (original)
+++ trunk/src/savegame.hpp Tue Mar 31 23:36:23 2009
@@ -22,7 +22,7 @@
 #include <string>
 
 /** Autosave */
-void save_autosave(unsigned turn, const config& snapshot, game_state& 
gamestate);
+std::string save_autosave(unsigned turn, const config& snapshot, game_state& 
gamestate);
 
 /** Normal midgame save */
 void save_game(std::string& filename, const config& snapshot, game_state& 
gamestate);




Related Messages


Powered by MHonArc, Updated Tue Mar 31 23:40:36 2009