mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-19 15:25:39 +00:00
(svn r1883) -Fix: [1109400] Better test if a string actually contains any console command
This commit is contained in:
parent
f7991303e8
commit
73c0f21363
10
console.c
10
console.c
@ -1094,9 +1094,17 @@ void IConsoleCmdExec(const char* cmdstr)
|
|||||||
uint i;
|
uint i;
|
||||||
uint l;
|
uint l;
|
||||||
|
|
||||||
if (strlen(cmdstr) == 0) // only execute if there is something typed obviously
|
for (; strchr("\n\r \t", *cmdstr) != NULL; ++cmdstr) {
|
||||||
|
switch (*cmdstr) {
|
||||||
|
case '\0':
|
||||||
|
case '#':
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_stdlib_con_developer)
|
if (_stdlib_con_developer)
|
||||||
IConsolePrintF(_iconsole_color_debug, "CONDEBUG: execution_cmdline: %s", cmdstr);
|
IConsolePrintF(_iconsole_color_debug, "CONDEBUG: execution_cmdline: %s", cmdstr);
|
||||||
|
|
||||||
|
@ -611,8 +611,6 @@ DEF_CONSOLE_CMD(ConExec)
|
|||||||
|
|
||||||
fgets(cmd, sizeof(cmd), _script_file);
|
fgets(cmd, sizeof(cmd), _script_file);
|
||||||
while (!feof(_script_file) && _script_running) {
|
while (!feof(_script_file) && _script_running) {
|
||||||
strtok(cmd, "\r\n#");
|
|
||||||
if (strlen(cmd) > 0 && cmd[0] != '#')
|
|
||||||
IConsoleCmdExec(cmd);
|
IConsoleCmdExec(cmd);
|
||||||
fgets(cmd, sizeof(cmd), _script_file);
|
fgets(cmd, sizeof(cmd), _script_file);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user