summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-26 05:58:15 +0000
committerrubidium <rubidium@openttd.org>2008-05-26 05:58:15 +0000
commit3a4b3979616a727706479db2e5ef30155ebd7ddc (patch)
tree794f06c85159657a48d09ba5f6a5676820c21fb1 /src
parent5f782d06be6ea754575d0cc854f8a55c619f62e2 (diff)
downloadopenttd-3a4b3979616a727706479db2e5ef30155ebd7ddc.tar.xz
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
Diffstat (limited to 'src')
-rw-r--r--src/settings.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index b82717529..fc151e4e5 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -2104,11 +2104,22 @@ const SettingDesc *GetPatchFromName(const char *name, uint *i)
{
const SettingDesc *sd;
+ /* First check all full names */
for (*i = 0, sd = _patch_settings; sd->save.cmd != SL_END; sd++, (*i)++) {
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
if (strcmp(sd->desc.name, name) == 0) return sd;
}
+ /* Then check the shortcut variant of the name. */
+ for (*i = 0, sd = _patch_settings; sd->save.cmd != SL_END; sd++, (*i)++) {
+ if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
+ const char *short_name = strchr(sd->desc.name, '.');
+ if (short_name != NULL) {
+ short_name++;
+ if (strcmp(short_name, name) == 0) return sd;
+ }
+ }
+
return NULL;
}