author | celestar |
Wed, 13 Jun 2007 12:05:56 +0000 | |
branch | gamebalance |
changeset 9912 | 1ac8aac92385 |
parent 9911 | 0b8b245a2391 |
child 9913 | e79cd19772dd |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9909
dce9a6923bb7
(svn r10133) [gamebalance] -Sync: r9620:9670 from trunk
celestar
parents:
9908
diff
changeset
|
3 |
/** @file stdafx.h */ |
9908
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9895
diff
changeset
|
4 |
|
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
|
5 |
#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
|
6 |
#define STDAFX_H |
0 | 7 |
|
6071
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
8 |
/* It seems that we need to include stdint.h before anything else |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
9 |
* We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
10 |
* does not have stdint.h and apparently neither does MorphOS, so define |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
11 |
* INT64_MAX for them ourselves. */ |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
12 |
#if !defined(_MSC_VER) && !defined( __MORPHOS__) |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
13 |
# if defined (SUNOS) |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
14 |
/* SunOS/Solaris does not have stdint.h, but inttypes.h defines everything |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
15 |
* stdint.h defines and we need. */ |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
16 |
# include <inttypes.h> |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
17 |
# else |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
18 |
# define __STDC_LIMIT_MACROS |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
19 |
# include <stdint.h> |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
20 |
# endif |
6071
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
21 |
#else |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
22 |
# define INT64_MAX 9223372036854775807LL |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
23 |
#endif |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
24 |
|
6184
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
25 |
#include <cstdio> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
26 |
#include <cstddef> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
27 |
#include <cstring> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
28 |
#include <cstdlib> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
29 |
#include <climits> |
0 | 30 |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
31 |
/* MacOS X will use an NSAlert to display failed assertaions since they're lost unless running from a terminal |
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
32 |
* 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
|
33 |
#if !defined(__APPLE__) || defined(STRGEN) |
6184
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
34 |
# include <cassert> |
2223
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
35 |
#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
|
36 |
# 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
|
37 |
#endif |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
38 |
|
858
329ff519fb45
(svn r1339) -Fix: compilation with networking works on MinGW32 again (thx orudge).
darkvater
parents:
796
diff
changeset
|
39 |
#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
|
40 |
# include <sys/types.h> |
0 | 41 |
#endif |
42 |
||
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
43 |
#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
|
44 |
# include <types.h> |
4216
c403fc7b6e10
(svn r5760) - Codechange: Use a define for case-string comparison in OS/2 instead of function.
Darkvater
parents:
4000
diff
changeset
|
45 |
# define strcasecmp stricmp |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
46 |
#endif |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
47 |
|
6227
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
48 |
#if defined(PSP) |
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
49 |
# include <psptypes.h> |
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
50 |
# include <pspdebug.h> |
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
51 |
# include <pspthreadman.h> |
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
52 |
#endif /* PSP */ |
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
53 |
|
0 | 54 |
#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
|
55 |
# include <SupportDefs.h> |
0 | 56 |
#endif |
57 |
||
446
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
58 |
#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
|
59 |
# include <alloca.h> |
446
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
60 |
#endif |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
61 |
|
770
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
62 |
#ifdef __MORPHOS__ |
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
63 |
/* MorphOS defines certain Amiga defines per default, we undefine them |
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
64 |
* here to make the rest of source less messy and more clear what is |
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
65 |
* 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
|
66 |
# 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
|
67 |
# 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
|
68 |
# 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
|
69 |
# 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
|
70 |
# 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
|
71 |
# 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
|
72 |
# 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
|
73 |
# 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
|
74 |
# 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
|
75 |
# 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
|
76 |
# 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
|
77 |
# 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
|
78 |
# 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
|
79 |
# 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
|
80 |
# endif |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
81 |
/* Act like we already included this file, as it somehow gives linkage problems |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
82 |
* (mismatch linkage of C++ and C between this include and unistd.h). */ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
83 |
#define CLIB_USERGROUP_PROTOS_H |
770
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
84 |
#endif /* __MORPHOS__ */ |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
85 |
|
3016
c63fb93fa1a0
(svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
bjarni
parents:
2984
diff
changeset
|
86 |
#ifdef __APPLE__ |
3289 | 87 |
# include "os/macosx/osx_stdafx.h" |
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
88 |
/* Make endian swapping use Apple's macros to increase speed (since it will use hardware swapping if available) |
5795
41fd1f439c51
(svn r7887) -Fix: [OSX] Endian32_Swap should always return a uint32, not a long unsigned int
bjarni
parents:
5726
diff
changeset
|
89 |
* Even though they should return uint16 and uint32, we get warnings if we don't cast those (why?) */ |
41fd1f439c51
(svn r7887) -Fix: [OSX] Endian32_Swap should always return a uint32, not a long unsigned int
bjarni
parents:
5726
diff
changeset
|
90 |
# define BSWAP32(x) ((uint32)Endian32_Swap(x)) |
41fd1f439c51
(svn r7887) -Fix: [OSX] Endian32_Swap should always return a uint32, not a long unsigned int
bjarni
parents:
5726
diff
changeset
|
91 |
# define BSWAP16(x) ((uint16)Endian16_Swap(x)) |
3016
c63fb93fa1a0
(svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
bjarni
parents:
2984
diff
changeset
|
92 |
#else |
3289 | 93 |
# define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000)) |
94 |
# define BSWAP16(x) ((x) >> 8 | (x) << 8) |
|
95 |
#endif /* __APPLE__ */ |
|
0 | 96 |
|
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
97 |
#if defined(PSP) |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
98 |
/* PSP can only have 10 file-descriptors open at any given time, but this |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
99 |
* switch only limits reads via the Fio system. So keep 2 fds free for things |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
100 |
* like saving a game. */ |
6227
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
101 |
# define LIMITED_FDS 8 |
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
102 |
# define printf pspDebugScreenPrintf |
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
103 |
#endif /* PSP */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
104 |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
105 |
/* by default we use [] var arrays */ |
0 | 106 |
#define VARARRAY_SIZE |
107 |
||
108 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
109 |
/* Stuff for GCC */ |
0 | 110 |
#if defined(__GNUC__) |
4000
bab1ebc37da0
(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
|
111 |
# define NORETURN __attribute__ ((noreturn)) |
0 | 112 |
# define FORCEINLINE inline |
113 |
# define CDECL |
|
114 |
# define __int64 long long |
|
115 |
# define GCC_PACK __attribute__((packed)) |
|
116 |
||
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
|
117 |
# if (__GNUC__ == 2) |
0 | 118 |
# undef VARARRAY_SIZE |
119 |
# define VARARRAY_SIZE 0 |
|
120 |
# 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
|
121 |
#endif /* __GNUC__ */ |
0 | 122 |
|
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
123 |
#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
|
124 |
# 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
|
125 |
# 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
|
126 |
# 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
|
127 |
# 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
|
128 |
# 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
|
129 |
#endif /* __WATCOMC__ */ |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
130 |
|
796 | 131 |
#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
|
132 |
# include <malloc.h> // alloca() |
796 | 133 |
#endif |
134 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
135 |
/* Stuff for MSVC */ |
0 | 136 |
#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
|
137 |
# pragma once |
6520
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
138 |
/* Define a win32 target platform, to override defaults of the SDK |
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
139 |
* We need to define NTDDI version for Vista SDK, but win2k is minimum */ |
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
140 |
# define NTDDI_VERSION NTDDI_WIN2K // Windows 2000 |
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
141 |
# define _WIN32_WINNT 0x0500 // Windows 2000 |
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
142 |
|
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
143 |
# define _WIN32_WINDOWS 0x400 // Windows 95 |
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
144 |
# define WINVER 0x0400 // Windows NT 4.0 / Windows 95 |
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
145 |
# define _WIN32_IE_ 0x0401 // 4.01 (win98 and NT4SP5+) |
c35345c0897d
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6409
diff
changeset
|
146 |
|
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
|
147 |
# 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
|
148 |
# 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
|
149 |
# pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5795
diff
changeset
|
150 |
# pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union |
5120
e12dfc67761f
(svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
Darkvater
parents:
5082
diff
changeset
|
151 |
|
2976
a89ead6e2247
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
152 |
# if _MSC_VER >= 1400 // MSVC 2005 safety checks |
a89ead6e2247
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
153 |
# pragma warning(disable: 4996) // 'strdup' was declared deprecated |
a89ead6e2247
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
154 |
# define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions |
6186
8232b762d596
(svn r8574) -Fix: Silence VC2003 warning: "compiler limit : terminating debug information emission for enum 'StringIdEnum'"
KUDr
parents:
6185
diff
changeset
|
155 |
# else /* _MSC_VER >= 1400 ( <1400 for MSVC2003) */ |
8232b762d596
(svn r8574) -Fix: Silence VC2003 warning: "compiler limit : terminating debug information emission for enum 'StringIdEnum'"
KUDr
parents:
6185
diff
changeset
|
156 |
# pragma warning(disable: 4292) // compiler limit : terminating debug information emission for enum 'StringIdEnum' with member 'STR_801D_COAL_CAR' |
2976
a89ead6e2247
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
157 |
# 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
|
158 |
|
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
|
159 |
# include <malloc.h> // alloca() |
0 | 160 |
# 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
|
161 |
# 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
|
162 |
# 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
|
163 |
# define CDECL _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
|
164 |
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
|
165 |
# 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
|
166 |
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
|
167 |
# 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
|
168 |
|
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
|
169 |
# 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
|
170 |
# 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
|
171 |
# 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
|
172 |
# 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
|
173 |
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
|
174 |
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
|
175 |
# 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
|
176 |
|
0 | 177 |
# define GCC_PACK |
2694
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
178 |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
179 |
/* This is needed to zlib uses the stdcall calling convention on visual studio */ |
2694
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
180 |
# 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
|
181 |
# ifndef ZLIB_WINAPI |
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
182 |
# define ZLIB_WINAPI |
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
183 |
# endif |
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
184 |
# endif |
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
185 |
|
2889
ac841003c51e
(svn r3442) - Fix: Only windows has stricmp. So define strcasecmp to stricmp when using MSVC
Darkvater
parents:
2731
diff
changeset
|
186 |
# define strcasecmp stricmp |
4316
aa8116c33774
(svn r5969) -Fix r5968: windows doesn't know strncasecmp, but called it strnicmp (michi_cc)
truelight
parents:
4221
diff
changeset
|
187 |
# define strncasecmp strnicmp |
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
188 |
/* suppress: warning C4005: 'offsetof' : macro redefinition (VC8) */ |
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
|
189 |
#endif /* defined(_MSC_VER) */ |
2483
ee0517ddfa92
(svn r3009) DIEEEEEEEEEEE VS6 (you good-for-nothing compiler)
Darkvater
parents:
2482
diff
changeset
|
190 |
|
6006
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
191 |
#if defined(WINCE) |
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
192 |
# define strdup _strdup |
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
193 |
#endif /* WINCE */ |
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
194 |
|
5167
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
195 |
/* NOTE: the string returned by these functions is only valid until the next |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
196 |
* call to the same function and is not thread- or reentrancy-safe */ |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
197 |
#if !defined(STRGEN) |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
198 |
# if defined(WIN32) || defined(WIN64) |
9912
1ac8aac92385
(svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
celestar
parents:
9911
diff
changeset
|
199 |
char *getcwd(char *buf, size_t size); |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
200 |
# include <tchar.h> |
6006
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
201 |
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */ |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
202 |
# if !defined(WINCE) |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
203 |
# define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode)) |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
204 |
# endif /* WINCE */ |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
205 |
|
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
206 |
const char *FS2OTTD(const TCHAR *name); |
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
207 |
const TCHAR *OTTD2FS(const char *name); |
5167
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
208 |
# else |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6520
diff
changeset
|
209 |
|
5167
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
210 |
# define fopen(file, mode) fopen(OTTD2FS(file), mode) |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
211 |
const char *FS2OTTD(const char *name); |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
212 |
const char *OTTD2FS(const char *name); |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
213 |
# endif /* WIN32 */ |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
214 |
#endif /* STRGEN */ |
2482
dffcca243dbc
(svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents:
2436
diff
changeset
|
215 |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
216 |
/* Windows has always LITTLE_ENDIAN */ |
2482
dffcca243dbc
(svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents:
2436
diff
changeset
|
217 |
#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
|
218 |
# define TTD_LITTLE_ENDIAN |
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
0
diff
changeset
|
219 |
#else |
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
220 |
/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */ |
4563
f25cb91c5f14
(svn r6411) -Fix(r6410): forgot to update openttd*.sln (thx Darkvater and michi_cc :) )
glx
parents:
4379
diff
changeset
|
221 |
# if 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
|
222 |
# 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
|
223 |
# 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
|
224 |
# 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
|
225 |
# 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
|
226 |
#endif /* WIN32 || __OS2__ || WIN64 */ |
0 | 227 |
|
5842
180c71b8fc14
(svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge
parents:
5838
diff
changeset
|
228 |
#if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) |
4379
2866185c1377
(svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents:
4316
diff
changeset
|
229 |
# define PATHSEP "\\" |
2866185c1377
(svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents:
4316
diff
changeset
|
230 |
# define PATHSEPCHAR '\\' |
2866185c1377
(svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents:
4316
diff
changeset
|
231 |
#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
|
232 |
# define PATHSEP "/" |
4221
bb06fe8dcce2
(svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents:
4216
diff
changeset
|
233 |
# define PATHSEPCHAR '/' |
0 | 234 |
#endif |
235 |
||
236 |
typedef unsigned char byte; |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
237 |
#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
|
238 |
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
|
239 |
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
|
240 |
typedef unsigned int uint32; |
0 | 241 |
#endif |
242 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
243 |
/* This is already defined in unix */ |
5551
5cc56d0e6f5f
(svn r7548) -Codechange: Some MorphOS changes to get OpenTTD compiled, packaged (tokai)
Darkvater
parents:
5167
diff
changeset
|
244 |
#if !defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) && !defined(__MORPHOS__) |
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 |
typedef unsigned int uint; |
0 | 246 |
#endif |
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
247 |
/* Not defined in QNX Neutrino (6.x) */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
248 |
#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
|
249 |
typedef unsigned int uint; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
250 |
#endif |
0 | 251 |
|
252 |
#ifndef __BEOS__ |
|
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
253 |
typedef signed char int8; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
254 |
typedef signed short int16; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
255 |
typedef signed int int32; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
256 |
typedef signed __int64 int64; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
257 |
typedef unsigned __int64 uint64; |
6409
55217fea8342
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
6227
diff
changeset
|
258 |
#endif /* !__BEOS__ */ |
0 | 259 |
|
2978
1a04b74b61ae
(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
|
260 |
#if defined(ARM) || defined(__arm__) || defined(__alpha__) |
1a04b74b61ae
(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
|
261 |
# define OTTD_ALIGNMENT |
1a04b74b61ae
(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
|
262 |
#endif |
1a04b74b61ae
(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
|
263 |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
264 |
/* Setup alignment and conversion macros */ |
0 | 265 |
#if defined(TTD_BIG_ENDIAN) |
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
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); } |
2984
225bffc79071
(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
|
270 |
# define TO_BE32(x) (x) |
225bffc79071
(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
|
271 |
# define TO_BE16(x) (x) |
2639 | 272 |
# define FROM_BE32(x) (x) |
273 |
# define FROM_BE16(x) (x) |
|
2984
225bffc79071
(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
|
274 |
# define TO_LE32X(x) BSWAP32(x) |
225bffc79071
(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
|
275 |
# define TO_BE32X(x) (x) |
0 | 276 |
#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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); } |
2984
225bffc79071
(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
|
281 |
# define TO_LE32(x) (x) |
225bffc79071
(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
|
282 |
# define TO_LE16(x) (x) |
2639 | 283 |
# define FROM_LE32(x) (x) |
284 |
# define FROM_LE16(x) (x) |
|
2984
225bffc79071
(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
|
285 |
# define TO_LE32X(x) (x) |
225bffc79071
(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
|
286 |
# define TO_BE32X(x) BSWAP32(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
|
287 |
#endif /* TTD_BIG_ENDIAN */ |
0 | 288 |
|
289 |
#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
|
290 |
# define GAME_DATA_DIR "" |
0 | 291 |
#endif |
292 |
||
293 |
#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
|
294 |
# define PERSONAL_DIR "" |
0 | 295 |
#endif |
296 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
297 |
/* Compile time assertions */ |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
298 |
#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
|
299 |
# define assert_compile(expr) |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
300 |
#else |
6409
55217fea8342
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
6227
diff
changeset
|
301 |
# define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)]) |
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
302 |
#endif /* __OS2__ */ |
0 | 303 |
|
304 |
assert_compile(sizeof(uint32) == 4); |
|
305 |
assert_compile(sizeof(uint16) == 2); |
|
2639 | 306 |
assert_compile(sizeof(uint8) == 1); |
0 | 307 |
|
308 |
#define lengthof(x) (sizeof(x)/sizeof(x[0])) |
|
309 |
#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
|
310 |
#define lastof(x) (&x[lengthof(x) - 1]) |
5922
510e1bbc5992
(svn r8131) -Fix (r8125): g++ warning: 'invalid access to non-static data member ?<class>::<member>? of NULL object'. It is weird, but renaming the 'offsetof' macro helped.
KUDr
parents:
5842
diff
changeset
|
311 |
|
6409
55217fea8342
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
6227
diff
changeset
|
312 |
#define cpp_offsetof(s,m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8) |
55217fea8342
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
6227
diff
changeset
|
313 |
#ifndef offsetof |
6198
d1f995c47d7c
(svn r8613) -Fix [MorphOS]: offsetof() macro undefined for MorphOS build
KUDr
parents:
6186
diff
changeset
|
314 |
# define offsetof(s,m) cpp_offsetof(s, m) |
6409
55217fea8342
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
6227
diff
changeset
|
315 |
#endif /* offsetof */ |
0 | 316 |
|
317 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
318 |
/* take care of some name clashes on MacOS */ |
0 | 319 |
#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
|
320 |
# 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
|
321 |
# 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
|
322 |
# 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
|
323 |
# 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
|
324 |
#endif /* __APPLE */ |
0 | 325 |
|
770
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
326 |
#ifdef __AMIGA__ |
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
327 |
/* 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
|
328 |
# 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
|
329 |
#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
|
330 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
331 |
void |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
332 |
#ifndef STRGEN |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
333 |
/* In strgen error is not fatal and returns */ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
334 |
NORETURN |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
335 |
#endif /* STRGEN */ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
336 |
CDECL error(const char *str, ...); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
337 |
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__) |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
338 |
|
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
|
339 |
#endif /* STDAFX_H */ |