|
From: Erik V. <ev...@us...> - 2011-07-22 18:59:57
|
rails/common/parser/Tag.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 505fb03f5041aa14be1d8e772d3b02aff870f2d5
Author: Erik Vos <eri...@xs...>
Date: Fri Jul 22 20:59:27 2011 +0200
Added comments to explain option name shortening code.
diff --git a/rails/common/parser/Tag.java b/rails/common/parser/Tag.java
index ed1c334..712e5b6 100644
--- a/rails/common/parser/Tag.java
+++ b/rails/common/parser/Tag.java
@@ -318,9 +318,15 @@ public class Tag {
String optionValue = gameOptions.get(name);
// For backwards compatibility: search for an extended name
- // TODO OBSOLETE??
+ /* This applies to parametrized options, such as "UnlimitedTopTrains".
+ * It parametrized with a parameter "D" to allow display as "Unlimited D-trains"
+ * and still remaining generic.
+ * Parametrization means that the actual name is UnlimitedTopTrains_D,
+ * for instance in saved files, and so the name must be shortened to find a match.
+ */
if (optionValue == null) {
for (String optName : gameOptions.keySet()) {
+ // startsWith is a shortcut, perhaps it should be matches(name+"_.*").
if (optName != null && optName.startsWith(name)) {
optionValue = gameOptions.get(optName);
log.warn("Option name "+name+" replaced by "+optName);
|