(svn r12944) -Codechange: use rev.h instead of externs at many places
authorsmatz
Sun, 04 May 2008 21:53:36 +0000
changeset 9085 8b3897a75aed
parent 9084 55b2d2cb8b90
child 9086 4887c2e470e4
(svn r12944) -Codechange: use rev.h instead of externs at many places
projects/openttd_vs80.vcproj
projects/openttd_vs90.vcproj
source.list
src/console.cpp
src/network/network.cpp
src/network/network.h
src/network/network_client.cpp
src/newgrf.cpp
src/openttd.cpp
src/os/macosx/macos.mm
src/rev.cpp.in
src/rev.h
src/settings.cpp
src/strings.cpp
src/video/cocoa/wnd_quartz.mm
src/video/cocoa/wnd_quickdraw.mm
src/video/sdl_v.cpp
src/video/win32_v.cpp
src/win32.cpp
--- a/projects/openttd_vs80.vcproj	Sun May 04 21:47:36 2008 +0000
+++ b/projects/openttd_vs80.vcproj	Sun May 04 21:53:36 2008 +0000
@@ -1320,6 +1320,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\rev.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\road_cmd.h"
 				>
 			</File>
--- a/projects/openttd_vs90.vcproj	Sun May 04 21:47:36 2008 +0000
+++ b/projects/openttd_vs90.vcproj	Sun May 04 21:53:36 2008 +0000
@@ -1317,6 +1317,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\rev.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\road_cmd.h"
 				>
 			</File>
--- a/source.list	Sun May 04 21:47:36 2008 +0000
+++ b/source.list	Sun May 04 21:53:36 2008 +0000
@@ -251,6 +251,7 @@
 rail_gui.h
 rail_type.h
 core/random_func.hpp
+rev.h
 road_cmd.h
 road_func.h
 road_gui.h
--- a/src/console.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/console.cpp	Sun May 04 21:53:36 2008 +0000
@@ -18,6 +18,7 @@
 #include "window_func.h"
 #include "string_func.h"
 #include "gfx_func.h"
+#include "rev.h"
 
 #include "table/strings.h"
 
@@ -223,7 +224,6 @@
 
 void IConsoleInit()
 {
-	extern const char _openttd_revision[];
 	_iconsole_output_file = NULL;
 	_icolour_def  =  1;
 	_icolour_err  =  3;
--- a/src/network/network.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/network/network.cpp	Sun May 04 21:53:36 2008 +0000
@@ -31,6 +31,7 @@
 #include "../string_func.h"
 #include "../player_func.h"
 #include "../settings_type.h"
+#include "../rev.h"
 #ifdef DEBUG_DUMP_COMMANDS
 	#include "../core/alloc_func.hpp"
 #endif /* DEBUG_DUMP_COMMANDS */
@@ -1470,7 +1471,6 @@
  */
 bool IsNetworkCompatibleVersion(const char *other)
 {
-	extern const char _openttd_revision[];
 	return strncmp(_openttd_revision, other, NETWORK_REVISION_LENGTH - 1) == 0;
 }
 
--- a/src/network/network.h	Sun May 04 21:47:36 2008 +0000
+++ b/src/network/network.h	Sun May 04 21:53:36 2008 +0000
@@ -31,9 +31,6 @@
 
 #endif /* ENABLE_NETWORK */
 
-/** What is the revision of OpenTTD. */
-extern const char _openttd_revision[];
-
 /** As which player do we play? */
 extern PlayerID _network_playas;
 
--- a/src/network/network_client.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/network/network_client.cpp	Sun May 04 21:53:36 2008 +0000
@@ -24,6 +24,7 @@
 #include "../player_func.h"
 #include "../player_base.h"
 #include "../player_gui.h"
+#include "../rev.h"
 
 #include "table/strings.h"
 
@@ -122,7 +123,6 @@
 	//    String: Unique id to find the player back in server-listing
 	//
 
-	extern const char _openttd_revision[];
 	Packet *p;
 	_network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING;
 	InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
--- a/src/newgrf.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/newgrf.cpp	Sun May 04 21:53:36 2008 +0000
@@ -34,6 +34,7 @@
 #include "newgrf_townname.h"
 #include "newgrf_industries.h"
 #include "gfxinit.h"
+#include "rev.h"
 #include "fios.h"
 #include "rail.h"
 #include "strings_func.h"
@@ -3643,11 +3644,9 @@
 			*value = _opt.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
 			return true;
 
-		case 0x21: { // OpenTTD version
-			extern uint32 _openttd_newgrf_version;
+		case 0x21: // OpenTTD version
 			*value = _openttd_newgrf_version;
 			return true;
-		}
 
 		case 0x22: // difficulty level
 			*value = _opt.diff_level;
--- a/src/openttd.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/openttd.cpp	Sun May 04 21:53:36 2008 +0000
@@ -60,6 +60,7 @@
 #include "cheat_func.h"
 #include "animated_tile_func.h"
 #include "functions.h"
+#include "rev.h"
 
 #include "newgrf.h"
 #include "newgrf_config.h"
@@ -136,9 +137,6 @@
 	ShowInfo(buf);
 }
 
-/** The current revision of OpenTTD */
-extern const char _openttd_revision[];
-
 /**
  * Show the help message when someone passed a wrong parameter.
  */
--- a/src/os/macosx/macos.mm	Sun May 04 21:47:36 2008 +0000
+++ b/src/os/macosx/macos.mm	Sun May 04 21:53:36 2008 +0000
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include "../../stdafx.h"
 #include "../../core/bitmath_func.hpp"
+#include "../../rev.h"
 
 #ifndef CPU_SUBTYPE_POWERPC_970
 #define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
@@ -33,7 +34,6 @@
 	char OS[20];
 	char newgrf[125];
 	long sysVersion;
-	extern const char _openttd_revision[];
 
 	// get the hardware info
 	host_basic_info_data_t hostInfo;
--- a/src/rev.cpp.in	Sun May 04 21:47:36 2008 +0000
+++ b/src/rev.cpp.in	Sun May 04 21:53:36 2008 +0000
@@ -3,6 +3,7 @@
 /** @file rev.cpp Autogenerated file with the revision and such of OpenTTD. */
 
 #include "stdafx.h"
+#include "rev.h"
 
 /**
  * The text version of OpenTTD's revision.
@@ -19,7 +20,7 @@
  * norev000 is for non-releases that are made on systems without
  * subversion or sources that are not a checkout of subversion.
  */
-extern const char _openttd_revision[] = "@@VERSION@@";
+const char _openttd_revision[] = "@@VERSION@@";
 
 /**
  * The NewGRF revision of OTTD:
@@ -34,7 +35,7 @@
  * final release will always have a lower version number than the released
  * version, thus making comparisions on specific revisions easy.
  */
-uint32 _openttd_newgrf_version = 0 << 28 | 7 << 24 | 0 << 20 | 0 << 19 | (@@REVISION@@ & ((1 << 19) - 1));
+const uint32 _openttd_newgrf_version = 0 << 28 | 7 << 24 | 0 << 20 | 0 << 19 | (@@REVISION@@ & ((1 << 19) - 1));
 
 #ifdef __MORPHOS__
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/rev.h	Sun May 04 21:53:36 2008 +0000
@@ -0,0 +1,11 @@
+/* $Id$ */
+
+/** @file rev.h declaration of OTTD revision dependant variables */
+
+#ifndef REV_H
+#define REV_H
+
+extern const char _openttd_revision[];
+extern const uint32 _openttd_newgrf_version;
+
+#endif /* REV_H */
--- a/src/settings.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/settings.cpp	Sun May 04 21:53:36 2008 +0000
@@ -44,6 +44,7 @@
 #include "sound_func.h"
 #include "core/alloc_func.hpp"
 #include "player_func.h"
+#include "rev.h"
 #ifdef WITH_FREETYPE
 #include "fontcache.h"
 #endif
@@ -1769,9 +1770,6 @@
  */
 static void SaveVersionInConfig(IniFile *ini)
 {
-	extern const char _openttd_revision[];
-	extern uint32 _openttd_newgrf_version;
-
 	IniGroup *group = ini_getgroup(ini, "version", -1);
 
 	if (group == NULL) return;
--- a/src/strings.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/strings.cpp	Sun May 04 21:53:36 2008 +0000
@@ -27,6 +27,7 @@
 #include "gui.h"
 #include "strings_func.h"
 #include "functions.h"
+#include "rev.h"
 #include "core/endian_func.hpp"
 #include "date_func.h"
 #include "vehicle_base.h"
@@ -560,7 +561,6 @@
 
 static char* FormatString(char* buff, const char* str, const int64* argv, uint casei, const char* last)
 {
-	extern const char _openttd_revision[];
 	WChar b;
 	const int64 *argv_orig = argv;
 	uint modifier = 0;
--- a/src/video/cocoa/wnd_quartz.mm	Sun May 04 21:47:36 2008 +0000
+++ b/src/video/cocoa/wnd_quartz.mm	Sun May 04 21:53:36 2008 +0000
@@ -39,6 +39,7 @@
 
 #include "../../stdafx.h"
 #include "../../debug.h"
+#include "../../rev.h"
 #include "../../core/geometry_type.hpp"
 #include "cocoa_v.h"
 #include "../../core/math_func.hpp"
@@ -410,9 +411,6 @@
 @end
 
 
-extern const char _openttd_revision[];
-
-
 void WindowQuartzSubdriver::GetDeviceInfo()
 {
 	CFDictionaryRef    cur_mode;
--- a/src/video/cocoa/wnd_quickdraw.mm	Sun May 04 21:47:36 2008 +0000
+++ b/src/video/cocoa/wnd_quickdraw.mm	Sun May 04 21:53:36 2008 +0000
@@ -39,6 +39,7 @@
 
 #include "../../stdafx.h"
 #include "../../debug.h"
+#include "../../rev.h"
 #include "../../core/geometry_type.hpp"
 #include "cocoa_v.h"
 #include "../../core/math_func.hpp"
@@ -331,10 +332,6 @@
 };
 
 
-
-extern const char _openttd_revision[];
-
-
 void WindowQuickdrawSubdriver::GetDeviceInfo()
 {
 	CFDictionaryRef    cur_mode;
--- a/src/video/sdl_v.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/video/sdl_v.cpp	Sun May 04 21:53:36 2008 +0000
@@ -9,6 +9,7 @@
 #include "../gfx_func.h"
 #include "../sdl.h"
 #include "../variables.h"
+#include "../rev.h"
 #include "../blitter/factory.hpp"
 #include "../network/network.h"
 #include "../core/math_func.hpp"
@@ -186,7 +187,6 @@
 
 static bool CreateMainSurface(int w, int h)
 {
-	extern const char _openttd_revision[];
 	SDL_Surface *newscreen, *icon;
 	char caption[50];
 	int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
--- a/src/video/win32_v.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/video/win32_v.cpp	Sun May 04 21:53:36 2008 +0000
@@ -5,6 +5,7 @@
 #include "../gfx_func.h"
 #include "../variables.h"
 #include "../win32.h"
+#include "../rev.h"
 #include "../blitter/factory.hpp"
 #include "../network/network.h"
 #include "../core/math_func.hpp"
@@ -282,7 +283,6 @@
 			ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL); // remove maximize-flag
 			SetWindowPos(_wnd.main_wnd, 0, x, y, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
 		} else {
-			extern const char _openttd_revision[];
 			TCHAR Windowtitle[50];
 
 			_sntprintf(Windowtitle, sizeof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision));
--- a/src/win32.cpp	Sun May 04 21:47:36 2008 +0000
+++ b/src/win32.cpp	Sun May 04 21:53:36 2008 +0000
@@ -9,6 +9,7 @@
 #include "gfx_func.h"
 #include "textbuf_gui.h"
 #include "fileio.h"
+#include "rev.h"
 #include <windows.h>
 #include <winnt.h>
 #include <wininet.h>
@@ -460,7 +461,6 @@
 
 static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
 {
-	extern const char _openttd_revision[];
 	char *output;
 	static bool had_exception = false;