Index: settings.c =================================================================== --- settings.c (revision 6161) +++ settings.c (working copy) @@ -1652,6 +1652,30 @@ name, value, (sd->desc.flags & SGF_0ISDISABLED) ? "(0) " : "", sd->desc.min, sd->desc.max); } +/** List all patches from the console +* It takes no argument, but lists all available patches with their setting as well as hint how to change them. +*/ + +void IConsoleListPatches(void) +{ + const SettingDesc *sd; + const void *ptr; + uint index; + char value[20]; + + IConsolePrintF(_icolour_warn, "All patches in 'patch:setting' syntax:"); + for ( index = 1, sd = _patch_settings; sd->save.cmd != SL_END; sd++, index++ ) { + ptr = ini_get_variable(&sd->save, (_game_mode == GM_MENU) ? &_patches_newgame : &_patches); + if (sd->desc.cmd == SDT_BOOLX) { + snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off"); + } else { + snprintf(value, sizeof(value), "%d", (int32)ReadValue(ptr, sd->save.conv)); + } + IConsolePrintF(_icolour_def, "%s:%s", sd->desc.name, value); + } + IConsolePrintF(_icolour_warn, "You can use command 'patch' to change the value of any of these patches."); +} + /** Save and load handler for patches/settings * @param osd SettingDesc struct containing all information * @param object can be either NULL in which case we load global variables or Index: settings.h =================================================================== --- settings.h (revision 6161) +++ settings.h (working copy) @@ -79,6 +79,7 @@ void IConsoleSetPatchSetting(const char *name, int32 value); void IConsoleGetPatchSetting(const char *name); +void IConsoleListPatches(void); const SettingDesc *GetPatchFromName(const char *name, uint *i); void SetPatchValue(uint index, const Patches *object, int32 value); Index: console_cmds.c =================================================================== --- console_cmds.c (revision 6161) +++ console_cmds.c (working copy) @@ -1374,6 +1374,19 @@ return true; } + +DEF_CONSOLE_CMD(ConListPatch) +{ + if (argc == 0) { + IConsoleHelp("List patch options. Usage: 'list_patches'"); + return true; + } else if (argc == 1) { + IConsoleListPatches(); + return true; + } else { + return false; + } +} #endif /* ENABLE_NETWORK */ DEF_CONSOLE_CMD(ConListDumpVariables) @@ -1511,6 +1524,7 @@ IConsoleCmdHookAdd("unpause", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); IConsoleCmdRegister("patch", ConPatch); + IConsoleCmdRegister("list_patches", ConListPatch); /*** Networking variables ***/ IConsoleVarRegister("net_frame_freq", &_network_frame_freq, ICONSOLE_VAR_BYTE, "The amount of frames before a command will be (visibly) executed. Default value: 1"); Index: console.c =================================================================== --- console.c (revision 6161) +++ console.c (working copy) @@ -17,7 +17,7 @@ #include "network_data.h" #include "network_server.h" -#define ICON_BUFFER 79 +#define ICON_BUFFER 150 #define ICON_HISTORY_SIZE 20 #define ICON_LINE_HEIGHT 12 #define ICON_RIGHT_BORDERWIDTH 10