summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dedicated.cpp4
-rw-r--r--src/fileio.cpp5
-rw-r--r--src/openttd.cpp9
3 files changed, 11 insertions, 7 deletions
diff --git a/src/dedicated.cpp b/src/dedicated.cpp
index ca7e341d7..83c6c1d21 100644
--- a/src/dedicated.cpp
+++ b/src/dedicated.cpp
@@ -11,10 +11,10 @@
#include "stdafx.h"
-char *_log_file; ///< File to reroute output of a forked OpenTTD to
-
#ifdef ENABLE_NETWORK
+char *_log_file; ///< File to reroute output of a forked OpenTTD to
+
#if defined(UNIX) && !defined(__MORPHOS__)
#include <unistd.h>
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 33a4e3976..788fc7cfe 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -57,7 +57,6 @@ static bool _do_scan_working_directory = true;
extern char *_config_file;
extern char *_highscore_file;
-extern char *_log_file;
/* Get current position in file */
size_t FioGetPos()
@@ -1035,7 +1034,6 @@ void DeterminePaths(const char *exe)
DEBUG(misc, 3, "%s found as personal directory", _personal_dir);
_highscore_file = str_fmt("%shs.dat", _personal_dir);
- _log_file = str_fmt("%sopenttd.log", _personal_dir);
extern char *_hotkeys_file;
_hotkeys_file = str_fmt("%shotkeys.cfg", _personal_dir);
@@ -1066,6 +1064,9 @@ void DeterminePaths(const char *exe)
FioCreateDirectory(tmp);
free(tmp);
}
+
+ extern char *_log_file;
+ _log_file = str_fmt("%sopenttd.log", _personal_dir);
#else /* ENABLE_NETWORK */
/* If we don't have networking, we don't need to make the directory. But
* if it exists we keep it, otherwise remove it from the search paths. */
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 67553349a..b15f38aa2 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -85,7 +85,6 @@ void CallWindowTickEvent();
extern void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
extern Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY);
extern void ShowOSErrorBox(const char *buf, bool system);
-extern bool _dedicated_forks;
extern char *_config_file;
/**
@@ -347,7 +346,9 @@ static void ShutdownGame()
_engine_pool.CleanPool();
_company_pool.CleanPool();
+#ifdef ENABLE_NETWORK
free(_config_file);
+#endif
/* Close all and any open filehandles */
FioCloseAll();
@@ -431,12 +432,14 @@ int ttd_main(int argc, char *argv[])
uint16 dedicated_port = 0;
char *join_server_password = NULL;
char *join_company_password = NULL;
+
+ extern bool _dedicated_forks;
+ _dedicated_forks = false;
#endif /* ENABLE_NETWORK */
_game_mode = GM_MENU;
_switch_mode = SM_MENU;
_switch_mode_errorstr = INVALID_STRING_ID;
- _dedicated_forks = false;
_config_file = NULL;
/* The last param of the following function means this:
@@ -562,7 +565,7 @@ int ttd_main(int argc, char *argv[])
BaseSounds::FindSets();
BaseMusic::FindSets();
-#if defined(UNIX) && !defined(__MORPHOS__)
+#if defined(ENABLE_NETWORK) && defined(UNIX) && !defined(__MORPHOS__)
/* We must fork here, or we'll end up without some resources we need (like sockets) */
if (_dedicated_forks) DedicatedFork();
#endif