diff options
author | truelight <truelight@openttd.org> | 2004-12-13 18:51:08 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2004-12-13 18:51:08 +0000 |
commit | 551d0622c504a728adf4e6491e4e13388e3375ff (patch) | |
tree | 2e19b108cb081e93e7bf2f40d9b5e992bf4c5b71 /console_cmds.c | |
parent | 92b8ec9ff8409d62917795e31bf69c44d41b39f2 (diff) | |
download | openttd-551d0622c504a728adf4e6491e4e13388e3375ff.tar.xz |
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
Diffstat (limited to 'console_cmds.c')
-rw-r--r-- | console_cmds.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/console_cmds.c b/console_cmds.c index f9b8d7271..a62196242 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -364,6 +364,13 @@ DEF_CONSOLE_CMD(ConPrintFC) return NULL; } +DEF_CONSOLE_CMD(ConAlias) +{ + if (argc < 3) return NULL; + IConsoleAliasRegister(argv[1],argv[2]); + return NULL; +} + DEF_CONSOLE_CMD(ConScreenShot) { if (argc < 2) { @@ -489,6 +496,20 @@ DEF_CONSOLE_CMD(ConListVariables) return NULL; } +DEF_CONSOLE_CMD(ConListAliases) +{ + const _iconsole_alias* item; + size_t l = 0; + + if (argv[1] != NULL) l = strlen(argv[1]); + + for (item = _iconsole_aliases; item != NULL; item = item->_next) + if (argv[1] == NULL || strncmp(item->name, argv[1], l) == 0) + IConsolePrintF(_iconsole_color_default, "%s => %s", item->name, item->cmdline); + + return NULL; +} + DEF_CONSOLE_CMD(ConListDumpVariables) { const _iconsole_var* item; @@ -740,6 +761,8 @@ void IConsoleDebugLibRegister() IConsoleVarMemRegister("temp_uint16_2", ICONSOLE_VAR_UINT16); IConsoleVarMemRegister("temp_uint32", ICONSOLE_VAR_UINT32); IConsoleCmdRegister("resettile", ConResetTile); + IConsoleAliasRegister("dbg_echo","echo %A; echo %B"); + IConsoleAliasRegister("dbg_echo2","echo %+"); } #endif @@ -764,10 +787,8 @@ void IConsoleStdLibRegister(void) IConsoleCmdRegister("info_var", ConInfoVar); IConsoleCmdRegister("list_cmds", ConListCommands); IConsoleCmdRegister("list_vars", ConListVariables); + IConsoleCmdRegister("list_aliases", ConListAliases); IConsoleCmdRegister("newgame", ConNewGame); - IConsoleCmdRegister("new_game", ConNewGame); - IConsoleCmdRegister("newmap", ConNewGame); - IConsoleCmdRegister("new_map", ConNewGame); IConsoleCmdRegister("printf", ConPrintF); IConsoleCmdRegister("printfc", ConPrintFC); IConsoleCmdRegister("quit", ConExit); @@ -778,6 +799,10 @@ void IConsoleStdLibRegister(void) IConsoleCmdRegister("script", ConScript); IConsoleCmdRegister("scrollto", ConScrollToTile); IConsoleCmdRegister("set", ConSet); + IConsoleCmdRegister("alias", ConAlias); + IConsoleAliasRegister("new_game", "newgame"); + IConsoleAliasRegister("newmap", "newgame"); + IConsoleAliasRegister("new_map", "newgame"); IConsoleVarRegister("developer", &_stdlib_developer, ICONSOLE_VAR_BYTE); |