author | Darkvater |
Sun, 18 Sep 2005 20:56:44 +0000 | |
changeset 2436 | 177cb6a8339f |
parent 2225 | e60b20805e4d |
child 2482 | dffcca243dbc |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
3 |
#ifndef STDAFX_H |
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
4 |
#define STDAFX_H |
0 | 5 |
|
6 |
#if defined(_MSC_VER) |
|
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
|
7 |
#pragma once |
0 | 8 |
|
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
|
9 |
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
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
|
10 |
#pragma warning(disable: 4018) // 'expression' : signed/unsigned mismatch |
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
|
11 |
#pragma warning(disable: 4100) // 'identifier' : unreferenced formal parameter |
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
|
12 |
#pragma warning(disable: 4127) // conditional expression is constant |
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
|
13 |
#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union |
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
|
14 |
#pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data |
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
|
15 |
#pragma warning(disable: 4245) // 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch |
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
|
16 |
#pragma warning(disable: 4276) // 'fucntion' : no prototype provided; assumed no parameters (MSVC BUG???) |
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
|
17 |
#pragma warning(disable: 4305) // 'identifier' : truncation from 'type1' to 'type2' |
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
|
18 |
#pragma warning(disable: 4514) // 'function' : unreferenced inline function has been removed |
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
|
19 |
#pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied |
0 | 20 |
#endif |
21 |
||
22 |
#include <stdio.h> |
|
23 |
#include <string.h> |
|
24 |
#include <stdlib.h> |
|
25 |
||
2223
29d61b962cb0
(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
e60b20805e4d
(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 |
e60b20805e4d
(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
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
29 |
#include <assert.h> |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
30 |
#else |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
31 |
#include "os/macosx/macos.h" |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
32 |
#endif |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
33 |
|
858
329ff519fb45
(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
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
38 |
#if defined(__OS2__) |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
39 |
# include <types.h> |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
40 |
#endif |
9717ff353c17
(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
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
46 |
#ifdef SUNOS |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
47 |
#include <alloca.h> |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
48 |
#endif |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
49 |
|
770
89dab23f04ca
(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
89dab23f04ca
(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 |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
53 |
// required for morphos and what for amigaos |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
54 |
# ifdef amigaos |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
55 |
# undef amigaos |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
56 |
# endif |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
57 |
# ifdef __amigaos__ |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
58 |
# undef __amigaos__ |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
59 |
# endif |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
60 |
# ifdef __AMIGA__ |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
61 |
# undef __AMIGA__ |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
62 |
# endif |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
63 |
# ifdef AMIGA |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
64 |
# undef AMIGA |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
65 |
# endif |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
66 |
# ifdef amiga |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
67 |
# undef amiga |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
68 |
# endif |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
69 |
#endif /* __MORPHOS__ */ |
89dab23f04ca
(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
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
|
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
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
95 |
#if defined(__WATCOMC__) |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
96 |
# define NORETURN |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
97 |
# define FORCEINLINE inline |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
98 |
# define CDECL |
1881
023a134a4b12
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1812
diff
changeset
|
99 |
# define NOT_REACHED() assert(0) |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
100 |
# define GCC_PACK |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
101 |
# undef TTD_ALIGNMENT_4 |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
102 |
# undef TTD_ALIGNMENT_2 |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
103 |
|
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
104 |
# include <malloc.h> |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
105 |
#endif |
9717ff353c17
(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
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
116 |
# define inline _inline |
0 | 117 |
# define CDECL _cdecl |
1881
023a134a4b12
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1812
diff
changeset
|
118 |
# if defined(_DEBUG) |
023a134a4b12
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1812
diff
changeset
|
119 |
# define NOT_REACHED() assert(0) |
023a134a4b12
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1812
diff
changeset
|
120 |
# else |
023a134a4b12
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1812
diff
changeset
|
121 |
# define NOT_REACHED() _assume(0) |
023a134a4b12
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1812
diff
changeset
|
122 |
# endif |
1022
9ea8ee93d6a9
(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, ...); |
9ea8ee93d6a9
(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
9717ff353c17
(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
64d59b181596
(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 |
64d59b181596
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
135 |
#if defined(STRGEN) |
64d59b181596
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
136 |
#include "endian_host.h" |
64d59b181596
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
137 |
#else |
64d59b181596
(svn r2225) -Fix: split the endian-detection to target/host. Now cross-compiling
truelight
parents:
1317
diff
changeset
|
138 |
#include "endian_target.h" |
64d59b181596
(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
5b4d1af6b904
(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
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
160 |
// Not defined in QNX Neutrino (6.x) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
161 |
#if defined(__QNXNTO__) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
162 |
typedef unsigned int uint; |
e3b43338096b
(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
31a5354de6f4
(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
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
181 |
|
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
182 |
static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); } |
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
183 |
static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); } |
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
446
diff
changeset
|
184 |
static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); } |
ef288590e096
(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
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
186 |
#define TO_BE32(x) x |
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
187 |
#define TO_BE16(x) x |
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
188 |
#define FROM_BE32(x) x |
31a5354de6f4
(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
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
191 |
|
0 | 192 |
#else |
275
31a5354de6f4
(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
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
198 |
#define TO_LE32(x) x |
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
199 |
#define TO_LE16(x) x |
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
200 |
#define TO_BE32X(x) BSWAP32(x) |
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
201 |
#define FROM_LE32(x) x |
31a5354de6f4
(svn r281) -Fix: some endian issues fixed in network code
signde
parents:
193
diff
changeset
|
202 |
#define FROM_LE16(x) x |
31a5354de6f4
(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
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
224 |
#ifdef __OS2__ |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
225 |
# define assert_compile(expr) |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
226 |
#else |
9717ff353c17
(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)]) |
9717ff353c17
(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
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
|
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
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
247 |
#define CloseConnection OTTD_CloseConnection |
0 | 248 |
#endif |
249 |
||
770
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
250 |
#ifdef __AMIGA__ |
569
2e86ae517874
(svn r980) Fixed issues where MorphOS would get problems if AmigaOS would get a port, since MorphOS also have the flag __AMIGA__ defined (Tokai)
bjarni
parents:
543
diff
changeset
|
251 |
// it seems AmigaOS already have a Point declared |
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
|
252 |
#define Point OTTD_AMIGA_POINT |
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
|
253 |
#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
|
254 |
|
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
|
255 |
#endif /* STDAFX_H */ |