(svn r12944) -Codechange: use rev.h instead of externs at many places

This commit is contained in:
smatz 2008-05-04 21:53:36 +00:00
parent 0b8b5d1f3b
commit 297f99e100
19 changed files with 37 additions and 29 deletions

View File

@ -1319,6 +1319,10 @@
RelativePath=".\..\src\core\random_func.hpp"
>
</File>
<File
RelativePath=".\..\src\rev.h"
>
</File>
<File
RelativePath=".\..\src\road_cmd.h"
>

View File

@ -1316,6 +1316,10 @@
RelativePath=".\..\src\core\random_func.hpp"
>
</File>
<File
RelativePath=".\..\src\rev.h"
>
</File>
<File
RelativePath=".\..\src\road_cmd.h"
>

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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.
*/

View File

@ -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;

View File

@ -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__
/**

11
src/rev.h Normal file
View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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));

View File

@ -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;