1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-27 16:39:09 +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:
tron
2005-02-18 08:36:11 +00:00
parent 9f4e45d333
commit 4a4b9d145d

View File

@@ -609,10 +609,12 @@ DEF_CONSOLE_CMD(ConExec)
_script_running = true;
fgets(cmd, sizeof(cmd), _script_file);
while (!feof(_script_file) && _script_running) {
while (_script_running && fgets(cmd, sizeof(cmd), _script_file) != NULL) {
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;