mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-22 23:26:34 +00:00
(svn r1886) Correctly process the last line of a script, even if it's not newline terminated. Also print an error message if something goes wrong while reading from the script file
This commit is contained in:
parent
9f4e45d333
commit
4a4b9d145d
@ -609,10 +609,12 @@ DEF_CONSOLE_CMD(ConExec)
|
|||||||
|
|
||||||
_script_running = true;
|
_script_running = true;
|
||||||
|
|
||||||
fgets(cmd, sizeof(cmd), _script_file);
|
while (_script_running && fgets(cmd, sizeof(cmd), _script_file) != NULL) {
|
||||||
while (!feof(_script_file) && _script_running) {
|
|
||||||
IConsoleCmdExec(cmd);
|
IConsoleCmdExec(cmd);
|
||||||
fgets(cmd, sizeof(cmd), _script_file);
|
}
|
||||||
|
|
||||||
|
if (ferror(_script_file)) {
|
||||||
|
IConsoleError("Encountered errror while trying to read from script file");
|
||||||
}
|
}
|
||||||
|
|
||||||
_script_running = false;
|
_script_running = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user