summaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-05-28 16:59:51 +0000
committerDarkvater <Darkvater@openttd.org>2005-05-28 16:59:51 +0000
commitad30c7a2c1f8c0aa92493d1525182163ebcd4589 (patch)
tree16197bc31e9a939437238374d21b651af9438348 /console.c
parent457434ea596db1bf2e9014bc605144e066b32047 (diff)
downloadopenttd-ad30c7a2c1f8c0aa92493d1525182163ebcd4589.tar.xz
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
- Fix (console): any line starting with a '#' is a comment so ignore it - Fix (console): The special variables whose value can only be set by a custom process should, also print out their newly set value there, instead of relying on the default printout which is slightly confusing. Eg after you change the value it still printed out 'current value for...' instead of 'XXX changed to...'
Diffstat (limited to 'console.c')
-rw-r--r--console.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/console.c b/console.c
index 95730c68e..cccba3beb 100644
--- a/console.c
+++ b/console.c
@@ -691,6 +691,9 @@ void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens
memset(&aliases, 0, sizeof(aliases));
memset(&aliasstream, 0, sizeof(aliasstream));
+ if (_stdlib_con_developer)
+ IConsolePrintF(_icolour_dbg, "condbg: requested command is an alias; parsing...");
+
aliases[0] = aliasstream;
for (cmdptr = alias->cmdline, a_index = 0, astream_i = 0; *cmdptr != '\0'; cmdptr++) {
if (a_index >= lengthof(aliases) || astream_i >= lengthof(aliasstream)) break;
@@ -964,6 +967,9 @@ void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[ICON_T
byte t_index = tokencount;
uint32 value;
+ if (_stdlib_con_developer)
+ IConsolePrintF(_icolour_dbg, "condbg: requested command is a variable");
+
if (tokencount == 0) { /* Just print out value */
IConsoleVarPrintGetValue(var);
return;
@@ -976,7 +982,6 @@ void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[ICON_T
/* Some variables need really special handling, handle it in their callback procedure */
if (var->proc != NULL) {
var->proc(tokencount, &token[t_index - tokencount]); // set the new value
- var->proc(0, NULL); // print out new value
return;
}
/* Strings need special processing. No need to convert the argument to
@@ -1035,6 +1040,8 @@ void IConsoleCmdExec(const char *cmdstr)
bool longtoken = false;
bool foundtoken = false;
+ if (cmdstr[0] == '#') return; // comments
+
for (cmdptr = cmdstr; *cmdptr != '\0'; cmdptr++) {
if (!IsValidAsciiChar(*cmdptr)) {
IConsoleError("command contains malformed characters, aborting");