diff options
author | frosch <frosch@openttd.org> | 2010-03-24 20:43:31 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-03-24 20:43:31 +0000 |
commit | 9a00f6961fa0cf9d4a60c4253b68d740f95c303b (patch) | |
tree | 7a1b778ab6a8d30d13492c87a03939e341cdb9dd /src/console.cpp | |
parent | 7b4dd765d3052e3c98e6145649798c3096e8c497 (diff) | |
download | openttd-9a00f6961fa0cf9d4a60c4253b68d740f95c303b.tar.xz |
(svn r19514) -Codechange: Allow console hooks to deny existance of commands.
Diffstat (limited to 'src/console.cpp')
-rw-r--r-- | src/console.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/console.cpp b/src/console.cpp index e5d5ae962..8108e77a4 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -461,12 +461,17 @@ void IConsoleCmdExec(const char *cmdstr) */ cmd = IConsoleCmdGet(tokens[0]); if (cmd != NULL) { - if (cmd->hook == NULL || cmd->hook()) { - if (!cmd->proc(t_index, tokens)) { // index started with 0 - cmd->proc(0, NULL); // if command failed, give help - } + ConsoleHookResult chr = (cmd->hook == NULL ? CHR_ALLOW : cmd->hook(true)); + switch (chr) { + case CHR_ALLOW: + if (!cmd->proc(t_index, tokens)) { // index started with 0 + cmd->proc(0, NULL); // if command failed, give help + } + return; + + case CHR_DISALLOW: return; + case CHR_HIDE: break; } - return; } t_index--; |