stdafx.h
author matthijs
Wed, 22 Mar 2006 22:26:16 +0000
branch0.4.5
changeset 9958 bed516c67d61
parent 9920 4bbb9a5a48e7
permissions -rw-r--r--
(svn r4041) [Debian] Change next version number to 0.4.6 instead of 0.4.5.1.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     2
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2225
diff changeset
     3
#ifndef STDAFX_H
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2225
diff changeset
     4
#define STDAFX_H
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#include <stdio.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
#include <string.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
#include <stdlib.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
2223
29d61b962cb0 (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    10
// MacOS X will use an NSAlert to display failed assertaions since they're lost unless running from a terminal
2225
e60b20805e4d (svn r2745) -Fix: [OSX] removed the assert window introduced in 2741 from strgen
bjarni
parents: 2223
diff changeset
    11
// strgen always runs from terminal and don't need a window for asserts
2731
97a409a62741 (svn r3276) reverted the last two commits. OSX 10.2 kept finding new stuff to prevent it from running OpenTTD, so now it's not supported anymore
bjarni
parents: 2730
diff changeset
    12
#if !defined(__APPLE__) || defined(STRGEN)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    13
# include <assert.h>
2223
29d61b962cb0 (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    14
#else
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    15
# include "os/macosx/macos.h"
2223
29d61b962cb0 (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    16
#endif
29d61b962cb0 (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    17
858
329ff519fb45 (svn r1339) -Fix: compilation with networking works on MinGW32 again (thx orudge).
darkvater
parents: 796
diff changeset
    18
#if defined(UNIX) || defined(__MINGW32__)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    19
# include <sys/types.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    22
#if defined(__OS2__)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    23
# include <types.h>
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    24
#endif
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    25
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
#ifdef __BEOS__
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    27
# include <SupportDefs.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
446
20304ea8e94e (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    30
#ifdef SUNOS
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    31
# include <alloca.h>
446
20304ea8e94e (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    32
#endif
20304ea8e94e (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    33
770
89dab23f04ca (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    34
#ifdef __MORPHOS__
915
013cb2d74800 (svn r1402) Trim trailing whitespace
tron
parents: 858
diff changeset
    35
// morphos defines certain amiga defines per default, we undefine them
770
89dab23f04ca (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    36
// here to make the rest of source less messy and more clear what is
89dab23f04ca (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    37
// required for morphos and what for amigaos
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    38
# ifdef amigaos
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    39
#  undef amigaos
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    40
# endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    41
# ifdef __amigaos__
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    42
#  undef __amigaos__
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    43
# endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    44
# ifdef __AMIGA__
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    45
#  undef __AMIGA__
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    46
# endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    47
# ifdef AMIGA
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    48
#  undef AMIGA
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    49
# endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    50
# ifdef amiga
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    51
#  undef amiga
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    52
# endif
770
89dab23f04ca (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    53
#endif /* __MORPHOS__ */
89dab23f04ca (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    54
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
#define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000))
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
#define BSWAP16(x) ((x) >> 8 | (x) << 8)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
// by default we use [] var arrays
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
#define VARARRAY_SIZE
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
// Stuff for GCC
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
#if defined(__GNUC__)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
# define NORETURN
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
# define FORCEINLINE inline
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
# define CDECL
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
//#include <alloca.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
//#include <malloc.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
# define __int64 long long
1881
023a134a4b12 (svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents: 1812
diff changeset
    70
# define NOT_REACHED() assert(0)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
# define GCC_PACK __attribute__((packed))
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    73
# if (__GNUC__ == 2)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
#  undef VARARRAY_SIZE
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    75
#  define VARARRAY_SIZE 0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
# endif
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    77
#endif /* __GNUC__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    79
#if defined(__WATCOMC__)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    80
# define NORETURN
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    81
# define FORCEINLINE inline
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    82
# define CDECL
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    83
# define NOT_REACHED() assert(0)
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    84
# define GCC_PACK
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    85
# include <malloc.h>
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    86
#endif /* __WATCOMC__ */
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    87
796
42a3669a939f (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
    88
#if defined(__MINGW32__) || defined(__CYGWIN__)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
    89
# include <malloc.h> // alloca()
796
42a3669a939f (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
    90
#endif
42a3669a939f (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
    91
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
// Stuff for MSVC
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
#if defined(_MSC_VER)
2695
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
    94
# pragma once
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
    95
# define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
    96
# pragma warning(disable: 4244)  // 'conversion' conversion from 'type1' to 'type2', possible loss of data
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
    97
# pragma warning(disable: 4761)  // integral size mismatch in argument : conversion supplied
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
    98
# if _MSC_VER < 1300             // MSVC 6 borkdness
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
    99
#  pragma warning(disable: 4018) // 'expression' : signed/unsigned mismatch
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
   100
#  pragma warning(disable: 4305) // 'identifier' : truncation from 'type1' to 'type2'
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
   101
# endif /* _MSC_VER < 1300 */
9920
4bbb9a5a48e7 (svn r3950) - Add directives to allow Visual Studio 2005 compilation. Backport of r3551 from trunk.
Darkvater
parents: 9918
diff changeset
   102
# if _MSC_VER >= 1400              // MSVC 2005 safety checks
4bbb9a5a48e7 (svn r3950) - Add directives to allow Visual Studio 2005 compilation. Backport of r3551 from trunk.
Darkvater
parents: 9918
diff changeset
   103
#  pragma warning(disable: 4996)   // 'strdup' was declared deprecated
4bbb9a5a48e7 (svn r3950) - Add directives to allow Visual Studio 2005 compilation. Backport of r3551 from trunk.
Darkvater
parents: 9918
diff changeset
   104
#  define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
4bbb9a5a48e7 (svn r3950) - Add directives to allow Visual Studio 2005 compilation. Backport of r3551 from trunk.
Darkvater
parents: 9918
diff changeset
   105
#  pragma comment(linker, "/NODEFAULTLIB:LIBC.LIB")
4bbb9a5a48e7 (svn r3950) - Add directives to allow Visual Studio 2005 compilation. Backport of r3551 from trunk.
Darkvater
parents: 9918
diff changeset
   106
                                   // allow linking to non-recompiled libs
4bbb9a5a48e7 (svn r3950) - Add directives to allow Visual Studio 2005 compilation. Backport of r3551 from trunk.
Darkvater
parents: 9918
diff changeset
   107
# endif /* _MSC_VER >= 1400 */
2695
395110265c87 (svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents: 2694
diff changeset
   108
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   109
# include <malloc.h> // alloca()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
# define NORETURN __declspec(noreturn)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   111
# define FORCEINLINE __forceinline
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   112
# define inline _inline
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   113
# define CDECL _cdecl
1881
023a134a4b12 (svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents: 1812
diff changeset
   114
# if defined(_DEBUG)
023a134a4b12 (svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents: 1812
diff changeset
   115
#  define NOT_REACHED() assert(0)
023a134a4b12 (svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents: 1812
diff changeset
   116
# else
023a134a4b12 (svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents: 1812
diff changeset
   117
#  define NOT_REACHED() _assume(0)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   118
# endif /* _DEBUG */
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   119
  int CDECL snprintf(char *str, size_t size, const char *format, ...);
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   120
# if _MSC_VER < 1400
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   121
   int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
1881
023a134a4b12 (svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents: 1812
diff changeset
   122
# endif
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   123
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   124
# if defined(WIN32) && !defined(_WIN64) && !defined(WIN64)
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   125
#  ifndef _W64
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   126
#   define _W64
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   127
#  endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   128
   typedef _W64 int INT_PTR, *PINT_PTR;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   129
   typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   130
# endif /* WIN32 && !_WIN64 && !WIN64 */
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   131
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   132
# if _MSC_VER < 1300 // VC6 and lower
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   133
#  ifdef  _WIN64
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   134
    typedef __int64 intptr_t;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   135
#  else
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   136
    typedef _W64 int intptr_t;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   137
#  endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   138
# endif /* _MSC_VER < 1300 */
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   139
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
# define GCC_PACK
2694
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   141
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   142
// This is needed to zlib uses the stdcall calling convention on visual studio, also used with libpng (VS6 warning)
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   143
# if defined(WITH_ZLIB) || defined(WITH_PNG)
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   144
#  ifndef ZLIB_WINAPI
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   145
#   define ZLIB_WINAPI
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   146
#  endif
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   147
# endif
99d88a9d5337 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   148
2889
ac841003c51e (svn r3442) - Fix: Only windows has stricmp. So define strcasecmp to stricmp when using MSVC
Darkvater
parents: 2731
diff changeset
   149
# define strcasecmp stricmp
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   150
#endif /* defined(_MSC_VER) */
2483
ee0517ddfa92 (svn r3009) DIEEEEEEEEEEE VS6 (you good-for-nothing compiler)
Darkvater
parents: 2482
diff changeset
   151
2482
dffcca243dbc (svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents: 2436
diff changeset
   152
157
dd017fa3bad8 (svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents: 0
diff changeset
   153
// Windows has always LITTLE_ENDIAN
2482
dffcca243dbc (svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents: 2436
diff changeset
   154
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   155
# define TTD_LITTLE_ENDIAN
157
dd017fa3bad8 (svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents: 0
diff changeset
   156
#else
1721
64d59b181596 (svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents: 1317
diff changeset
   157
// Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   158
# if defined(STRGEN)
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   159
#  include "endian_host.h"
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   160
# else
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   161
#  include "endian_target.h"
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   162
# endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   163
#endif /* WIN32 || __OS2__ || WIN64 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
#if defined(UNIX)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   166
# define PATHSEP "/"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   167
#else
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   168
# define PATHSEP "\\"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
typedef unsigned char byte;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
#ifndef __BEOS__ // already defined
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   173
  typedef unsigned char uint8;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   174
  typedef unsigned short uint16;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   175
  typedef unsigned int uint32;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
// This is already defined in unix
2896
44494ae027a6 (svn r3450) - Revert r3448 partly as some mingw's do have uint defined, others don't, so this needs more research
Darkvater
parents: 2894
diff changeset
   179
#if !defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   180
  typedef unsigned int uint;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
#endif
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   182
// Not defined in QNX Neutrino (6.x)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   183
#if defined(__QNXNTO__)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   184
  typedef unsigned int uint;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   185
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   187
#ifndef __BEOS__
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   188
  typedef signed char int8;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   189
  typedef signed short int16;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   190
  typedef signed int int32;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   191
# ifndef __cplusplus
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   192
   typedef unsigned char bool;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   193
# endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   194
  typedef signed __int64 int64;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   195
  typedef unsigned __int64 uint64;
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   196
#endif /* __BEOS__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
9918
a151c4749c7a (svn r3948) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help). Backport of r3529, r3553 from trunk
Darkvater
parents: 2896
diff changeset
   198
#if defined(ARM) || defined(__arm__) || defined(__alpha__)
a151c4749c7a (svn r3948) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help). Backport of r3529, r3553 from trunk
Darkvater
parents: 2896
diff changeset
   199
# define OTTD_ALIGNMENT
a151c4749c7a (svn r3948) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help). Backport of r3529, r3553 from trunk
Darkvater
parents: 2896
diff changeset
   200
#endif
a151c4749c7a (svn r3948) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help). Backport of r3529, r3553 from trunk
Darkvater
parents: 2896
diff changeset
   201
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
// Setup alignment and conversion macros
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
#if defined(TTD_BIG_ENDIAN)
9918
a151c4749c7a (svn r3948) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help). Backport of r3529, r3553 from trunk
Darkvater
parents: 2896
diff changeset
   204
# define OTTD_ALIGNMENT
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   205
  static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); }
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   206
  static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); }
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   207
  static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); }
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   208
  static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   209
# define TO_BE32(x) (x)
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   210
# define TO_BE16(x) (x)
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   211
# define FROM_BE32(x) (x)
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   212
# define FROM_BE16(x) (x)
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   213
# define TO_BE32X(x) (x)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   214
#else
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   215
  static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); }
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   216
  static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); }
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   217
  static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   218
  static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   219
# define TO_LE32(x) (x)
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   220
# define TO_LE16(x) (x)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   221
# define TO_BE32X(x) BSWAP32(x)
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   222
# define FROM_LE32(x) (x)
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   223
# define FROM_LE16(x) (x)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   224
#endif /* TTD_BIG_ENDIAN */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   225
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   226
#if !defined(GAME_DATA_DIR)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   227
# define GAME_DATA_DIR ""
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   230
#if !defined(PERSONAL_DIR)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   231
# define PERSONAL_DIR ""
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
#ifndef __cplusplus
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   235
# ifndef __BEOS__
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   236
   enum {
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   237
    false = 0,
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   238
    true = 1,
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   239
   };
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   240
# endif
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   241
#endif /* __cplusplus */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   242
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
// Compile time assertions
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   244
#ifdef __OS2__
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   245
# define assert_compile(expr)
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   246
#else
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   247
# define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)])
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   248
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   249
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
assert_compile(sizeof(uint32) == 4);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
assert_compile(sizeof(uint16) == 2);
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   252
assert_compile(sizeof(uint8)  == 1);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   254
#define lengthof(x) (sizeof(x)/sizeof(x[0]))
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   255
#define endof(x) (&x[lengthof(x)])
1317
f382f1b439c7 (svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
tron
parents: 1022
diff changeset
   256
#define lastof(x) (&x[lengthof(x) - 1])
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
#ifndef offsetof
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   258
# define offsetof(s,m)   (size_t)&(((s *)0)->m)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   260
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   261
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   262
// take care of some name clashes on macos
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
#if defined(__APPLE__)
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   264
# define GetString OTTD_GetString
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   265
# define DrawString OTTD_DrawString
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   266
# define Random OTTD_Random
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   267
# define CloseConnection OTTD_CloseConnection
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   268
#endif /* __APPLE */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   269
770
89dab23f04ca (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
   270
#ifdef __AMIGA__
569
2e86ae517874 (svn r980) Fixed issues where MorphOS would get problems if AmigaOS would get a port, since MorphOS also have the flag __AMIGA__ defined (Tokai)
bjarni
parents: 543
diff changeset
   271
// it seems AmigaOS already have a Point declared
2485
fd92a70a064a (svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents: 2483
diff changeset
   272
# define Point OTTD_AMIGA_POINT
569
2e86ae517874 (svn r980) Fixed issues where MorphOS would get problems if AmigaOS would get a port, since MorphOS also have the flag __AMIGA__ defined (Tokai)
bjarni
parents: 543
diff changeset
   273
#endif
2e86ae517874 (svn r980) Fixed issues where MorphOS would get problems if AmigaOS would get a port, since MorphOS also have the flag __AMIGA__ defined (Tokai)
bjarni
parents: 543
diff changeset
   274
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2225
diff changeset
   275
#endif /* STDAFX_H */