wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src game.cpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src game.cpp
Date: Mon, 27 Jun 2005 20:28:16 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/06/28 00:28:16

Modified files:
        src            : game.cpp 

Log message:
        attempt to fix possible config corruption when loading user campaigns

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.257&tr2=1.258&r1=text&r2=text

Patches:
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.257 wesnoth/src/game.cpp:1.258
--- wesnoth/src/game.cpp:1.257  Sat Jun 25 13:14:33 2005
+++ wesnoth/src/game.cpp        Tue Jun 28 00:28:16 2005
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.257 2005/06/25 13:14:33 Sirp Exp $ */
+/* $Id: game.cpp,v 1.258 2005/06/28 00:28:16 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -94,6 +94,8 @@
        bool init_language();
        bool play_test();
        bool play_multiplayer_mode();
+
+       void reset_game_cfg();
 
        bool is_loading() const;
        bool load_game();
@@ -113,7 +115,7 @@
        void operator=(const game_controller&);
 
        void read_game_cfg(const preproc_map& defines, config& cfg, bool 
use_cache);
-       void refresh_game_cfg(bool reset_translations=false);
+       void refresh_game_cfg(bool reset_translations=false);
 
        void download_campaigns();
        void upload_campaign(const std::string& campaign, network::connection 
sock);
@@ -351,24 +353,11 @@
 bool game_controller::init_config()
 {
        units_data_.clear();
-       defines_map_.clear();
        //Resets old_defines_map_, to force refresh_game_cfg to reload
        //everything.
-       old_defines_map_.clear();
-
-       //load in the game's configuration files
-#if defined(__APPLE__)
-       defines_map_["APPLE"] = preproc_define();
-#endif
-
-       defines_map_["NORMAL"] = preproc_define();
-       defines_map_["MEDIUM"] = preproc_define();
-
-       if(multiplayer_mode_) {
-               defines_map_["MULTIPLAYER"] = preproc_define();
-       }
-
-       refresh_game_cfg();
+       old_defines_map_.clear();
+
+       reset_game_cfg();
 
        game_config::load_config(game_config_.child("game_config"));
 
@@ -1382,6 +1371,25 @@
                                        e.message + _("' (The game will now 
exit)"));
                throw e;
        }
+}
+
+void game_controller::reset_game_cfg()
+{
+       defines_map_.clear();
+
+       //load in the game's configuration files
+#if defined(__APPLE__)
+       defines_map_["APPLE"] = preproc_define();
+#endif
+
+       defines_map_["NORMAL"] = preproc_define();
+       defines_map_["MEDIUM"] = preproc_define();
+
+       if(multiplayer_mode_) {
+               defines_map_["MULTIPLAYER"] = preproc_define();
+       }
+
+       refresh_game_cfg();
 }
 
 void game_controller::play_game(RELOAD_GAME_DATA reload)
@@ -1600,7 +1608,10 @@
        SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
 #endif
 
-       for(;;) {
+       for(;;) {
+               //make sure the game config is always set to how it should be 
at the title screen
+               game.reset_game_cfg();
+
                statistics::fresh_stats();
 
                sound::play_music(game_config::title_music);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]