aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2006-03-07 19:23:38 +0000
committerEugene Sandulenko2006-03-07 19:23:38 +0000
commitc3e223afdb55d203c7a6710426619ce8d8257736 (patch)
tree791dcf1ae49cd635f708995b63c490d0cebb7366
parent1157cbf84213773a91217c348dae1f05663b2fd7 (diff)
downloadscummvm-rg350-c3e223afdb55d203c7a6710426619ce8d8257736.tar.gz
scummvm-rg350-c3e223afdb55d203c7a6710426619ce8d8257736.tar.bz2
scummvm-rg350-c3e223afdb55d203c7a6710426619ce8d8257736.zip
Fix implementation of UseWithPrefix keyword
svn-id: r21133
-rw-r--r--gui/theme-config.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp
index 68ecb08478..65230d0bf5 100644
--- a/gui/theme-config.cpp
+++ b/gui/theme-config.cpp
@@ -149,11 +149,21 @@ void Theme::processResSection(Common::ConfigFile &config, String name, bool skip
continue;
}
if (iterk->key == "useWithPrefix") {
- if (iterk->value == name)
- error("Theme section [%s]: cannot use itself", name.c_str());
- if (!config.hasSection(name))
- error("Undefined use of section [%s]", name.c_str());
- processResSection(config, iterk->value, true, iterk->value + "_");
+ const char *temp = iterk->value.c_str();
+ const char *pos = strrchr(temp, ' ');
+ String n, pref;
+
+ if (pos == NULL)
+ error("2 arguments required for useWithPrefix keyword");
+
+ n = String(temp, strchr(temp, ' ') - temp);
+ pref = String(pos + 1);
+
+ if (n == name)
+ error("Theme section [%s]: cannot use itself", n.c_str());
+ if (!config.hasSection(n))
+ error("Undefined use of section [%s]", n.c_str());
+ processResSection(config, n, true, pref);
continue;
}
processSingleLine(name, prefix + iterk->key, iterk->value);