summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-06-26 15:04:57 +0000
committeralberth <alberth@openttd.org>2010-06-26 15:04:57 +0000
commit5fb3e557d44dbde470dfb1a9643596a8f828c9fe (patch)
treeeb9bd1b6f264fd880428f5313d5d5be56c3bef42 /src
parent87129fb9f5c2296cbaac0bc83e8619e0f7c4538c (diff)
downloadopenttd-5fb3e557d44dbde470dfb1a9643596a8f828c9fe.tar.xz
(svn r20020) -Codechange: _script_file is used in only one function.
Diffstat (limited to 'src')
-rw-r--r--src/console_cmds.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index e0fc3b9f9..71f6f10b4 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -42,7 +42,6 @@
#endif /* ENABLE_NETWORK */
/* scriptfile handling */
-static FILE *_script_file;
static bool _script_running;
/* console command defines */
@@ -871,16 +870,16 @@ DEF_CONSOLE_CMD(ConExec)
if (argc < 2) return false;
- _script_file = FioFOpenFile(argv[1], "r", BASE_DIR);
+ FILE *script_file = FioFOpenFile(argv[1], "r", BASE_DIR);
- if (_script_file == NULL) {
+ if (script_file == NULL) {
if (argc == 2 || atoi(argv[2]) != 0) IConsoleError("script file not found");
return true;
}
_script_running = true;
- while (_script_running && fgets(cmdline, sizeof(cmdline), _script_file) != NULL) {
+ while (_script_running && fgets(cmdline, sizeof(cmdline), script_file) != NULL) {
/* Remove newline characters from the executing script */
for (cmdptr = cmdline; *cmdptr != '\0'; cmdptr++) {
if (*cmdptr == '\n' || *cmdptr == '\r') {
@@ -891,11 +890,11 @@ DEF_CONSOLE_CMD(ConExec)
IConsoleCmdExec(cmdline);
}
- if (ferror(_script_file))
+ if (ferror(script_file))
IConsoleError("Encountered errror while trying to read from script file");
_script_running = false;
- FioFCloseFile(_script_file);
+ FioFCloseFile(script_file);
return true;
}