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: Fri, 24 Jun 2005 21:04:15 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/06/25 01:04:15

Modified files:
        src            : game.cpp 

Log message:
        fixed problem where cache was invalidated unnecessarily

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

Patches:
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.255 wesnoth/src/game.cpp:1.256
--- wesnoth/src/game.cpp:1.255  Thu Jun 23 23:22:16 2005
+++ wesnoth/src/game.cpp        Sat Jun 25 01:04:14 2005
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.255 2005/06/23 23:22:16 Sirp Exp $ */
+/* $Id: game.cpp,v 1.256 2005/06/25 01:04:14 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -112,7 +112,7 @@
        game_controller(const game_controller&);
        void operator=(const game_controller&);
 
-       void read_game_cfg(preproc_map& defines, config& cfg, bool use_cache);
+       void read_game_cfg(const preproc_map& defines, config& cfg, bool 
use_cache);
        void refresh_game_cfg(bool reset_translations=false);
 
        void download_campaigns();
@@ -1216,7 +1216,7 @@
 }
 
 //this function reads the game configuration, searching for valid cached 
copies first
-void game_controller::read_game_cfg(preproc_map& defines, config& cfg, bool 
use_cache)
+void game_controller::read_game_cfg(const preproc_map& defines, config& cfg, 
bool use_cache)
 {
        log_scope("read_game_cfg");
 
@@ -1272,10 +1272,12 @@
                                        }
                                }
 
-                               std::cerr << "no valid cache found. Writing 
cache to '" << fname << "'\n";
+                               std::cerr << "no valid cache found. Writing 
cache to '" << fname << "'\n";
+
+                               preproc_map defines_map(defines);
 
                                //read the file and then write to the cache
-                               scoped_istream stream = 
preprocess_file("data/game.cfg", &defines);
+                               scoped_istream stream = 
preprocess_file("data/game.cfg", &defines_map);
 
                                std::string error_log, user_error_log;
                                read(cfg, *stream, &error_log);
@@ -1286,7 +1288,7 @@
                                
get_files_in_dir(user_campaign_dir,&user_campaigns,NULL,ENTIRE_FILE_PATH);
                                for(std::vector<std::string>::const_iterator uc 
= user_campaigns.begin(); uc != user_campaigns.end(); ++uc) {
                                        try {
-                                               scoped_istream stream = 
preprocess_file(*uc,&defines);
+                                               scoped_istream stream = 
preprocess_file(*uc,&defines_map);
 
                                                std::string campaign_error_log;
 
@@ -1347,8 +1349,9 @@
                }
        }
 
-       std::cerr << "caching cannot be done. Reading file\n";
-       scoped_istream stream = preprocess_file("data/game.cfg", &defines);
+       std::cerr << "caching cannot be done. Reading file\n";
+       preproc_map defines_map(defines);
+       scoped_istream stream = preprocess_file("data/game.cfg", &defines_map);
        read(cfg, *stream);
 }
 




reply via email to

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