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

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

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


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src theme.cpp
Date: Sat, 11 Dec 2004 17:51:20 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    04/12/11 22:40:46

Modified files:
        src            : theme.cpp 

Log message:
        allow partialresolutions to inherit from another partialresolution

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

Patches:
Index: wesnoth/src/theme.cpp
diff -u wesnoth/src/theme.cpp:1.25 wesnoth/src/theme.cpp:1.26
--- wesnoth/src/theme.cpp:1.25  Sat Dec 11 01:25:10 2004
+++ wesnoth/src/theme.cpp       Sat Dec 11 22:40:46 2004
@@ -130,7 +130,21 @@
 
        config* expand_partialresolution(const config& cfg, const config& 
topcfg) {
                // start with a copy of the declared parent
-               config* outcfg = new config(*topcfg.find_child("resolution", 
"id", cfg["inherits"]));
+               config* outcfg;
+               const config* origcfg = topcfg.find_child("resolution", "id", 
cfg["inherits"]);
+               if (origcfg == NULL) {
+                       origcfg = topcfg.find_child("partialresolution", "id", 
cfg["inherits"]);
+                       if (origcfg == NULL) {
+                               throw config::error("[partialresolution] refers 
to non-existant [resolution] "
+                                                   + cfg["inherits"]);
+                       }
+                       // expand parent again - not so big a deal, the only 
thing really
+                       // done again is applying he parent's changes, since we 
would have
+                       // copied anyway.
+                       outcfg = expand_partialresolution(*origcfg, topcfg);
+               } else {
+                       outcfg = new config(*origcfg);
+               }
 
                // override attributes
                for(string_map::const_iterator j = cfg.values.begin(); j != 
cfg.values.end(); ++j) {




reply via email to

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