diff options
author | glx <glx@openttd.org> | 2018-12-09 02:28:14 +0100 |
---|---|---|
committer | glx22 <glx22@users.noreply.github.com> | 2018-12-27 18:09:16 +0100 |
commit | c540d7244531d501f16b485a3e45e358f98853be (patch) | |
tree | 4d270f06b2aa9b4f796d4828e5bfaf3c09cdd4b1 | |
parent | 8890926b0d1069aec7ef53fd84868a7a3ca02c05 (diff) | |
download | openttd-c540d7244531d501f16b485a3e45e358f98853be.tar.xz |
Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined macro _WIN32
-rw-r--r-- | src/ai/ai_info.cpp | 4 | ||||
-rw-r--r-- | src/bootstrap_gui.cpp | 2 | ||||
-rw-r--r-- | src/core/endian_type.hpp | 4 | ||||
-rw-r--r-- | src/debug.cpp | 4 | ||||
-rw-r--r-- | src/fileio.cpp | 18 | ||||
-rw-r--r-- | src/fileio_func.h | 4 | ||||
-rw-r--r-- | src/fios.cpp | 8 | ||||
-rw-r--r-- | src/fontdetection.cpp | 2 | ||||
-rw-r--r-- | src/game/game_info.cpp | 4 | ||||
-rw-r--r-- | src/ini.cpp | 4 | ||||
-rw-r--r-- | src/network/core/core.cpp | 6 | ||||
-rw-r--r-- | src/network/core/host.cpp | 2 | ||||
-rw-r--r-- | src/network/core/os_abstraction.h | 6 | ||||
-rw-r--r-- | src/openttd.cpp | 10 | ||||
-rw-r--r-- | src/script/script_scanner.cpp | 2 | ||||
-rw-r--r-- | src/sdl.h | 2 | ||||
-rw-r--r-- | src/settings.cpp | 4 | ||||
-rw-r--r-- | src/settingsgen/settingsgen.cpp | 4 | ||||
-rw-r--r-- | src/stdafx.h | 18 | ||||
-rw-r--r-- | src/strgen/strgen.cpp | 12 | ||||
-rw-r--r-- | src/string.cpp | 8 | ||||
-rw-r--r-- | src/strings.cpp | 6 | ||||
-rw-r--r-- | src/table/win32_settings.ini | 4 | ||||
-rw-r--r-- | src/video/dedicated_v.cpp | 6 | ||||
-rw-r--r-- | src/video/sdl_v.cpp | 4 |
25 files changed, 74 insertions, 74 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index 9c27006c4..43a434546 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -32,9 +32,9 @@ static bool CheckAPIVersion(const char *api_version) strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0; } -#if defined(WIN32) +#if defined(_WIN32) #undef GetClassName -#endif /* WIN32 */ +#endif /* _WIN32 */ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; } /* static */ void AIInfo::RegisterAPI(Squirrel *engine) diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 62f5450c5..3fb52a1f9 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -220,7 +220,7 @@ bool HandleBootstrap() if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure; /* If there is no network or no freetype, then there is nothing we can do. Go straight to failure. */ -#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(WIN32) || defined(__APPLE__)) +#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(_WIN32) || defined(__APPLE__)) if (!_network_available) goto failure; /* First tell the game we're bootstrapping. */ diff --git a/src/core/endian_type.hpp b/src/core/endian_type.hpp index 453bf5402..4058c5c19 100644 --- a/src/core/endian_type.hpp +++ b/src/core/endian_type.hpp @@ -26,7 +26,7 @@ #define TTD_BIG_ENDIAN 1 /* Windows has always LITTLE_ENDIAN */ -#if defined(WIN32) || defined(__OS2__) || defined(WIN64) +#if defined(_WIN32) || defined(__OS2__) # define TTD_ENDIAN TTD_LITTLE_ENDIAN #elif defined(OSX) # include <sys/types.h> @@ -42,6 +42,6 @@ # else # define TTD_ENDIAN TTD_BIG_ENDIAN # endif -#endif /* WIN32 || __OS2__ || WIN64 */ +#endif /* _WIN32 || __OS2__ */ #endif /* ENDIAN_TYPE_HPP */ diff --git a/src/debug.cpp b/src/debug.cpp index f8f3f0ad5..13df98db3 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -17,7 +17,7 @@ #include "fileio_func.h" #include "settings_type.h" -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) #include "os/windows/win32.h" #endif @@ -139,7 +139,7 @@ static void debug_print(const char *dbg, const char *buf) } else { char buffer[512]; seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf); -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) TCHAR system_buf[512]; convert_to_fs(buffer, system_buf, lengthof(system_buf), true); _fputts(system_buf, stderr); diff --git a/src/fileio.cpp b/src/fileio.cpp index 5530965e9..0e6d86e3c 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -15,7 +15,7 @@ #include "fios.h" #include "string_func.h" #include "tar_type.h" -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> # define access _taccess #elif defined(__HAIKU__) @@ -361,7 +361,7 @@ char *FioFindFullPath(char *buf, const char *last, Subdirectory subdir, const ch FOR_ALL_SEARCHPATHS(sp) { FioGetFullPath(buf, last, sp, subdir, filename); if (FileExists(buf)) return buf; -#if !defined(WIN32) +#if !defined(_WIN32) /* Be, as opening files, aware that sometimes the filename * might be in uppercase when it is in lowercase on the * disk. Of course Windows doesn't care about casing. */ @@ -399,7 +399,7 @@ char *FioGetDirectory(char *buf, const char *last, Subdirectory subdir) static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subdirectory subdir, size_t *filesize) { -#if defined(WIN32) && defined(UNICODE) +#if defined(_WIN32) && defined(UNICODE) /* fopen is implemented as a define with ellipses for * Unicode support (prepend an L). As we are not sending * a string, but a variable, it 'renames' the variable, @@ -416,12 +416,12 @@ static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath s seprintf(buf, lastof(buf), "%s%s%s", _searchpaths[sp], _subdirs[subdir], filename); } -#if defined(WIN32) +#if defined(_WIN32) if (mode[0] == 'r' && GetFileAttributes(OTTD2FS(buf)) == INVALID_FILE_ATTRIBUTES) return NULL; #endif f = fopen(buf, mode); -#if !defined(WIN32) +#if !defined(_WIN32) if (f == NULL && strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1))) { f = fopen(buf, mode); } @@ -535,7 +535,7 @@ void FioCreateDirectory(const char *name) { /* Ignore directory creation errors; they'll surface later on, and most * of the time they are 'directory already exists' errors anyhow. */ -#if defined(WIN32) +#if defined(_WIN32) CreateDirectory(OTTD2FS(name), NULL); #elif defined(OS2) && !defined(__INNOTEK_LIBC__) mkdir(OTTD2FS(name)); @@ -979,14 +979,14 @@ bool ExtractTar(const char *tar_filename, Subdirectory subdir) return true; } -#if defined(WIN32) +#if defined(_WIN32) /** * Determine the base (personal dir and game data dir) paths * @param exe the path from the current path to the executable * @note defined in the OS related files (os2.cpp, win32.cpp, unix.cpp etc) */ extern void DetermineBasePaths(const char *exe); -#else /* defined(WIN32) */ +#else /* defined(_WIN32) */ /** * Changes the working directory to the path of the give executable. @@ -1149,7 +1149,7 @@ extern void cocoaSetApplicationBundleDir(); _searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL; #endif } -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ const char *_personal_dir; diff --git a/src/fileio_func.h b/src/fileio_func.h index 638318074..f5ef58ac0 100644 --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -118,7 +118,7 @@ public: DECLARE_ENUM_AS_BIT_SET(TarScanner::Mode) /* Implementation of opendir/readdir/closedir for Windows */ -#if defined(WIN32) +#if defined(_WIN32) struct DIR; struct dirent { // XXX - only d_name implemented @@ -136,7 +136,7 @@ int closedir(DIR *d); /* Use system-supplied opendir/readdir/closedir functions */ # include <sys/types.h> # include <dirent.h> -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ /** * A wrapper around opendir() which will convert the string from diff --git a/src/fios.cpp b/src/fios.cpp index f4a25e1ed..73365ddc2 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -20,9 +20,9 @@ #include "string_func.h" #include <sys/stat.h> -#ifndef WIN32 +#ifndef _WIN32 # include <unistd.h> -#endif /* WIN32 */ +#endif /* _WIN32 */ #include "table/strings.h" @@ -153,7 +153,7 @@ const char *FiosBrowseTo(const FiosItem *item) { switch (item->type) { case FIOS_TYPE_DRIVE: -#if defined(WIN32) || defined(__OS2__) +#if defined(_WIN32) || defined(__OS2__) seprintf(_fios_path, _fios_path_last, "%c:" PATHSEP, item->title[0]); #endif break; @@ -318,7 +318,7 @@ bool FiosFileScanner::AddFile(const char *filename, size_t basepath_length, cons } FiosItem *fios = file_list.Append(); -#ifdef WIN32 +#ifdef _WIN32 struct _stat sb; if (_tstat(OTTD2FS(filename), &sb) == 0) { #else diff --git a/src/fontdetection.cpp b/src/fontdetection.cpp index 14eef9f64..4279d60f3 100644 --- a/src/fontdetection.cpp +++ b/src/fontdetection.cpp @@ -28,7 +28,7 @@ extern FT_Library _library; * Windows support * ======================================================================================== */ -#ifdef WIN32 +#ifdef _WIN32 #include "core/alloc_func.hpp" #include "core/math_func.hpp" #include <windows.h> diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp index 976153296..f8c04608b 100644 --- a/src/game/game_info.cpp +++ b/src/game/game_info.cpp @@ -29,9 +29,9 @@ static bool CheckAPIVersion(const char *api_version) strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0; } -#if defined(WIN32) +#if defined(_WIN32) #undef GetClassName -#endif /* WIN32 */ +#endif /* _WIN32 */ template <> const char *GetClassName<GameInfo, ST_GS>() { return "GSInfo"; } /* static */ void GameInfo::RegisterAPI(Squirrel *engine) diff --git a/src/ini.cpp b/src/ini.cpp index 905ebfacf..6767d8525 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -19,7 +19,7 @@ # include <unistd.h> #endif -#ifdef WIN32 +#ifdef _WIN32 # include <windows.h> # include <shellapi.h> # include "core/mem_func.hpp" @@ -87,7 +87,7 @@ bool IniFile::SaveToDisk(const char *filename) fclose(f); #endif -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) /* _tcsncpy = strcpy is TCHAR is char, but isn't when TCHAR is wchar. */ #undef strncpy /* Allocate space for one more \0 character. */ diff --git a/src/network/core/core.cpp b/src/network/core/core.cpp index 7a2ad92a2..c8db860dd 100644 --- a/src/network/core/core.cpp +++ b/src/network/core/core.cpp @@ -64,7 +64,7 @@ bool NetworkCoreInitialize() #endif /* __MORPHOS__ / __AMIGA__ */ /* Let's load the network in windows */ -#ifdef WIN32 +#ifdef _WIN32 { WSADATA wsa; DEBUG(net, 3, "[core] loading windows socket library"); @@ -73,7 +73,7 @@ bool NetworkCoreInitialize() return false; } } -#endif /* WIN32 */ +#endif /* _WIN32 */ return true; } @@ -94,7 +94,7 @@ void NetworkCoreShutdown() if (SocketBase != NULL) CloseLibrary(SocketBase); #endif -#if defined(WIN32) +#if defined(_WIN32) WSACleanup(); #endif } diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp index e431dde9f..216839032 100644 --- a/src/network/core/host.cpp +++ b/src/network/core/host.cpp @@ -107,7 +107,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // GE freeifaddrs(ifap); } -#elif defined(WIN32) +#elif defined(_WIN32) static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Win32 implementation { SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h index c24cc9f8f..c320cd910 100644 --- a/src/network/core/os_abstraction.h +++ b/src/network/core/os_abstraction.h @@ -21,7 +21,7 @@ #ifdef ENABLE_NETWORK /* Windows stuff */ -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) #include <errno.h> #include <winsock2.h> #include <ws2tcpip.h> @@ -125,7 +125,7 @@ static inline void OTTDfreeaddrinfo(struct addrinfo *ai) } #define freeaddrinfo OTTDfreeaddrinfo #endif /* __MINGW32__ && __CYGWIN__ */ -#endif /* WIN32 */ +#endif /* _WIN32 */ /* UNIX stuff */ #if defined(UNIX) && !defined(__OS2__) @@ -290,7 +290,7 @@ typedef unsigned long in_addr_t; */ static inline bool SetNonBlocking(SOCKET d) { -#ifdef WIN32 +#ifdef _WIN32 u_long nonblocking = 1; #else int nonblocking = 1; diff --git a/src/openttd.cpp b/src/openttd.cpp index 03c8aa286..703f04f01 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -168,7 +168,7 @@ static void ShowHelp() " -P password = Password to join company\n" " -D [ip][:port] = Start dedicated server\n" " -l ip[:port] = Redirect DEBUG()\n" -#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) +#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(_WIN32) " -f = Fork into the background (dedicated only)\n" #endif #endif /* ENABLE_NETWORK */ @@ -212,7 +212,7 @@ static void ShowHelp() /* ShowInfo put output to stderr, but version information should go * to stdout; this is the only exception */ -#if !defined(WIN32) && !defined(WIN64) +#if !defined(_WIN32) printf("%s\n", buf); #else ShowInfo(buf); @@ -250,7 +250,7 @@ static void WriteSavegameInfo(const char *name) /* ShowInfo put output to stderr, but version information should go * to stdout; this is the only exception */ -#if !defined(WIN32) && !defined(WIN64) +#if !defined(_WIN32) printf("%s\n", buf); #else ShowInfo(buf); @@ -514,7 +514,7 @@ static const OptionData _options[] = { GETOPT_SHORT_VALUE('l'), GETOPT_SHORT_VALUE('p'), GETOPT_SHORT_VALUE('P'), -#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) +#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(_WIN32) GETOPT_SHORT_NOVAL('f'), #endif #endif /* ENABLE_NETWORK */ @@ -614,7 +614,7 @@ int openttd_main(int argc, char *argv[]) case 'r': ParseResolution(&resolution, mgo.opt); break; case 't': scanner->startyear = atoi(mgo.opt); break; case 'd': { -#if defined(WIN32) +#if defined(_WIN32) CreateConsole(); #endif if (mgo.opt != NULL) SetDebugString(mgo.opt); diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp index 57265669f..fe6d41cf9 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -134,7 +134,7 @@ void ScriptScanner::RegisterScript(ScriptInfo *info) if (this->info_list.find(script_name) != this->info_list.end()) { /* This script was already registered */ -#ifdef WIN32 +#ifdef _WIN32 /* Windows doesn't care about the case */ if (strcasecmp(this->info_list[script_name]->GetMainScript(), info->GetMainScript()) == 0) { #else @@ -15,7 +15,7 @@ const char *SdlOpen(uint32 x); void SdlClose(uint32 x); -#ifdef WIN32 +#ifdef _WIN32 #define DYNAMICALLY_LOADED_SDL #endif diff --git a/src/settings.cpp b/src/settings.cpp index 0dc1e24d4..3e61cc87f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1668,9 +1668,9 @@ static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescP { if (basic_settings) { proc(ini, (const SettingDesc*)_misc_settings, "misc", NULL); -#if defined(WIN32) && !defined(DEDICATED) +#if defined(_WIN32) && !defined(DEDICATED) proc(ini, (const SettingDesc*)_win32_settings, "win32", NULL); -#endif /* WIN32 */ +#endif /* _WIN32 */ } if (other_settings) { diff --git a/src/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp index ac6db6581..298539417 100644 --- a/src/settingsgen/settingsgen.cpp +++ b/src/settingsgen/settingsgen.cpp @@ -18,7 +18,7 @@ #include <stdarg.h> -#if (!defined(WIN32) && !defined(WIN64)) || defined(__CYGWIN__) +#if !defined(_WIN32) || defined(__CYGWIN__) #include <unistd.h> #include <sys/stat.h> #endif @@ -512,7 +512,7 @@ int CDECL main(int argc, char *argv[]) unlink(tmp_output); } else { /* Rename tmp2.xxx to output file. */ -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) unlink(output_file); #endif if (rename(tmp_output, output_file) == -1) error("rename() failed"); diff --git a/src/stdafx.h b/src/stdafx.h index fb384ca82..6e96e98fd 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -167,7 +167,7 @@ #include <malloc.h> // alloca() #endif -#if defined(WIN32) +#if defined(_WIN32) #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #endif @@ -232,18 +232,18 @@ #define FALLTHROUGH #endif - #if defined(WIN32) && !defined(_WIN64) && !defined(WIN64) +# if defined(_WIN32) && !defined(_WIN64) #if !defined(_W64) #define _W64 #endif typedef _W64 int INT_PTR, *PINT_PTR; typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; - #endif /* WIN32 && !_WIN64 && !WIN64 */ +# endif /* _WIN32 && !_WIN64 */ - #if defined(_WIN64) || defined(WIN64) +# if defined(_WIN64) #define fseek _fseeki64 - #endif /* _WIN64 || WIN64 */ +# endif /* _WIN64 */ /* zlib from vcpkg use cdecl calling convention without enforcing it in the headers */ # if defined(WITH_ZLIB) @@ -281,7 +281,7 @@ /* NOTE: the string returned by these functions is only valid until the next * call to the same function and is not thread- or reentrancy-safe */ #if !defined(STRGEN) && !defined(SETTINGSGEN) - #if defined(WIN32) || defined(WIN64) +# if defined(_WIN32) char *getcwd(char *buf, size_t size); #include <tchar.h> #include <io.h> @@ -292,14 +292,14 @@ const char *FS2OTTD(const TCHAR *name); const TCHAR *OTTD2FS(const char *name, bool console_cp = false); - #else +# else #define fopen(file, mode) fopen(OTTD2FS(file), mode) const char *FS2OTTD(const char *name); const char *OTTD2FS(const char *name); - #endif /* WIN32 */ +# endif /* _WIN32 */ #endif /* STRGEN || SETTINGSGEN */ -#if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) +#if defined(_WIN32) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) #define PATHSEP "\\" #define PATHSEPCHAR '\\' #else diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index c231717da..44cbd127a 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -21,14 +21,14 @@ #include <stdarg.h> #include <exception> -#if (!defined(WIN32) && !defined(WIN64)) || defined(__CYGWIN__) +#if !defined(_WIN32) || defined(__CYGWIN__) #include <unistd.h> #include <sys/stat.h> #endif -#if defined WIN32 || defined __WATCOMC__ +#if defined(_WIN32) || defined(__WATCOMC__) #include <direct.h> -#endif /* WIN32 || __WATCOMC__ */ +#endif /* _WIN32 || __WATCOMC__ */ #ifdef __MORPHOS__ #ifdef stderr @@ -333,9 +333,9 @@ struct HeaderFileWriter : HeaderWriter, FileWriter { unlink(this->filename); } else { /* else rename tmp.xxx into filename */ - #if defined(WIN32) || defined(WIN64) +# if defined(_WIN32) unlink(this->real_filename); - #endif +# endif if (rename(this->filename, this->real_filename) == -1) error("rename() failed"); } } @@ -377,7 +377,7 @@ static inline void ottd_mkdir(const char *directory) { /* Ignore directory creation errors; they'll surface later on, and most * of the time they are 'directory already exists' errors anyhow. */ -#if defined(WIN32) || defined(__WATCOMC__) +#if defined(_WIN32) || defined(__WATCOMC__) mkdir(directory); #else mkdir(directory, 0755); diff --git a/src/string.cpp b/src/string.cpp index 96e1d8275..ae1b556af 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -25,7 +25,7 @@ #include <errno.h> // required by vsnprintf implementation for MSVC #endif -#ifdef WIN32 +#ifdef _WIN32 #include "os/windows/win32.h" #endif @@ -359,7 +359,7 @@ bool IsValidChar(WChar key, CharSetFilter afilter) } } -#ifdef WIN32 +#ifdef _WIN32 #if defined(_MSC_VER) && _MSC_VER < 1900 /** * Almost POSIX compliant implementation of \c vsnprintf for VC compiler. @@ -395,7 +395,7 @@ int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap) } #endif /* _MSC_VER */ -#endif /* WIN32 */ +#endif /* _WIN32 */ /** * Safer implementation of snprintf; same as snprintf except: @@ -592,7 +592,7 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front) } #endif /* WITH_ICU_SORT */ -#if defined(WIN32) && !defined(STRGEN) && !defined(SETTINGSGEN) +#if defined(_WIN32) && !defined(STRGEN) && !defined(SETTINGSGEN) int res = OTTDStringCompare(s1, s2); if (res != 0) return res - 2; // Convert to normal C return values. #endif diff --git a/src/strings.cpp b/src/strings.cpp index 164d8a3c9..2cc3a23be 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1786,7 +1786,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang) strecpy(_config_language_file, c_file, lastof(_config_language_file)); SetCurrentGrfLangID(_current_language->newgrflangid); -#ifdef WIN32 +#ifdef _WIN32 extern void Win32SetCurrentLocaleName(const char *iso_code); Win32SetCurrentLocaleName(_current_language->isocode); #endif @@ -1837,7 +1837,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang) /* Win32 implementation in win32.cpp. * OS X implementation in os/macosx/macos.mm. */ -#if !(defined(WIN32) || defined(__APPLE__)) +#if !(defined(_WIN32) || defined(__APPLE__)) /** * Determine the current charset based on the environment * First check some default values, after this one we passed ourselves @@ -1865,7 +1865,7 @@ const char *GetCurrentLocale(const char *param) } #else const char *GetCurrentLocale(const char *param); -#endif /* !(defined(WIN32) || defined(__APPLE__)) */ +#endif /* !(defined(_WIN32) || defined(__APPLE__)) */ int CDECL StringIDSorter(const StringID *a, const StringID *b) { diff --git a/src/table/win32_settings.ini b/src/table/win32_settings.ini index 1e0c9ad02..70c18a424 100644 --- a/src/table/win32_settings.ini +++ b/src/table/win32_settings.ini @@ -8,14 +8,14 @@ [pre-amble] /* win32_v.cpp only settings */ -#if defined(WIN32) && !defined(DEDICATED) +#if defined(_WIN32) && !defined(DEDICATED) extern bool _force_full_redraw, _window_maximize; extern uint _display_hz; static const SettingDescGlobVarList _win32_settings[] = { [post-amble] }; -#endif /* WIN32 */ +#endif /* _WIN32 */ [templates] SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat), SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat), diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index aaadd9461..47fa64231 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -73,7 +73,7 @@ static void DedicatedSignalHandler(int sig) } #endif -#if defined(WIN32) +#if defined(_WIN32) # include <windows.h> /* GetTickCount */ # include <conio.h> # include <time.h> @@ -150,7 +150,7 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm) ScreenSizeChanged(); BlitterFactory::GetCurrentBlitter()->PostResize(); -#if defined(WIN32) +#if defined(_WIN32) /* For win32 we need to allocate a console (debug mode does the same) */ CreateConsole(); CreateWindowsConsoleThread(); @@ -173,7 +173,7 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm) void VideoDriver_Dedicated::Stop() { -#ifdef WIN32 +#ifdef _WIN32 CloseWindowsConsoleThread(); #endif free(_dedicated_video_mem); diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index f40c4b646..e96decb45 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -264,7 +264,7 @@ static void GetAvailableVideoMode(uint *w, uint *h) *h = _resolutions[best].height; } -#ifdef WIN32 +#ifdef _WIN32 /* Let's redefine the LoadBMP macro with because we are dynamically * loading SDL and need to 'SDL_CALL' all functions */ #undef SDL_LoadBMP @@ -500,7 +500,7 @@ static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, WChar *character) } /* check scancode for BACKQUOTE key, because we want the key left of "1", not anything else (on non-US keyboards) */ -#if defined(WIN32) || defined(__OS2__) +#if defined(_WIN32) || defined(__OS2__) if (sym->scancode == 41) key = WKC_BACKQUOTE; #elif defined(__APPLE__) if (sym->scancode == 10) key = WKC_BACKQUOTE; |