diff options
author | smatz <smatz@openttd.org> | 2008-05-04 21:53:36 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-05-04 21:53:36 +0000 |
commit | 297f99e100bcede36d54b8f833756c73d70fd4a0 (patch) | |
tree | 741c48c433316b11af1a790772deb3a4078fe47c | |
parent | 0b8b5d1f3b5f45374d1e43390777b2de51fb7728 (diff) | |
download | openttd-297f99e100bcede36d54b8f833756c73d70fd4a0.tar.xz |
(svn r12944) -Codechange: use rev.h instead of externs at many places
-rw-r--r-- | projects/openttd_vs80.vcproj | 4 | ||||
-rw-r--r-- | projects/openttd_vs90.vcproj | 4 | ||||
-rw-r--r-- | source.list | 1 | ||||
-rw-r--r-- | src/console.cpp | 2 | ||||
-rw-r--r-- | src/network/network.cpp | 2 | ||||
-rw-r--r-- | src/network/network.h | 3 | ||||
-rw-r--r-- | src/network/network_client.cpp | 2 | ||||
-rw-r--r-- | src/newgrf.cpp | 5 | ||||
-rw-r--r-- | src/openttd.cpp | 4 | ||||
-rw-r--r-- | src/os/macosx/macos.mm | 2 | ||||
-rw-r--r-- | src/rev.cpp.in | 5 | ||||
-rw-r--r-- | src/rev.h | 11 | ||||
-rw-r--r-- | src/settings.cpp | 4 | ||||
-rw-r--r-- | src/strings.cpp | 2 | ||||
-rw-r--r-- | src/video/cocoa/wnd_quartz.mm | 4 | ||||
-rw-r--r-- | src/video/cocoa/wnd_quickdraw.mm | 5 | ||||
-rw-r--r-- | src/video/sdl_v.cpp | 2 | ||||
-rw-r--r-- | src/video/win32_v.cpp | 2 | ||||
-rw-r--r-- | src/win32.cpp | 2 |
19 files changed, 37 insertions, 29 deletions
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj index b56616fd2..a080171b5 100644 --- a/projects/openttd_vs80.vcproj +++ b/projects/openttd_vs80.vcproj @@ -1320,6 +1320,10 @@ > </File> <File + RelativePath=".\..\src\rev.h" + > + </File> + <File RelativePath=".\..\src\road_cmd.h" > </File> diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj index 20f9d23cc..efe1023b9 100644 --- a/projects/openttd_vs90.vcproj +++ b/projects/openttd_vs90.vcproj @@ -1317,6 +1317,10 @@ > </File> <File + RelativePath=".\..\src\rev.h" + > + </File> + <File RelativePath=".\..\src\road_cmd.h" > </File> diff --git a/source.list b/source.list index bcf382c7b..f9e9b1986 100644 --- a/source.list +++ b/source.list @@ -251,6 +251,7 @@ rail.h rail_gui.h rail_type.h core/random_func.hpp +rev.h road_cmd.h road_func.h road_gui.h diff --git a/src/console.cpp b/src/console.cpp index 885f5eaf4..00e471e12 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -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 @@ static const WindowDesc _iconsole_window_desc = { void IConsoleInit() { - extern const char _openttd_revision[]; _iconsole_output_file = NULL; _icolour_def = 1; _icolour_err = 3; diff --git a/src/network/network.cpp b/src/network/network.cpp index 26009d749..a73337ae6 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -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 @@ void NetworkShutDown() */ bool IsNetworkCompatibleVersion(const char *other) { - extern const char _openttd_revision[]; return strncmp(_openttd_revision, other, NETWORK_REVISION_LENGTH - 1) == 0; } diff --git a/src/network/network.h b/src/network/network.h index 3cedb9b6e..fbe2a31cc 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -31,9 +31,6 @@ static inline void NetworkShutDown() {} #endif /* ENABLE_NETWORK */ -/** What is the revision of OpenTTD. */ -extern const char _openttd_revision[]; - /** As which player do we play? */ extern PlayerID _network_playas; diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index abc5c6203..eb129ffe1 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -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 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_JOIN) // 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); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 82746ad21..f6a344ea6 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -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 @@ bool GetGlobalVariable(byte param, uint32 *value) *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; diff --git a/src/openttd.cpp b/src/openttd.cpp index be999af16..6a6ec5a13 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -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 @@ void CDECL ShowInfoF(const char *str, ...) ShowInfo(buf); } -/** The current revision of OpenTTD */ -extern const char _openttd_revision[]; - /** * Show the help message when someone passed a wrong parameter. */ diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm index 14d3cfcf9..ca8954f49 100644 --- a/src/os/macosx/macos.mm +++ b/src/os/macosx/macos.mm @@ -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 @@ static char *GetOSString() char OS[20]; char newgrf[125]; long sysVersion; - extern const char _openttd_revision[]; // get the hardware info host_basic_info_data_t hostInfo; diff --git a/src/rev.cpp.in b/src/rev.cpp.in index 7a36a1109..e8570f746 100644 --- a/src/rev.cpp.in +++ b/src/rev.cpp.in @@ -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 @@ extern const char _openttd_revision[] = "@@VERSION@@"; * 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__ /** diff --git a/src/rev.h b/src/rev.h new file mode 100644 index 000000000..b25c729ca --- /dev/null +++ b/src/rev.h @@ -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 */ diff --git a/src/settings.cpp b/src/settings.cpp index eabd3c1b7..2c800e96d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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 NewsDisplaySaveConfig(IniFile *ini, const char *grpname) */ 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; diff --git a/src/strings.cpp b/src/strings.cpp index 5cebdf7da..ab2494808 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -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 @@ uint ConvertDisplaySpeedToSpeed(uint speed) 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; diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm index dfb59c31f..a85ce283b 100644 --- a/src/video/cocoa/wnd_quartz.mm +++ b/src/video/cocoa/wnd_quartz.mm @@ -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 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace() @end -extern const char _openttd_revision[]; - - void WindowQuartzSubdriver::GetDeviceInfo() { CFDictionaryRef cur_mode; diff --git a/src/video/cocoa/wnd_quickdraw.mm b/src/video/cocoa/wnd_quickdraw.mm index 6c30900d0..df4411db5 100644 --- a/src/video/cocoa/wnd_quickdraw.mm +++ b/src/video/cocoa/wnd_quickdraw.mm @@ -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 @@ static bool _resize_icon[] = { }; - -extern const char _openttd_revision[]; - - void WindowQuickdrawSubdriver::GetDeviceInfo() { CFDictionaryRef cur_mode; diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 6bf74488d..de9bbbfa4 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -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 void GetAvailableVideoMode(int *w, int *h) static bool CreateMainSurface(int w, int h) { - extern const char _openttd_revision[]; SDL_Surface *newscreen, *icon; char caption[50]; int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth(); diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 0ab7be62f..eb78408f4 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -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 @@ static bool MakeWindow(bool full_screen) 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)); diff --git a/src/win32.cpp b/src/win32.cpp index 741823877..8b2eef0de 100644 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -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 @@ extern bool CloseConsoleLogIfActive(); static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep) { - extern const char _openttd_revision[]; char *output; static bool had_exception = false; |