summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-07-19 15:44:49 +0000
committerrubidium <rubidium@openttd.org>2010-07-19 15:44:49 +0000
commit45213e5708b3a8ece9fae32951d908db3bf5c732 (patch)
tree5d1f6dd0a73f04e02afec165b3569e2551cec27a
parent523d9358826cbeed6b13a85159498ef0760ba938 (diff)
downloadopenttd-45213e5708b3a8ece9fae32951d908db3bf5c732.tar.xz
(svn r20183) -Codechange: make _do_autosave and _dedicated_forks not use VARDEF and put them in a more logical location
-rw-r--r--src/openttd.cpp4
-rw-r--r--src/saveload/saveload.cpp1
-rw-r--r--src/saveload/saveload.h1
-rw-r--r--src/statusbar_gui.cpp2
-rw-r--r--src/variables.h5
-rw-r--r--src/video/dedicated_v.cpp6
6 files changed, 9 insertions, 10 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 78cd3d6e2..808f8a3e7 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -90,6 +90,7 @@ 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;
/**
* Error handling for fatal user errors.
@@ -567,8 +568,7 @@ int ttd_main(int argc, char *argv[])
#if defined(UNIX) && !defined(__MORPHOS__)
/* We must fork here, or we'll end up without some resources we need (like sockets) */
- if (_dedicated_forks)
- DedicatedFork();
+ if (_dedicated_forks) DedicatedFork();
#endif
AI::Initialize();
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index a9d1e9f1e..ac84dd9a2 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -55,6 +55,7 @@ uint32 _ttdp_version; ///< version of TTDP savegame (if applicable)
uint16 _sl_version; ///< the major savegame version identifier
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
char _savegame_format[8]; ///< how to compress savegames
+bool _do_autosave; ///< are we doing an autosave at the moment?
typedef void WriterProc(size_t len);
typedef size_t ReaderProc();
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index d3cb32dfc..32a9429e3 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -342,5 +342,6 @@ bool SlObjectMember(void *object, const SaveLoad *sld);
bool SaveloadCrashWithMissingNewGRFs();
extern char _savegame_format[8];
+extern bool _do_autosave;
#endif /* SAVELOAD_H */
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
index 430a397c6..debfdb7e9 100644
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -22,7 +22,7 @@
#include "news_gui.h"
#include "company_gui.h"
#include "window_gui.h"
-#include "variables.h"
+#include "saveload/saveload.h"
#include "window_func.h"
#include "statusbar_gui.h"
#include "core/geometry_func.hpp"
diff --git a/src/variables.h b/src/variables.h
index 77670620c..438d3b903 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -30,8 +30,6 @@ VARDEF int _palette_animation_counter;
VARDEF uint32 _realtime_tick;
-VARDEF bool _do_autosave;
-
VARDEF byte _display_opt;
VARDEF bool _rightclick_emulate;
@@ -46,7 +44,4 @@ VARDEF char *_log_file;
/* landscape.cpp */
extern const byte _tileh_to_sprite[32];
-/* Forking stuff */
-VARDEF bool _dedicated_forks;
-
#endif /* VARIABLES_H */
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 2ce43f4c1..48e65c747 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -132,6 +132,9 @@ static void CloseWindowsConsoleThread()
static void *_dedicated_video_mem;
+/* Whether a fork has been done. */
+bool _dedicated_forks;
+
extern bool SafeSaveOrLoad(const char *filename, int mode, GameMode newgm, Subdirectory subdir);
extern void SwitchToMode(SwitchMode new_mode);
@@ -295,8 +298,7 @@ void VideoDriver_Dedicated::MainLoop()
uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
InteractiveRandom(); // randomness
- if (!_dedicated_forks)
- DedicatedHandleKeyInput();
+ if (!_dedicated_forks) DedicatedHandleKeyInput();
cur_ticks = GetTime();
_realtime_tick += cur_ticks - prev_cur_ticks;