move compiler normalisation to rct2.h

This commit is contained in:
IntelOrca 2016-01-10 22:06:54 +00:00
parent 5a1a531d60
commit c7feb72a69
3 changed files with 32 additions and 29 deletions

View File

@ -1,4 +1,7 @@
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else
#include "../platform/platform.h"

View File

@ -169,11 +169,6 @@ bool platform_check_steam_overlay_attached();
datetime64 platform_get_datetime_now_utc();
// BSD and OS X has MAP_ANON instead of MAP_ANONYMOUS
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
// Windows specific definitions
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
@ -185,28 +180,4 @@ datetime64 platform_get_datetime_now_utc();
HWND windows_get_window_handle();
#endif // _WIN32
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#define STUB() log_warning("Function %s at %s:%d is a stub.\n", __PRETTY_FUNCTION__, __FILE__, __LINE__)
#define _strcmpi _stricmp
#define _stricmp(x, y) strcasecmp((x), (y))
#define _strnicmp(x, y, n) strncasecmp((x), (y), (n))
#define _strdup(x) strdup((x))
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define RCT2_ENDIANESS __ORDER_LITTLE_ENDIAN__
#define LOBYTE(w) ((uint8_t)(w))
#define HIBYTE(w) ((uint8_t)(((uint16_t)(w)>>8)&0xFF))
#endif // __BYTE_ORDER__
#ifndef RCT2_ENDIANESS
#error Unknown endianess!
#endif // RCT2_ENDIANESS
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if !(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
char *strndup(const char *src, size_t size);
#endif // !(POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
#endif

View File

@ -111,6 +111,35 @@ typedef utf16* utf16string;
#pragma pack(1)
#endif
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#define STUB() log_warning("Function %s at %s:%d is a stub.\n", __PRETTY_FUNCTION__, __FILE__, __LINE__)
#define _strcmpi _stricmp
#define _stricmp(x, y) strcasecmp((x), (y))
#define _strnicmp(x, y, n) strncasecmp((x), (y), (n))
#define _strdup(x) strdup((x))
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define RCT2_ENDIANESS __ORDER_LITTLE_ENDIAN__
#define LOBYTE(w) ((uint8_t)(w))
#define HIBYTE(w) ((uint8_t)(((uint16_t)(w)>>8)&0xFF))
#endif // __BYTE_ORDER__
#ifndef RCT2_ENDIANESS
#error Unknown endianess!
#endif // RCT2_ENDIANESS
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if !(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
char *strndup(const char *src, size_t size);
#endif // !(POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
// BSD and OS X has MAP_ANON instead of MAP_ANONYMOUS
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
#include "version.h"
#define OPENRCT2_MASTER_SERVER_URL "https://servers.openrct2.website"