mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-10-31 15:20:10 +00:00
(svn r14041) -Feature(tte): make it possible to filter list_patches output like it's done for other list_* console commands
This commit is contained in:
parent
ebe9ae2b17
commit
16aac30c66
@ -1267,13 +1267,13 @@ DEF_CONSOLE_CMD(ConPatch)
|
|||||||
DEF_CONSOLE_CMD(ConListPatches)
|
DEF_CONSOLE_CMD(ConListPatches)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
IConsoleHelp("List patch options. Usage: 'list_patches'");
|
IConsoleHelp("List patch options. Usage: 'list_patches [<pre-filter>]'");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc != 1) return false;
|
if (argc > 2) return false;
|
||||||
|
|
||||||
IConsoleListPatches();
|
IConsoleListPatches((argc == 2) ? argv[1] : NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2385,11 +2385,14 @@ void IConsoleGetPatchSetting(const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IConsoleListPatches()
|
void IConsoleListPatches(const char *prefilter)
|
||||||
{
|
{
|
||||||
IConsolePrintF(CC_WARNING, "All patches with their current value:");
|
IConsolePrintF(CC_WARNING, "All patches with their current value:");
|
||||||
|
|
||||||
for (const SettingDesc *sd = _patch_settings; sd->save.cmd != SL_END; sd++) {
|
for (const SettingDesc *sd = _patch_settings; sd->save.cmd != SL_END; sd++) {
|
||||||
|
if (prefilter != NULL) {
|
||||||
|
if (strncmp(sd->desc.name, prefilter, min(strlen(sd->desc.name), strlen(prefilter))) != 0) continue;
|
||||||
|
}
|
||||||
char value[80];
|
char value[80];
|
||||||
const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
|
const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
void IConsoleSetPatchSetting(const char *name, const char *value);
|
void IConsoleSetPatchSetting(const char *name, const char *value);
|
||||||
void IConsoleSetPatchSetting(const char *name, int32 value);
|
void IConsoleSetPatchSetting(const char *name, int32 value);
|
||||||
void IConsoleGetPatchSetting(const char *name);
|
void IConsoleGetPatchSetting(const char *name);
|
||||||
void IConsoleListPatches();
|
void IConsoleListPatches(const char *prefilter);
|
||||||
|
|
||||||
void LoadFromConfig();
|
void LoadFromConfig();
|
||||||
void SaveToConfig();
|
void SaveToConfig();
|
||||||
|
Loading…
Reference in New Issue
Block a user