summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-06-01 15:19:59 +0000
committerfrosch <frosch@openttd.org>2012-06-01 15:19:59 +0000
commitbe0b94400d6e7e9136703d60b70b495d84f25108 (patch)
tree45ab8e4c13628c0ec58bd9e061747a005019a9a2 /src/script
parentf7c9620271e0ee620fad8fe325d67e59539c08d8 (diff)
downloadopenttd-be0b94400d6e7e9136703d60b70b495d84f25108.tar.xz
(svn r24317) -Feature: Add dropdowns to AI configurations, if all values have labels.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/script_config.hpp1
-rw-r--r--src/script/script_info.cpp9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/script/script_config.hpp b/src/script/script_config.hpp
index 9ae6fba70..23822de88 100644
--- a/src/script/script_config.hpp
+++ b/src/script/script_config.hpp
@@ -44,6 +44,7 @@ struct ScriptConfigItem {
int step_size; ///< The step size in the gui.
ScriptConfigFlags flags; ///< Flags for the configuration setting.
LabelMapping *labels; ///< Text labels for the integer values.
+ bool complete_labels; ///< True if all values have a label.
};
typedef std::list<ScriptConfigItem> ScriptConfigItemList; ///< List of ScriptConfig items.
diff --git a/src/script/script_info.cpp b/src/script/script_info.cpp
index 779236ebc..b5a83ccb2 100644
--- a/src/script/script_info.cpp
+++ b/src/script/script_info.cpp
@@ -263,6 +263,15 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm)
}
sq_pop(vm, 1);
+ /* Check labels for completeness */
+ config->complete_labels = true;
+ for (int value = config->min_value; value <= config->max_value; value++) {
+ if (!config->labels->Contains(value)) {
+ config->complete_labels = false;
+ break;
+ }
+ }
+
return 0;
}