(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
authorrubidium
Mon, 26 May 2008 05:58:15 +0000
changeset 9361 7a213ee7ee5b
parent 9360 51762cddd6f2
child 9362 ee98b0755c52
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
src/settings.cpp
--- a/src/settings.cpp	Mon May 26 02:25:17 2008 +0000
+++ b/src/settings.cpp	Mon May 26 05:58:15 2008 +0000
@@ -2104,11 +2104,22 @@
 {
 	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;
 }