stdafx.h
author Darkvater
Mon, 31 Jul 2006 22:40:55 +0000
changeset 4204 3aa39be759f2
parent 4000 4009d092b306
child 4216 0b1f4832c358
permissions -rw-r--r--
(svn r5688) - Forward-port the release-changes from the 0.4 branch back to trunk. This ensures an updated changelog, known-bugs, etc.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     2
2436
7d5df545bd5d (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
7d5df545bd5d (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
3624
229c83c81efa (svn r4522) -Fix: include stdio before stddef; some targets don't like the other way around.
truelight
parents: 3584
diff changeset
     6
#include <stdio.h>
3584
1af7d6e9d1ba (svn r4470) -Fix: FS#97 ? Possible bug in Win64 versions (by michi_cc)
KUDr
parents: 3582
diff changeset
     7
#include <stddef.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
#include <string.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
#include <stdlib.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
2223
b9564d70ec3d (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    11
// MacOS X will use an NSAlert to display failed assertaions since they're lost unless running from a terminal
2225
f6ac54bad028 (svn r2745) -Fix: [OSX] removed the assert window introduced in 2741 from strgen
bjarni
parents: 2223
diff changeset
    12
// strgen always runs from terminal and don't need a window for asserts
2731
888a994e9fe9 (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
    13
#if !defined(__APPLE__) || defined(STRGEN)
2485
3e83ba6adf27 (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
    14
# include <assert.h>
2223
b9564d70ec3d (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    15
#else
2485
3e83ba6adf27 (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
    16
# include "os/macosx/macos.h"
2223
b9564d70ec3d (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    17
#endif
b9564d70ec3d (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    18
858
9a3254670831 (svn r1339) -Fix: compilation with networking works on MinGW32 again (thx orudge).
darkvater
parents: 796
diff changeset
    19
#if defined(UNIX) || defined(__MINGW32__)
2485
3e83ba6adf27 (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
    20
# include <sys/types.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    23
#if defined(__OS2__)
2485
3e83ba6adf27 (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
    24
# include <types.h>
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    25
#endif
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    26
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
#ifdef __BEOS__
2485
3e83ba6adf27 (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
    28
# include <SupportDefs.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
446
7a92ca9738e2 (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    31
#ifdef SUNOS
2485
3e83ba6adf27 (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
    32
# include <alloca.h>
446
7a92ca9738e2 (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    33
#endif
7a92ca9738e2 (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    34
770
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    35
#ifdef __MORPHOS__
915
d845fe7cf6f2 (svn r1402) Trim trailing whitespace
tron
parents: 858
diff changeset
    36
// morphos defines certain amiga defines per default, we undefine them
770
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    37
// here to make the rest of source less messy and more clear what is
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    38
// required for morphos and what for amigaos
2485
3e83ba6adf27 (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
# ifdef amigaos
3e83ba6adf27 (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
#  undef amigaos
3e83ba6adf27 (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
# endif
3e83ba6adf27 (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
# ifdef __amigaos__
3e83ba6adf27 (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
#  undef __amigaos__
3e83ba6adf27 (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
# endif
3e83ba6adf27 (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
# ifdef __AMIGA__
3e83ba6adf27 (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
#  undef __AMIGA__
3e83ba6adf27 (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
# endif
3e83ba6adf27 (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
# ifdef AMIGA
3e83ba6adf27 (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
#  undef AMIGA
3e83ba6adf27 (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
# endif
3e83ba6adf27 (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
# ifdef amiga
3e83ba6adf27 (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
#  undef amiga
3e83ba6adf27 (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
    53
# endif
770
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    54
#endif /* __MORPHOS__ */
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
    55
3016
958672b0f8e2 (svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
bjarni
parents: 2984
diff changeset
    56
#ifdef __APPLE__
3289
0ec00b2d14dc (svn r4003) - Minor codebeautifier@work
Darkvater
parents: 3016
diff changeset
    57
# include "os/macosx/osx_stdafx.h"
3016
958672b0f8e2 (svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
bjarni
parents: 2984
diff changeset
    58
// make endian swapping use Apple's macros to increase speed
3289
0ec00b2d14dc (svn r4003) - Minor codebeautifier@work
Darkvater
parents: 3016
diff changeset
    59
# define BSWAP32(x) Endian32_Swap(x)
0ec00b2d14dc (svn r4003) - Minor codebeautifier@work
Darkvater
parents: 3016
diff changeset
    60
# define BSWAP16(x) Endian16_Swap(x)
3016
958672b0f8e2 (svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
bjarni
parents: 2984
diff changeset
    61
#else
3289
0ec00b2d14dc (svn r4003) - Minor codebeautifier@work
Darkvater
parents: 3016
diff changeset
    62
# define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000))
0ec00b2d14dc (svn r4003) - Minor codebeautifier@work
Darkvater
parents: 3016
diff changeset
    63
# define BSWAP16(x) ((x) >> 8 | (x) << 8)
0ec00b2d14dc (svn r4003) - Minor codebeautifier@work
Darkvater
parents: 3016
diff changeset
    64
#endif /* __APPLE__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
// by default we use [] var arrays
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
#define VARARRAY_SIZE
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
// Stuff for GCC
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
#if defined(__GNUC__)
4000
4009d092b306 (svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents: 3900
diff changeset
    72
# define NORETURN __attribute__ ((noreturn))
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    73
# define FORCEINLINE inline
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
# define CDECL
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    75
# define __int64 long long
1881
435d39bd6ee0 (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
    76
# define NOT_REACHED() assert(0)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
# define GCC_PACK __attribute__((packed))
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
2485
3e83ba6adf27 (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
    79
# if (__GNUC__ == 2)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
#  undef VARARRAY_SIZE
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
#  define VARARRAY_SIZE 0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
# endif
2485
3e83ba6adf27 (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
#endif /* __GNUC__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    85
#if defined(__WATCOMC__)
2485
3e83ba6adf27 (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
# define NORETURN
3e83ba6adf27 (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
    87
# define FORCEINLINE inline
3e83ba6adf27 (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
    88
# define CDECL
3e83ba6adf27 (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
# define NOT_REACHED() assert(0)
3e83ba6adf27 (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
    90
# define GCC_PACK
3e83ba6adf27 (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
    91
# include <malloc.h>
3e83ba6adf27 (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
    92
#endif /* __WATCOMC__ */
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    93
796
ffa693752831 (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
    94
#if defined(__MINGW32__) || defined(__CYGWIN__)
2485
3e83ba6adf27 (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
    95
# include <malloc.h> // alloca()
796
ffa693752831 (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
    96
#endif
ffa693752831 (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
    97
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
// Stuff for MSVC
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    99
#if defined(_MSC_VER)
2695
cb39a85e267f (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 once
cb39a85e267f (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
# define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
cb39a85e267f (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
   102
# pragma warning(disable: 4244)  // 'conversion' conversion from 'type1' to 'type2', possible loss of data
cb39a85e267f (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
   103
# pragma warning(disable: 4761)  // integral size mismatch in argument : conversion supplied
cb39a85e267f (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
   104
# if _MSC_VER < 1300             // MSVC 6 borkdness
cb39a85e267f (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
   105
#  pragma warning(disable: 4018) // 'expression' : signed/unsigned mismatch
cb39a85e267f (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
   106
#  pragma warning(disable: 4305) // 'identifier' : truncation from 'type1' to 'type2'
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   107
#  pragma warning(disable: 4786) // 'identifier' : identifier was truncated to '255' characters in the browser information
2695
cb39a85e267f (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
# endif /* _MSC_VER < 1300 */
2976
06d8d0b8dad7 (svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents: 2974
diff changeset
   109
# if _MSC_VER >= 1400              // MSVC 2005 safety checks
06d8d0b8dad7 (svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents: 2974
diff changeset
   110
#  pragma warning(disable: 4996)   // 'strdup' was declared deprecated
06d8d0b8dad7 (svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents: 2974
diff changeset
   111
#  define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
06d8d0b8dad7 (svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents: 2974
diff changeset
   112
#  pragma comment(linker, "/NODEFAULTLIB:LIBC.LIB")
06d8d0b8dad7 (svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents: 2974
diff changeset
   113
                                   // allow linking to non-recompiled libs
06d8d0b8dad7 (svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents: 2974
diff changeset
   114
# endif /* _MSC_VER >= 1400 */
2695
cb39a85e267f (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
   115
2485
3e83ba6adf27 (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
   116
# include <malloc.h> // alloca()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   117
# define NORETURN __declspec(noreturn)
2485
3e83ba6adf27 (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
# define FORCEINLINE __forceinline
3e83ba6adf27 (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
# define inline _inline
3e83ba6adf27 (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
# define CDECL _cdecl
1881
435d39bd6ee0 (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
   121
# if defined(_DEBUG)
435d39bd6ee0 (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
#  define NOT_REACHED() assert(0)
435d39bd6ee0 (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
   123
# else
435d39bd6ee0 (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
   124
#  define NOT_REACHED() _assume(0)
2485
3e83ba6adf27 (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
# endif /* _DEBUG */
3e83ba6adf27 (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
  int CDECL snprintf(char *str, size_t size, const char *format, ...);
3e83ba6adf27 (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
# if _MSC_VER < 1400
3e83ba6adf27 (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
   int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
1881
435d39bd6ee0 (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
   129
# endif
2485
3e83ba6adf27 (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
3e83ba6adf27 (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
# if defined(WIN32) && !defined(_WIN64) && !defined(WIN64)
3e83ba6adf27 (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
#  ifndef _W64
3e83ba6adf27 (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
#   define _W64
3e83ba6adf27 (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
#  endif
3e83ba6adf27 (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
   typedef _W64 int INT_PTR, *PINT_PTR;
3e83ba6adf27 (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 unsigned int UINT_PTR, *PUINT_PTR;
3e83ba6adf27 (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 /* WIN32 && !_WIN64 && !WIN64 */
3e83ba6adf27 (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
3e83ba6adf27 (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
# if _MSC_VER < 1300 // VC6 and lower
3e83ba6adf27 (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
   140
#  ifdef  _WIN64
3e83ba6adf27 (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
   141
    typedef __int64 intptr_t;
3e83ba6adf27 (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
   142
#  else
3e83ba6adf27 (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
   143
    typedef _W64 int intptr_t;
3e83ba6adf27 (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
   144
#  endif
3e83ba6adf27 (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
   145
# endif /* _MSC_VER < 1300 */
3e83ba6adf27 (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
   146
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
# define GCC_PACK
2694
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   148
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   149
// This is needed to zlib uses the stdcall calling convention on visual studio, also used with libpng (VS6 warning)
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   150
# if defined(WITH_ZLIB) || defined(WITH_PNG)
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   151
#  ifndef ZLIB_WINAPI
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   152
#   define ZLIB_WINAPI
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   153
#  endif
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   154
# endif
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   155
2889
461c25e6cc1b (svn r3442) - Fix: Only windows has stricmp. So define strcasecmp to stricmp when using MSVC
Darkvater
parents: 2731
diff changeset
   156
# define strcasecmp stricmp
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   157
// suppress: warning C4005: 'offsetof' : macro redefinition (VC8)
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   158
# include <stddef.h>
2485
3e83ba6adf27 (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
#endif /* defined(_MSC_VER) */
2483
e2d5f55daf63 (svn r3009) DIEEEEEEEEEEE VS6 (you good-for-nothing compiler)
Darkvater
parents: 2482
diff changeset
   160
2482
374f6395847d (svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents: 2436
diff changeset
   161
157
dd017fa3bad8 (svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents: 0
diff changeset
   162
// Windows has always LITTLE_ENDIAN
2482
374f6395847d (svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents: 2436
diff changeset
   163
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
2485
3e83ba6adf27 (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
   164
# define TTD_LITTLE_ENDIAN
157
dd017fa3bad8 (svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents: 0
diff changeset
   165
#else
1721
e2887b445ac0 (svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents: 1317
diff changeset
   166
// Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   167
# if defined(STRGEN) || defined(UNITTEST)
2485
3e83ba6adf27 (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
#  include "endian_host.h"
3e83ba6adf27 (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
   169
# else
3e83ba6adf27 (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
   170
#  include "endian_target.h"
3e83ba6adf27 (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
   171
# endif
3e83ba6adf27 (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
   172
#endif /* WIN32 || __OS2__ || WIN64 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
#if defined(UNIX)
2485
3e83ba6adf27 (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
# define PATHSEP "/"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
#else
2485
3e83ba6adf27 (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
   177
# define PATHSEP "\\"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
typedef unsigned char byte;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
#ifndef __BEOS__ // already defined
2485
3e83ba6adf27 (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
   182
  typedef unsigned char uint8;
3e83ba6adf27 (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
   183
  typedef unsigned short uint16;
3e83ba6adf27 (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 uint32;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
#endif
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
// This is already defined in unix
2896
5db6533e9977 (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
   188
#if !defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__)
2485
3e83ba6adf27 (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 unsigned int uint;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
#endif
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   191
// Not defined in QNX Neutrino (6.x)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   192
#if defined(__QNXNTO__)
2485
3e83ba6adf27 (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
  typedef unsigned int uint;
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   194
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
#ifndef __BEOS__
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   197
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   198
// some platforms use 4 bytes bool in C++
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   199
// C bool has to be the same
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   200
#	ifndef __cplusplus
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   201
#		ifdef FOUR_BYTE_BOOL
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   202
			typedef unsigned long bool;
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   203
#		else /* FOUR_BYTE_BOOL */
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   204
			typedef unsigned char bool;
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   205
#		endif /* FOUR_BYTE_BOOL */
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   206
#	endif /* __cplusplus */
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   207
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   208
	typedef signed char int8;
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   209
	typedef signed short int16;
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   210
	typedef signed int int32;
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   211
	typedef signed __int64 int64;
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   212
	typedef unsigned __int64 uint64;
2485
3e83ba6adf27 (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
   213
#endif /* __BEOS__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   214
2978
a67025958ebb (svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents: 2976
diff changeset
   215
#if defined(ARM) || defined(__arm__) || defined(__alpha__)
a67025958ebb (svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents: 2976
diff changeset
   216
# define OTTD_ALIGNMENT
a67025958ebb (svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents: 2976
diff changeset
   217
#endif
a67025958ebb (svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents: 2976
diff changeset
   218
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
// Setup alignment and conversion macros
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   220
#if defined(TTD_BIG_ENDIAN)
2485
3e83ba6adf27 (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
  static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); }
3e83ba6adf27 (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
   222
  static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); }
3e83ba6adf27 (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
   223
  static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); }
3e83ba6adf27 (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
  static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
2984
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   225
# define TO_BE32(x)   (x)
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   226
# define TO_BE16(x)   (x)
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   227
# define FROM_BE32(x) (x)
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   228
# define FROM_BE16(x) (x)
2984
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   229
# define TO_LE32X(x)  BSWAP32(x)
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   230
# define TO_BE32X(x)  (x)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
#else
2485
3e83ba6adf27 (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
   232
  static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); }
3e83ba6adf27 (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
   233
  static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); }
3e83ba6adf27 (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
   234
  static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
3e83ba6adf27 (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
  static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
2984
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   236
# define TO_LE32(x)   (x)
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   237
# define TO_LE16(x)   (x)
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   238
# define FROM_LE32(x) (x)
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   239
# define FROM_LE16(x) (x)
2984
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   240
# define TO_LE32X(x)  (x)
f9d92e013486 (svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents: 2980
diff changeset
   241
# define TO_BE32X(x)  BSWAP32(x)
2485
3e83ba6adf27 (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
   242
#endif /* TTD_BIG_ENDIAN */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   244
#if !defined(GAME_DATA_DIR)
2485
3e83ba6adf27 (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 GAME_DATA_DIR ""
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   247
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   248
#if !defined(PERSONAL_DIR)
2485
3e83ba6adf27 (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
   249
# define PERSONAL_DIR ""
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   252
#ifndef __cplusplus
2485
3e83ba6adf27 (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
   253
# ifndef __BEOS__
3e83ba6adf27 (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
   254
   enum {
3e83ba6adf27 (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
   255
    false = 0,
3e83ba6adf27 (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
   256
    true = 1,
3e83ba6adf27 (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
   257
   };
3e83ba6adf27 (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
# endif
3e83ba6adf27 (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
   259
#endif /* __cplusplus */
0
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
// Compile time assertions
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   262
#ifdef __OS2__
2485
3e83ba6adf27 (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
   263
# define assert_compile(expr)
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   264
#else
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   265
# ifdef __cplusplus
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   266
#  define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)])
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   267
# else /* __cplusplus */
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   268
#  define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)])
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   269
# endif /* !__cplusplus */
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   270
#endif /* __OS2__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   271
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   272
assert_compile(sizeof(uint32) == 4);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   273
assert_compile(sizeof(uint16) == 2);
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   274
assert_compile(sizeof(uint8)  == 1);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   275
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   276
#define lengthof(x) (sizeof(x)/sizeof(x[0]))
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   277
#define endof(x) (&x[lengthof(x)])
1317
3c90086ff34f (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
   278
#define lastof(x) (&x[lengthof(x) - 1])
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   279
#ifndef offsetof
2485
3e83ba6adf27 (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
   280
# 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
   281
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   282
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   283
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   284
// take care of some name clashes on macos
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   285
#if defined(__APPLE__)
2485
3e83ba6adf27 (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
   286
# define GetString OTTD_GetString
3e83ba6adf27 (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
   287
# define DrawString OTTD_DrawString
3e83ba6adf27 (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
   288
# define Random OTTD_Random
3e83ba6adf27 (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
   289
# define CloseConnection OTTD_CloseConnection
3e83ba6adf27 (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
   290
#endif /* __APPLE */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   291
770
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
   292
#ifdef __AMIGA__
569
1e1755ba1572 (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
   293
// it seems AmigaOS already have a Point declared
2485
3e83ba6adf27 (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
   294
# define Point OTTD_AMIGA_POINT
569
1e1755ba1572 (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
   295
#endif
1e1755ba1572 (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
   296
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   297
#define EXTERN_C_BEGIN extern "C" {
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   298
#define EXTERN_C_END   }
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   299
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   300
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   301
// workaround for VC6 bug: Error C2258 and error C2252 occur if you try
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   302
//  to perform in-place initialization of static const integral member
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   303
//  data in Visual C++ (see http://support.microsoft.com/kb/241569/)
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   304
#if defined(_MSC_VER) && (_MSC_VER < 1300)
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   305
# define ST_CONST(type, name_val) enum {name_val};
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   306
#else
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   307
# define ST_CONST(type, name_val) static const type name_val;
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   308
#endif
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   309
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   310
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2225
diff changeset
   311
#endif /* STDAFX_H */