summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
authorsignde <signde@openttd.org>2004-09-13 06:56:30 +0000
committersignde <signde@openttd.org>2004-09-13 06:56:30 +0000
commit263042cdf2a1eb2a5176b2259464d36de5460fe6 (patch)
tree2f3851739c41ccdbf22485444d4f4b00422dc28c /console_cmds.c
parent01dd0219d312060d64d714c566a5307f6b187057 (diff)
downloadopenttd-263042cdf2a1eb2a5176b2259464d36de5460fe6.tar.xz
(svn r230) -Feature: IConsoleWarning for warning messages
-Feature: added info_cmd command -Codechange: renamed "varinfo" to "info_var" -Fix: some const fixes in console.h -Fix: fixed return value of IConsoleCmdGet
Diffstat (limited to 'console_cmds.c')
-rw-r--r--console_cmds.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/console_cmds.c b/console_cmds.c
index 8afcbe8d5..31cf3685a 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -173,20 +173,45 @@ DEF_CONSOLE_CMD(ConScreenShot)
return NULL;
}
-DEF_CONSOLE_CMD(ConVarInfo)
+DEF_CONSOLE_CMD(ConInfoVar)
{
if (argc<2) return NULL;
if (argt[1]!=ICONSOLE_VAR_REFERENCE) {
- IConsoleError("variable must be an variable reference");
+ IConsoleError("first argument must be an variable reference");
} else {
_iconsole_var * item;
item = (_iconsole_var *) argv[1];
- IConsolePrintF(_iconsole_color_default,"variable_name: %s",item->name);
- IConsolePrintF(_iconsole_color_default,"variable_type: %i",item->type);
- IConsolePrintF(_iconsole_color_default,"variable_addr: %i",item->addr);
- if (item->_malloc) IConsolePrintF(_iconsole_color_default,"variable_malloc: internal allocated"); else IConsolePrintF(_iconsole_color_default, "variable_malloc: external allocated");
+ IConsolePrintF(_iconsole_color_default,"var_name: %s",item->name);
+ IConsolePrintF(_iconsole_color_default,"var_type: %i",item->type);
+ IConsolePrintF(_iconsole_color_default,"var_addr: %i",item->addr);
+ if (item->_malloc) IConsolePrintF(_iconsole_color_default,"var_malloc: internal"); else IConsolePrintF(_iconsole_color_default, "var_malloc: external");
+ if (item->hook_access) IConsoleWarning("var_access hooked");
+ if (item->hook_before_change) IConsoleWarning("var_before_change hooked");
+ if (item->hook_after_change) IConsoleWarning("var_after_change hooked");
}
return NULL;
+}
+
+
+DEF_CONSOLE_CMD(ConInfoCmd)
+{
+ if (argc<2) return NULL;
+ if (argt[1]!=ICONSOLE_VAR_UNKNOWN) {
+ IConsoleError("first argument must be an commandname");
+ } else {
+ _iconsole_cmd * item;
+ item = IConsoleCmdGet(argv[1]);
+ if (item==NULL) {
+ IConsoleError("the given command was not found");
+ return NULL;
+ }
+ IConsolePrintF(_iconsole_color_default,"cmd_name: %s",item->name);
+ IConsolePrintF(_iconsole_color_default,"cmd_addr: %i",item->addr);
+ if (item->hook_access) IConsoleWarning("cmd_access hooked");
+ if (item->hook_before_exec) IConsoleWarning("cmd_before_exec hooked");
+ if (item->hook_after_exec) IConsoleWarning("cmd_after_exec hooked");
+ }
+ return NULL;
}
DEF_CONSOLE_CMD(ConDebugLevel)
@@ -338,28 +363,29 @@ void IConsoleStdLibRegister()
(void)ConResetTile; // Silence warning, this is only used in _DEBUG
#endif
- // functions [please add them alphabeticaly]
+ // functions [please add them alphabeticaly]
#ifdef ENABLE_NETWORK
IConsoleCmdRegister("connect",ConNetworkConnect);
IConsoleCmdHook("connect",ICONSOLE_HOOK_ACCESS,ConCmdHookNoNetwork);
-#endif
+#endif
IConsoleCmdRegister("debug_level",ConDebugLevel);
IConsoleCmdRegister("dump_vars",ConListDumpVariables);
IConsoleCmdRegister("echo",ConEcho);
IConsoleCmdRegister("echoc",ConEchoC);
IConsoleCmdRegister("exit",ConExit);
- IConsoleCmdRegister("help",ConHelp);
+ IConsoleCmdRegister("help",ConHelp);
+ IConsoleCmdRegister("info_cmd",ConInfoCmd);
+ IConsoleCmdRegister("info_var",ConInfoVar);
+ IConsoleCmdRegister("list_cmds",ConListCommands);
+ IConsoleCmdRegister("list_vars",ConListVariables);
IConsoleCmdRegister("printf",ConPrintF);
IConsoleCmdRegister("printfc",ConPrintFC);
IConsoleCmdRegister("quit",ConExit);
IConsoleCmdRegister("random",ConRandom);
- IConsoleCmdRegister("list_cmds",ConListCommands);
- IConsoleCmdRegister("list_vars",ConListVariables);
IConsoleCmdRegister("resetengines",ConResetEngines);
IConsoleCmdHook("resetengines",ICONSOLE_HOOK_ACCESS,ConCmdHookNoNetwork);
IConsoleCmdRegister("screenshot",ConScreenShot);
IConsoleCmdRegister("scrollto",ConScrollToTile);
- IConsoleCmdRegister("varinfo",ConVarInfo);
// variables [please add them alphabeticaly]
IConsoleVarRegister("con_developer",(void *) &_stdlib_con_developer,ICONSOLE_VAR_BOOLEAN);