changeset 15524:8a62b32c0c17 draft

(svn r20183) -Codechange: make _do_autosave and _dedicated_forks not use VARDEF and put them in a more logical location
author rubidium <rubidium@openttd.org>
date Mon, 19 Jul 2010 15:44:49 +0000
parents 23a4ae021a2e
children b4110108e039
files src/openttd.cpp src/saveload/saveload.cpp src/saveload/saveload.h src/statusbar_gui.cpp src/variables.h src/video/dedicated_v.cpp
diffstat 6 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -90,6 +90,7 @@
 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 @@
 
 #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();
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -55,6 +55,7 @@
 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();
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -342,5 +342,6 @@
 bool SaveloadCrashWithMissingNewGRFs();
 
 extern char _savegame_format[8];
+extern bool _do_autosave;
 
 #endif /* SAVELOAD_H */
--- 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"
--- a/src/variables.h
+++ b/src/variables.h
@@ -30,8 +30,6 @@
 
 VARDEF uint32 _realtime_tick;
 
-VARDEF bool _do_autosave;
-
 VARDEF byte _display_opt;
 
 VARDEF bool _rightclick_emulate;
@@ -46,7 +44,4 @@
 /* landscape.cpp */
 extern const byte _tileh_to_sprite[32];
 
-/* Forking stuff */
-VARDEF bool _dedicated_forks;
-
 #endif /* VARIABLES_H */
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -132,6 +132,9 @@
 
 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 @@
 		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;