author | tron |
Fri, 29 Jul 2005 18:22:04 +0000 | |
changeset 2230 | e461b07aead7 |
parent 2225 | f6ac54bad028 |
child 2436 | 7d5df545bd5d |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#if !defined(_STDAFX_H) |
4 |
#define _STDAFX_H |
|
5 |
||
6 |
#if defined(_MSC_VER) |
|
7 |
#pragma once |
|
8 |
||
9 |
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
|
10 |
#pragma warning(disable: 4100) // parameter not used |
|
11 |
#pragma warning(disable: 4244) // conversion |
|
12 |
#pragma warning(disable: 4245) // conversion |
|
2051 | 13 |
#pragma warning(disable: 4305) // 'initializing' : truncation from 'const int ' to 'char ' |
2125
edc17858f9f6
(svn r2635) Fix: [ntp/misc] Improve the old pathfinder. Changed it to A* instead of Dijkstra.
ludde
parents:
2107
diff
changeset
|
14 |
#pragma warning(disable: 4018) // warning C4018: '==' : signed/unsigned mismatch |
0 | 15 |
#pragma warning(disable: 4201) // nameless union |
16 |
#pragma warning(disable: 4514) // removed unref inline |
|
17 |
#pragma warning(disable: 4127) // constant conditional expression |
|
18 |
#pragma warning(disable: 4276) // MSVC BUG??? Complains about function body not declared when using function pointers |
|
19 |
#pragma warning(disable: 4761) // warning C4761: integral size mismatch in argument; conversion supplied |
|
20 |
#endif |
|
21 |
||
22 |
#include <stdio.h> |
|
23 |
#include <string.h> |
|
24 |
#include <stdlib.h> |
|
25 |
||
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
26 |
// 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
|
27 |
// strgen always runs from terminal and don't need a window for asserts |
f6ac54bad028
(svn r2745) -Fix: [OSX] removed the assert window introduced in 2741 from strgen
bjarni
parents:
2223
diff
changeset
|
28 |
#if !defined(__APPLE__) || defined(STRGEN) |
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
29 |
#include <assert.h> |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
30 |
#else |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
31 |
#include "os/macosx/macos.h" |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
32 |
#endif |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
33 |
|
858
9a3254670831
(svn r1339) -Fix: compilation with networking works on MinGW32 again (thx orudge).
darkvater
parents:
796
diff
changeset
|
34 |
#if defined(UNIX) || defined(__MINGW32__) |
0 | 35 |
# include <sys/types.h> |
36 |
#endif |
|
37 |
||
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
38 |
#if defined(__OS2__) |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
39 |
# include <types.h> |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
40 |
#endif |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
41 |
|
0 | 42 |
#ifdef __BEOS__ |
43 |
#include <SupportDefs.h> |
|
44 |
#endif |
|
45 |
||
446
7a92ca9738e2
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
46 |
#ifdef SUNOS |
7a92ca9738e2
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
47 |
#include <alloca.h> |
7a92ca9738e2
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
48 |
#endif |
7a92ca9738e2
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
49 |
|
770
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
50 |
#ifdef __MORPHOS__ |
915 | 51 |
// 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
|
52 |
// 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
|
53 |
// required for morphos and what for amigaos |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
54 |
# ifdef amigaos |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
55 |
# undef amigaos |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
56 |
# endif |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
57 |
# ifdef __amigaos__ |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
58 |
# undef __amigaos__ |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
59 |
# endif |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
60 |
# ifdef __AMIGA__ |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
61 |
# undef __AMIGA__ |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
62 |
# endif |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
63 |
# ifdef AMIGA |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
64 |
# undef AMIGA |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
65 |
# endif |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
66 |
# ifdef amiga |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
67 |
# undef amiga |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
68 |
# endif |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
69 |
#endif /* __MORPHOS__ */ |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
70 |
|
0 | 71 |
#define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000)) |
72 |
#define BSWAP16(x) ((x) >> 8 | (x) << 8) |
|
73 |
||
74 |
// by default we use [] var arrays |
|
75 |
#define VARARRAY_SIZE |
|
76 |
||
77 |
||
78 |
// Stuff for GCC |
|
79 |
#if defined(__GNUC__) |
|
80 |
# define NORETURN |
|
81 |
# define FORCEINLINE inline |
|
82 |
# define CDECL |
|
83 |
//#include <alloca.h> |
|
84 |
//#include <malloc.h> |
|
85 |
# 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
|
86 |
# define NOT_REACHED() assert(0) |
0 | 87 |
# define GCC_PACK __attribute__((packed)) |
88 |
||
89 |
# if (__GNUC__ == 2) |
|
90 |
# undef VARARRAY_SIZE |
|
91 |
# define VARARRAY_SIZE 0 |
|
92 |
# endif |
|
93 |
#endif |
|
94 |
||
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
95 |
#if defined(__WATCOMC__) |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
96 |
# define NORETURN |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
97 |
# define FORCEINLINE inline |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
98 |
# define 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
|
99 |
# define NOT_REACHED() assert(0) |
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
100 |
# define GCC_PACK |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
101 |
# undef TTD_ALIGNMENT_4 |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
102 |
# undef TTD_ALIGNMENT_2 |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
103 |
|
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
104 |
# include <malloc.h> |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
105 |
#endif |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
106 |
|
796 | 107 |
#if defined(__MINGW32__) || defined(__CYGWIN__) |
108 |
#include <malloc.h> // alloca() |
|
109 |
#endif |
|
110 |
||
0 | 111 |
// Stuff for MSVC |
112 |
#if defined(_MSC_VER) |
|
113 |
# include <malloc.h> // alloca() |
|
114 |
# define NORETURN __declspec(noreturn) |
|
115 |
# define FORCEINLINE __forceinline |
|
500
8e52f7797b48
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
116 |
# define inline _inline |
0 | 117 |
# 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
|
118 |
# 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
|
119 |
# 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
|
120 |
# 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
|
121 |
# define NOT_REACHED() _assume(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
|
122 |
# endif |
1022
d5ec3467d2a4
(svn r1523) -Fix: somehow mousewheel was disabled on windows using SDL; reenabled again
darkvater
parents:
915
diff
changeset
|
123 |
int CDECL snprintf(char *str, size_t size, const char *format, ...); |
d5ec3467d2a4
(svn r1523) -Fix: somehow mousewheel was disabled on windows using SDL; reenabled again
darkvater
parents:
915
diff
changeset
|
124 |
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap); |
0 | 125 |
# undef TTD_ALIGNMENT_4 |
126 |
# undef TTD_ALIGNMENT_2 |
|
127 |
# define GCC_PACK |
|
128 |
#endif |
|
129 |
||
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
0
diff
changeset
|
130 |
// Windows has always LITTLE_ENDIAN |
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
131 |
#if defined(WIN32) || defined(__OS2__) |
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
0
diff
changeset
|
132 |
#define TTD_LITTLE_ENDIAN |
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
0
diff
changeset
|
133 |
#else |
1721
e2887b445ac0
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
134 |
// Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile |
e2887b445ac0
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
135 |
#if defined(STRGEN) |
e2887b445ac0
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
136 |
#include "endian_host.h" |
e2887b445ac0
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
137 |
#else |
e2887b445ac0
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
138 |
#include "endian_target.h" |
e2887b445ac0
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
139 |
#endif |
0 | 140 |
#endif |
141 |
||
142 |
#if defined(UNIX) |
|
143 |
#define PATHSEP "/" |
|
144 |
#else |
|
145 |
#define PATHSEP "\\" |
|
146 |
#endif |
|
147 |
||
148 |
||
149 |
typedef unsigned char byte; |
|
150 |
#ifndef __BEOS__ // already defined |
|
151 |
typedef unsigned char uint8; |
|
152 |
typedef unsigned short uint16; |
|
153 |
typedef unsigned int uint32; |
|
154 |
#endif |
|
155 |
||
156 |
// This is already defined in unix |
|
1812
26b041a529e9
(svn r2316) - Fix: [ 1154454 ] Fix BeOS build on Trunk (myob)
Darkvater
parents:
1721
diff
changeset
|
157 |
#if !defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) |
0 | 158 |
typedef unsigned int uint; |
159 |
#endif |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
160 |
// Not defined in QNX Neutrino (6.x) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
161 |
#if defined(__QNXNTO__) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
162 |
typedef unsigned int uint; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
163 |
#endif |
0 | 164 |
|
165 |
#ifndef __BEOS__ |
|
166 |
typedef signed char int8; |
|
167 |
typedef signed short int16; |
|
168 |
typedef signed int int32; |
|
169 |
#ifndef __cplusplus |
|
170 |
typedef unsigned char bool; |
|
171 |
#endif |
|
172 |
typedef signed __int64 int64; |
|
173 |
typedef unsigned __int64 uint64; |
|
174 |
#endif |
|
175 |
||
176 |
// Setup alignment and conversion macros |
|
177 |
#if defined(TTD_BIG_ENDIAN) |
|
275
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
178 |
|
0 | 179 |
# define TTD_ALIGNMENT_2 |
180 |
# define TTD_ALIGNMENT_4 |
|
275
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
181 |
|
500
8e52f7797b48
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
182 |
static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); } |
8e52f7797b48
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
183 |
static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); } |
8e52f7797b48
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
184 |
static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); } |
8e52f7797b48
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
185 |
static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); } |
275
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
186 |
#define TO_BE32(x) x |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
187 |
#define TO_BE16(x) x |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
188 |
#define FROM_BE32(x) x |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
189 |
#define FROM_BE16(x) x |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
157
diff
changeset
|
190 |
#define TO_BE32X(x) x |
275
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
191 |
|
0 | 192 |
#else |
275
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
193 |
|
536 | 194 |
static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); } |
195 |
static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); } |
|
196 |
static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); } |
|
197 |
static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); } |
|
275
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
198 |
#define TO_LE32(x) x |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
199 |
#define TO_LE16(x) x |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
200 |
#define TO_BE32X(x) BSWAP32(x) |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
201 |
#define FROM_LE32(x) x |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
202 |
#define FROM_LE16(x) x |
9f810ad00b60
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
203 |
|
0 | 204 |
#endif |
205 |
||
206 |
#if !defined(GAME_DATA_DIR) |
|
207 |
#define GAME_DATA_DIR "" |
|
208 |
#endif |
|
209 |
||
210 |
#if !defined(PERSONAL_DIR) |
|
211 |
#define PERSONAL_DIR "" |
|
212 |
#endif |
|
213 |
||
214 |
#ifndef __cplusplus |
|
215 |
#ifndef __BEOS__ |
|
216 |
enum { |
|
217 |
false = 0, |
|
218 |
true = 1, |
|
219 |
}; |
|
220 |
#endif |
|
221 |
#endif |
|
222 |
||
223 |
// Compile time assertions |
|
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
224 |
#ifdef __OS2__ |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
225 |
# define assert_compile(expr) |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
226 |
#else |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
227 |
# define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)]) |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
228 |
#endif |
0 | 229 |
|
230 |
assert_compile(sizeof(uint32) == 4); |
|
231 |
assert_compile(sizeof(uint16) == 2); |
|
232 |
assert_compile(sizeof(uint8) == 1); |
|
233 |
||
234 |
#define lengthof(x) (sizeof(x)/sizeof(x[0])) |
|
235 |
#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
|
236 |
#define lastof(x) (&x[lengthof(x) - 1]) |
0 | 237 |
#ifndef offsetof |
238 |
#define offsetof(s,m) (size_t)&(((s *)0)->m) |
|
239 |
#endif |
|
240 |
||
241 |
||
242 |
// take care of some name clashes on macos |
|
243 |
#if defined(__APPLE__) |
|
244 |
#define GetString OTTD_GetString |
|
245 |
#define DrawString OTTD_DrawString |
|
246 |
#define Random OTTD_Random |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
247 |
#define CloseConnection OTTD_CloseConnection |
0 | 248 |
#endif |
249 |
||
770
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
250 |
#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
|
251 |
// it seems AmigaOS already have a Point declared |
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
|
252 |
#define Point OTTD_AMIGA_POINT |
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
|
253 |
#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
|
254 |
|
0 | 255 |
#endif // !defined(_STDAFX_H) |