diff options
-rw-r--r-- | console.c | 14 | ||||
-rw-r--r-- | network.c | 10 | ||||
-rw-r--r-- | network_client.c | 10 | ||||
-rw-r--r-- | network_gui.c | 9 | ||||
-rw-r--r-- | network_server.c | 5 | ||||
-rw-r--r-- | strings.c | 9 | ||||
-rw-r--r-- | ttd.c | 7 | ||||
-rw-r--r-- | variables.h | 7 | ||||
-rw-r--r-- | win32.c | 8 |
9 files changed, 26 insertions, 53 deletions
@@ -232,14 +232,6 @@ static void IConsoleWndProc(Window* w, WindowEvent* e) void IConsoleInit(void) { uint i; -#ifdef WITH_REV_HACK - #define WITH_REV - const char _openttd_revision[] = WITH_REV_HACK; -#else - #if defined(WITH_REV) - extern char _openttd_revision[]; - #endif -#endif _iconsole_output_file = NULL; _iconsole_color_default = 1; _iconsole_color_error = 3; @@ -604,7 +596,7 @@ void IConsoleAliasExec(const char* cmdline, char* tokens[20], byte tokentypes[20 if (cmdline[i] == '+') { // all params seperated: "[param 1]" "[param 2]" t=1; - while ((tokens[t]!=NULL) && (t<20) && + while ((tokens[t]!=NULL) && (t<20) && ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { int l2 = strlen(tokens[t]); *linestream = '"'; @@ -623,7 +615,7 @@ void IConsoleAliasExec(const char* cmdline, char* tokens[20], byte tokentypes[20 t=1; *linestream = '"'; linestream++; - while ((tokens[t]!=NULL) && (t<20) && + while ((tokens[t]!=NULL) && (t<20) && ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { int l2 = strlen(tokens[t]); memcpy(linestream,tokens[t],l2); @@ -640,7 +632,7 @@ void IConsoleAliasExec(const char* cmdline, char* tokens[20], byte tokentypes[20 // one specific parameter: %A = [param 1] %B = [param 2] ... int l2; t = ((byte)cmdline[i]) - 64; - if ((t<20) && (tokens[t]!=NULL) && + if ((t<20) && (tokens[t]!=NULL) && ((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { l2 = strlen(tokens[t]); *linestream = '"'; @@ -785,16 +785,6 @@ bool NetworkClientConnectGame(const byte* host, unsigned short port) void NetworkInitGameInfo(void) { -#ifdef WITH_REV_HACK - #define WITH_REV - const char _openttd_revision[] = WITH_REV_HACK; -#else - #if defined(WITH_REV) - extern char _openttd_revision[]; - #else - const char _openttd_revision[] = "norev000"; - #endif -#endif NetworkClientInfo *ci; ttd_strlcpy(_network_game_info.server_name, _network_server_name, sizeof(_network_game_info.server_name)); diff --git a/network_client.c b/network_client.c index dc512c545..747464425 100644 --- a/network_client.c +++ b/network_client.c @@ -56,16 +56,6 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_JOIN) // String: Unique id to find the player back in server-listing // -#ifdef WITH_REV_HACK - #define WITH_REV - const char _openttd_revision[] = WITH_REV_HACK; -#else - #if defined(WITH_REV) - extern char _openttd_revision[]; - #else - const char _openttd_revision[] = "norev000"; - #endif -#endif Packet *p; _network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING; InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0); diff --git a/network_gui.c b/network_gui.c index 839e227ab..2d39bcbf0 100644 --- a/network_gui.c +++ b/network_gui.c @@ -47,15 +47,6 @@ enum { static NetworkGameList *_selected_item = NULL; static int8 _selected_company_item = -1; -#ifdef WITH_REV_HACK - #define WITH_REV - const char _openttd_revision[] = WITH_REV_HACK; -#else - #ifdef WITH_REV - extern char _openttd_revision[]; - #endif -#endif - // Truncates a string to max_width (via GetStringWidth) and adds 3 dots // at the end of the name. static void NetworkTruncateString(char *name, const int max_width) diff --git a/network_server.c b/network_server.c index 35abd9ae1..cc0b6b452 100644 --- a/network_server.c +++ b/network_server.c @@ -577,7 +577,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN) NetworkRecv_string(p, client_revision, sizeof(client_revision)); // Too bad, when WITH_REV is disabled, we can not compare the version. -#if defined(WITH_REV) || defined (WITH_REV_HACK) +#if defined(WITH_REV) // Check if the client has WITH_REV enabled if (strncmp("norev000", client_revision, sizeof(client_revision)) != 0) { if (strncmp(_network_game_info.server_revision, client_revision, sizeof(_network_game_info.server_revision) - 1) != 0) { @@ -1215,6 +1215,9 @@ void NetworkUpdateClientInfo(uint16 client_index) ci = NetworkFindClientInfoFromIndex(client_index); + if (ci == NULL) + return; + FOR_ALL_CLIENTS(cs) { SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, ci); } @@ -20,15 +20,6 @@ static byte *_langpack; static uint _langtab_num[32]; // Offset into langpack offs static uint _langtab_start[32]; // Offset into langpack offs -#ifdef WITH_REV_HACK - #define WITH_REV - const char _openttd_revision[] = WITH_REV_HACK; -#else - #ifdef WITH_REV - extern const char _openttd_revision[]; - #endif -#endif - typedef byte *PlayerNameGeneratorProc(byte *buffr); typedef struct { @@ -28,6 +28,11 @@ #include <stdarg.h> +/* Define the _openttd_revision tag if it is not defined */ +#ifndef WITH_REV + const char _openttd_revision[] = "norev000"; +#endif + void GameLoop(); void IncreaseSpriteLRU(); @@ -645,7 +650,7 @@ int ttd_main(int argc, char* argv[]) // initialize the ingame console IConsoleInit(); IConsoleCmdExec("exec scripts/autoexec.scr 0"); - + InitPlayerRandoms(); #ifdef ENABLE_NETWORK diff --git a/variables.h b/variables.h index 667bd4a83..ad69bc375 100644 --- a/variables.h +++ b/variables.h @@ -426,6 +426,13 @@ VARDEF int _debug_grf_level; VARDEF int _debug_ai_level; VARDEF int _debug_net_level; +/* Make the revision tag global */ +extern const char _openttd_revision[]; +#ifdef WITH_REV_HACK + /* Special rules for Windows */ + #define WITH_REV +#endif + void CDECL debug(const char *s, ...); #ifdef NO_DEBUG_MESSAGES #define DEBUG(name, level) @@ -15,6 +15,11 @@ #define SMART_PALETTE_ANIM +/* Declare the revision tag for Windows */ +#ifdef WITH_REV_HACK + const char _openttd_revision[] = WITH_REV_HACK; +#endif + static struct { HWND main_wnd; HBITMAP dib_sect; @@ -499,9 +504,8 @@ static void MakeWindow(bool full_screen) SetWindowPos(_wnd.main_wnd, 0, x, y, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); } else { char Windowtitle[50] = "OpenTTD "; - #ifdef WITH_REV_HACK + #ifdef WITH_REV // also show revision number/release in window title - extern const char _openttd_revision[]; strncat(Windowtitle, _openttd_revision, sizeof(Windowtitle)-(strlen(Windowtitle) + 1)); #endif _wnd.main_wnd = CreateWindow("TTD", Windowtitle, style, x, y, w, h, 0, 0, _inst, 0); |