[Wesnoth-cvs-commits] wesnoth/src theme.cpp (December 11, 2004 - 23:51)

 

CVSROOT:	/cvsroot/wesnoth
Module name:	wesnoth
Branch: 	
Changes by:	Yann Dirson <ydirson@xxxxxxxxxx>	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) {



You are on the gna.org mail server.

Generated by mhonarc, Tue Sep 20 16:45:14 2005