summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-16 12:14:52 +0000
committerdarkvater <darkvater@openttd.org>2005-01-16 12:14:52 +0000
commit208a9b854789cb9934c2d67123b027be150711b5 (patch)
tree483ce86e20fc1a7037787e755e57f51a80bf1e4b
parentae796740aab0ee480759d2015014b29e2a7aedb4 (diff)
downloadopenttd-208a9b854789cb9934c2d67123b027be150711b5.tar.xz
(svn r1537) -Fix: Close all and any open filehandles open at shutdown (tamlin)
-rw-r--r--fileio.c4
-rw-r--r--ttd.c7
2 files changed, 6 insertions, 5 deletions
diff --git a/fileio.c b/fileio.c
index 6fc6f6742..bd5da1e6c 100644
--- a/fileio.c
+++ b/fileio.c
@@ -83,11 +83,11 @@ void FioReadBlock(void *ptr, uint size)
fread(ptr, 1, size, _fio.cur_fh);
}
-void FioCloseAll()
+void FioCloseAll(void)
{
int i;
- for(i=0; i!=lengthof(_fio.handles); i++) {
+ for (i = 0; i != lengthof(_fio.handles); i++) {
if (_fio.handles[i] != NULL) {
fclose(_fio.handles[i]);
_fio.handles[i] = NULL;
diff --git a/ttd.c b/ttd.c
index 1dbedac10..42d19f411 100644
--- a/ttd.c
+++ b/ttd.c
@@ -728,9 +728,7 @@ int ttd_main(int argc, char* argv[])
LoadIntroGame();
_switch_mode = SM_NONE;
NetworkClientConnectGame(network_conn, rport);
- } else {
-// NetworkCoreConnectGame("auto", _network_server_port);
- }
+ }
}
#endif /* ENABLE_NETWORK */
@@ -760,6 +758,9 @@ int ttd_main(int argc, char* argv[])
/* uninitialize variables that are allocated dynamic */
UnInitializeDynamicVariables();
+ /* Close all and any open filehandles */
+ FioCloseAll();
+
return 0;
}