author | skidd13 |
Mon, 19 Nov 2007 20:40:14 +0000 | |
changeset 7927 | 3a3289a049f9 |
parent 7914 | a58b495cd787 |
child 8004 | 1c54bc6f4bdf |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6481
85ad87daf4b0
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6420
diff
changeset
|
3 |
/** @file stdafx.h */ |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6285
diff
changeset
|
4 |
|
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
5 |
#ifndef STDAFX_H |
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
6 |
#define STDAFX_H |
0 | 7 |
|
5820
4a9da174bf1b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
5812
diff
changeset
|
8 |
/* It seems that we need to include stdint.h before anything else |
4a9da174bf1b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
5812
diff
changeset
|
9 |
* We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC |
4a9da174bf1b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
5812
diff
changeset
|
10 |
* does not have stdint.h and apparently neither does MorphOS, so define |
7775
5ca1ba91cde2
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7405
diff
changeset
|
11 |
* INT64_MAX for them ourselves. |
5ca1ba91cde2
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7405
diff
changeset
|
12 |
* Sometimes OSX headers manages to include stdint.h before this but without |
5ca1ba91cde2
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7405
diff
changeset
|
13 |
* __STDC_LIMIT_MACROS so it will be without INT64_*. We need to define those |
5ca1ba91cde2
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7405
diff
changeset
|
14 |
* too if this is the case. */ |
5ca1ba91cde2
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7405
diff
changeset
|
15 |
#if !defined(_MSC_VER) && !defined( __MORPHOS__) && !defined(_STDINT_H_) |
6233
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
16 |
# if defined (SUNOS) |
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
17 |
/* SunOS/Solaris does not have stdint.h, but inttypes.h defines everything |
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
18 |
* stdint.h defines and we need. */ |
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
19 |
# include <inttypes.h> |
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
20 |
# else |
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
21 |
# define __STDC_LIMIT_MACROS |
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
22 |
# include <stdint.h> |
efbf48e0593e
(svn r9036) -Fix [SunOS]: SunOS/Solaris does not have stdint.h, so use inttypes.h which defines the things we need from stdint.h.
rubidium
parents:
6194
diff
changeset
|
23 |
# endif |
5820
4a9da174bf1b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
5812
diff
changeset
|
24 |
#else |
4a9da174bf1b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
5812
diff
changeset
|
25 |
# define INT64_MAX 9223372036854775807LL |
7775
5ca1ba91cde2
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7405
diff
changeset
|
26 |
# define INT64_MIN (-INT64_MAX - 1) |
5820
4a9da174bf1b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
5812
diff
changeset
|
27 |
#endif |
4a9da174bf1b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
5812
diff
changeset
|
28 |
|
5933
c09d80249412
(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:
5843
diff
changeset
|
29 |
#include <cstdio> |
c09d80249412
(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:
5843
diff
changeset
|
30 |
#include <cstddef> |
c09d80249412
(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:
5843
diff
changeset
|
31 |
#include <cstring> |
c09d80249412
(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:
5843
diff
changeset
|
32 |
#include <cstdlib> |
c09d80249412
(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:
5843
diff
changeset
|
33 |
#include <climits> |
0 | 34 |
|
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
35 |
/* MacOS X will use an NSAlert to display failed assertaions since they're lost unless running from a terminal |
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
36 |
* strgen always runs from terminal and don't need a window for asserts */ |
2731
888a994e9fe9
(svn r3276) reverted the last two commits. OSX 10.2 kept finding new stuff to prevent it from running OpenTTD, so now it's not supported anymore
bjarni
parents:
2730
diff
changeset
|
37 |
#if !defined(__APPLE__) || defined(STRGEN) |
5933
c09d80249412
(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:
5843
diff
changeset
|
38 |
# include <cassert> |
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
39 |
#else |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
40 |
# include "os/macosx/macos.h" |
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
41 |
#endif |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
42 |
|
858
9a3254670831
(svn r1339) -Fix: compilation with networking works on MinGW32 again (thx orudge).
darkvater
parents:
796
diff
changeset
|
43 |
#if defined(UNIX) || defined(__MINGW32__) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
44 |
# include <sys/types.h> |
0 | 45 |
#endif |
46 |
||
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
47 |
#if defined(__OS2__) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
48 |
# include <types.h> |
4216
0b1f4832c358
(svn r5760) - Codechange: Use a define for case-string comparison in OS/2 instead of function.
Darkvater
parents:
4000
diff
changeset
|
49 |
# define strcasecmp stricmp |
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
50 |
#endif |
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
51 |
|
5976
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
52 |
#if defined(PSP) |
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
53 |
# include <psptypes.h> |
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
54 |
# include <pspdebug.h> |
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
55 |
# include <pspthreadman.h> |
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
56 |
#endif /* PSP */ |
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
57 |
|
0 | 58 |
#ifdef __BEOS__ |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
59 |
# include <SupportDefs.h> |
0 | 60 |
#endif |
61 |
||
446
7a92ca9738e2
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
62 |
#ifdef SUNOS |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
63 |
# include <alloca.h> |
446
7a92ca9738e2
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
64 |
#endif |
7a92ca9738e2
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
65 |
|
770
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
66 |
#ifdef __MORPHOS__ |
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
67 |
/* MorphOS defines certain Amiga defines per default, we undefine them |
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
68 |
* here to make the rest of source less messy and more clear what is |
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
69 |
* required for morphos and what for AmigaOS */ |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
70 |
# ifdef amigaos |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
71 |
# undef amigaos |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
72 |
# endif |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
73 |
# ifdef __amigaos__ |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
74 |
# undef __amigaos__ |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
75 |
# endif |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
76 |
# ifdef __AMIGA__ |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
77 |
# undef __AMIGA__ |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
78 |
# endif |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
79 |
# ifdef AMIGA |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
80 |
# undef AMIGA |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
81 |
# endif |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
82 |
# ifdef amiga |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
83 |
# undef amiga |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
84 |
# endif |
6524
c7c22661b78d
(svn r9711) -Fix: don't include one system-header-file on MorphOS as it gives silly warnings and is unneeded for OpenTTD
truelight
parents:
6481
diff
changeset
|
85 |
/* Act like we already included this file, as it somehow gives linkage problems |
c7c22661b78d
(svn r9711) -Fix: don't include one system-header-file on MorphOS as it gives silly warnings and is unneeded for OpenTTD
truelight
parents:
6481
diff
changeset
|
86 |
* (mismatch linkage of C++ and C between this include and unistd.h). */ |
c7c22661b78d
(svn r9711) -Fix: don't include one system-header-file on MorphOS as it gives silly warnings and is unneeded for OpenTTD
truelight
parents:
6481
diff
changeset
|
87 |
#define CLIB_USERGROUP_PROTOS_H |
770
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
88 |
#endif /* __MORPHOS__ */ |
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
89 |
|
3016
958672b0f8e2
(svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
bjarni
parents:
2984
diff
changeset
|
90 |
#ifdef __APPLE__ |
3289 | 91 |
# include "os/macosx/osx_stdafx.h" |
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
92 |
/* Make endian swapping use Apple's macros to increase speed (since it will use hardware swapping if available) |
5544
eb8591a2fbbe
(svn r7887) -Fix: [OSX] Endian32_Swap should always return a uint32, not a long unsigned int
bjarni
parents:
5475
diff
changeset
|
93 |
* Even though they should return uint16 and uint32, we get warnings if we don't cast those (why?) */ |
eb8591a2fbbe
(svn r7887) -Fix: [OSX] Endian32_Swap should always return a uint32, not a long unsigned int
bjarni
parents:
5475
diff
changeset
|
94 |
# define BSWAP32(x) ((uint32)Endian32_Swap(x)) |
eb8591a2fbbe
(svn r7887) -Fix: [OSX] Endian32_Swap should always return a uint32, not a long unsigned int
bjarni
parents:
5475
diff
changeset
|
95 |
# define BSWAP16(x) ((uint16)Endian16_Swap(x)) |
3016
958672b0f8e2
(svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
bjarni
parents:
2984
diff
changeset
|
96 |
#else |
3289 | 97 |
# define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000)) |
98 |
# define BSWAP16(x) ((x) >> 8 | (x) << 8) |
|
99 |
#endif /* __APPLE__ */ |
|
0 | 100 |
|
5967
e8c5596608ad
(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:
5947
diff
changeset
|
101 |
#if defined(PSP) |
e8c5596608ad
(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:
5947
diff
changeset
|
102 |
/* PSP can only have 10 file-descriptors open at any given time, but this |
e8c5596608ad
(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:
5947
diff
changeset
|
103 |
* switch only limits reads via the Fio system. So keep 2 fds free for things |
e8c5596608ad
(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:
5947
diff
changeset
|
104 |
* like saving a game. */ |
5976
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
105 |
# define LIMITED_FDS 8 |
aa1cae2b975a
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
5967
diff
changeset
|
106 |
# define printf pspDebugScreenPrintf |
5967
e8c5596608ad
(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:
5947
diff
changeset
|
107 |
#endif /* PSP */ |
e8c5596608ad
(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:
5947
diff
changeset
|
108 |
|
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
109 |
/* by default we use [] var arrays */ |
0 | 110 |
#define VARARRAY_SIZE |
111 |
||
112 |
||
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
113 |
/* Stuff for GCC */ |
0 | 114 |
#if defined(__GNUC__) |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3900
diff
changeset
|
115 |
# define NORETURN __attribute__ ((noreturn)) |
0 | 116 |
# define FORCEINLINE inline |
117 |
# define CDECL |
|
118 |
# define __int64 long long |
|
119 |
# define GCC_PACK __attribute__((packed)) |
|
120 |
||
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
121 |
# if (__GNUC__ == 2) |
0 | 122 |
# undef VARARRAY_SIZE |
123 |
# define VARARRAY_SIZE 0 |
|
124 |
# endif |
|
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
125 |
#endif /* __GNUC__ */ |
0 | 126 |
|
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
127 |
#if defined(__WATCOMC__) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
128 |
# define NORETURN |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
129 |
# define FORCEINLINE inline |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
130 |
# define CDECL |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
131 |
# define GCC_PACK |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
132 |
# include <malloc.h> |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
133 |
#endif /* __WATCOMC__ */ |
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
134 |
|
796 | 135 |
#if defined(__MINGW32__) || defined(__CYGWIN__) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
136 |
# include <malloc.h> // alloca() |
796 | 137 |
#endif |
138 |
||
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
139 |
/* Stuff for MSVC */ |
0 | 140 |
#if defined(_MSC_VER) |
2695
cb39a85e267f
(svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents:
2694
diff
changeset
|
141 |
# pragma once |
6194
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
142 |
/* Define a win32 target platform, to override defaults of the SDK |
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
143 |
* We need to define NTDDI version for Vista SDK, but win2k is minimum */ |
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
144 |
# define NTDDI_VERSION NTDDI_WIN2K // Windows 2000 |
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
145 |
# define _WIN32_WINNT 0x0500 // Windows 2000 |
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
146 |
|
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
147 |
# define _WIN32_WINDOWS 0x400 // Windows 95 |
7405
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
148 |
#if !defined(WINCE) |
6194
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
149 |
# define WINVER 0x0400 // Windows NT 4.0 / Windows 95 |
7405
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
150 |
#endif |
6194
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
151 |
# define _WIN32_IE_ 0x0401 // 4.01 (win98 and NT4SP5+) |
48825779b73f
(svn r8974) -Fix: [win32] Define a win32 target platform ourselves so that we don't conflict with Vista Platform SDK (boekabart)
Darkvater
parents:
6083
diff
changeset
|
152 |
|
2695
cb39a85e267f
(svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents:
2694
diff
changeset
|
153 |
# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
cb39a85e267f
(svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents:
2694
diff
changeset
|
154 |
# pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data |
cb39a85e267f
(svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents:
2694
diff
changeset
|
155 |
# pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5544
diff
changeset
|
156 |
# pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union |
5120
1ff65e874ce3
(svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
Darkvater
parents:
5082
diff
changeset
|
157 |
|
2976
06d8d0b8dad7
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
158 |
# if _MSC_VER >= 1400 // MSVC 2005 safety checks |
06d8d0b8dad7
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
159 |
# pragma warning(disable: 4996) // 'strdup' was declared deprecated |
06d8d0b8dad7
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
160 |
# define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions |
7147
ce8ea5a0b8d1
(svn r10421) -Fix [MSVC]: suppress some code analyzer warnings for VC8
KUDr
parents:
7028
diff
changeset
|
161 |
# pragma warning(disable: 6308) // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked |
ce8ea5a0b8d1
(svn r10421) -Fix [MSVC]: suppress some code analyzer warnings for VC8
KUDr
parents:
7028
diff
changeset
|
162 |
# pragma warning(disable: 6011) // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001 |
7154
68a572dde4c0
(svn r10428) -Fix: some more VC code analyzer warnings disabled
KUDr
parents:
7147
diff
changeset
|
163 |
# pragma warning(disable: 6326) // code analyzer: potential comparison of a constant with another constant |
68a572dde4c0
(svn r10428) -Fix: some more VC code analyzer warnings disabled
KUDr
parents:
7147
diff
changeset
|
164 |
# pragma warning(disable: 6031) // code analyzer: Return value ignored: 'ReadFile' |
68a572dde4c0
(svn r10428) -Fix: some more VC code analyzer warnings disabled
KUDr
parents:
7147
diff
changeset
|
165 |
# pragma warning(disable: 6255) // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead |
68a572dde4c0
(svn r10428) -Fix: some more VC code analyzer warnings disabled
KUDr
parents:
7147
diff
changeset
|
166 |
# pragma warning(disable: 6246) // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ... |
5935
4583abb7d050
(svn r8574) -Fix: Silence VC2003 warning: "compiler limit : terminating debug information emission for enum 'StringIdEnum'"
KUDr
parents:
5934
diff
changeset
|
167 |
# else /* _MSC_VER >= 1400 ( <1400 for MSVC2003) */ |
7028
0e367ef44fb9
(svn r10292) -Fix: suppress VC 7.1 warning: "\src\texteff.cpp(251) : warning C4258: 'y' : definition from the for loop is ignored; the definition from the enclosing scope is used" which prevents compilation on MSVC 2003
KUDr
parents:
6957
diff
changeset
|
168 |
# pragma warning(disable: 4288) // nonstandard extension used : 'y' : loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope |
5935
4583abb7d050
(svn r8574) -Fix: Silence VC2003 warning: "compiler limit : terminating debug information emission for enum 'StringIdEnum'"
KUDr
parents:
5934
diff
changeset
|
169 |
# pragma warning(disable: 4292) // compiler limit : terminating debug information emission for enum 'StringIdEnum' with member 'STR_801D_COAL_CAR' |
2976
06d8d0b8dad7
(svn r3551) Add directives to allow Visual Studio 2005 compilation.
peter1138
parents:
2974
diff
changeset
|
170 |
# endif /* _MSC_VER >= 1400 */ |
2695
cb39a85e267f
(svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents:
2694
diff
changeset
|
171 |
|
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
172 |
# include <malloc.h> // alloca() |
0 | 173 |
# define NORETURN __declspec(noreturn) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
174 |
# define FORCEINLINE __forceinline |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
175 |
# define inline _inline |
7405
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
176 |
# if !defined(WINCE) |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
177 |
# define CDECL _cdecl |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
178 |
# endif |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
179 |
int CDECL snprintf(char *str, size_t size, const char *format, ...); |
7405
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
180 |
# if _MSC_VER < 1400 || defined(WINCE) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
181 |
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap); |
1881
435d39bd6ee0
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1812
diff
changeset
|
182 |
# endif |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
183 |
|
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
184 |
# if defined(WIN32) && !defined(_WIN64) && !defined(WIN64) |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
185 |
# ifndef _W64 |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
186 |
# define _W64 |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
187 |
# endif |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
188 |
typedef _W64 int INT_PTR, *PINT_PTR; |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
189 |
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
190 |
# endif /* WIN32 && !_WIN64 && !WIN64 */ |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
191 |
|
0 | 192 |
# define GCC_PACK |
2694
9b5f6f369ab3
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
193 |
|
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
194 |
/* This is needed to zlib uses the stdcall calling convention on visual studio */ |
2694
9b5f6f369ab3
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
195 |
# if defined(WITH_ZLIB) || defined(WITH_PNG) |
9b5f6f369ab3
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
196 |
# ifndef ZLIB_WINAPI |
9b5f6f369ab3
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
197 |
# define ZLIB_WINAPI |
9b5f6f369ab3
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
198 |
# endif |
9b5f6f369ab3
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
199 |
# endif |
9b5f6f369ab3
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
200 |
|
7405
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
201 |
# if defined(WINCE) |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
202 |
# define strcasecmp _stricmp |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
203 |
# define strncasecmp _strnicmp |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
204 |
# undef DEBUG |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
205 |
# else |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
206 |
# define strcasecmp stricmp |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
207 |
# define strncasecmp strnicmp |
2fd57f130eca
(svn r10778) -Fix: one-liners to allow MSVC and WINCE to work together (or anyway, a step towards that goal)
truelight
parents:
7277
diff
changeset
|
208 |
# endif |
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
209 |
/* suppress: warning C4005: 'offsetof' : macro redefinition (VC8) */ |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
210 |
#endif /* defined(_MSC_VER) */ |
2483
e2d5f55daf63
(svn r3009) DIEEEEEEEEEEE VS6 (you good-for-nothing compiler)
Darkvater
parents:
2482
diff
changeset
|
211 |
|
5755
09b36c6ee100
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5671
diff
changeset
|
212 |
#if defined(WINCE) |
09b36c6ee100
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5671
diff
changeset
|
213 |
# define strdup _strdup |
09b36c6ee100
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5671
diff
changeset
|
214 |
#endif /* WINCE */ |
09b36c6ee100
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5671
diff
changeset
|
215 |
|
5167
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
216 |
/* NOTE: the string returned by these functions is only valid until the next |
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
217 |
* call to the same function and is not thread- or reentrancy-safe */ |
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
218 |
#if !defined(STRGEN) |
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
219 |
# if defined(WIN32) || defined(WIN64) |
6834
7a64c73d5f45
(svn r10073) -Codechange: make the NewGRF paths in the config file without any full paths (again).
rubidium
parents:
6634
diff
changeset
|
220 |
char *getcwd(char *buf, size_t size); |
6251
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
221 |
# include <tchar.h> |
5755
09b36c6ee100
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5671
diff
changeset
|
222 |
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */ |
6251
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
223 |
# if !defined(WINCE) |
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
224 |
# define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode)) |
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
225 |
# endif /* WINCE */ |
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
226 |
|
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
227 |
const char *FS2OTTD(const TCHAR *name); |
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
228 |
const TCHAR *OTTD2FS(const char *name); |
5167
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
229 |
# else |
6251
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6233
diff
changeset
|
230 |
|
5167
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
231 |
# define fopen(file, mode) fopen(OTTD2FS(file), mode) |
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
232 |
const char *FS2OTTD(const char *name); |
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
233 |
const char *OTTD2FS(const char *name); |
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
234 |
# endif /* WIN32 */ |
12c46fb7eccf
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
235 |
#endif /* STRGEN */ |
2482
374f6395847d
(svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents:
2436
diff
changeset
|
236 |
|
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
237 |
/* Windows has always LITTLE_ENDIAN */ |
2482
374f6395847d
(svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents:
2436
diff
changeset
|
238 |
#if defined(WIN32) || defined(__OS2__) || defined(WIN64) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
239 |
# define TTD_LITTLE_ENDIAN |
6938
ee22ce416ed1
(svn r10191) -Backport (r9148 from NoAI): detecting of CPU type (32 vs 64 bits).
rubidium
parents:
6929
diff
changeset
|
240 |
#elif defined(TESTING) |
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
0
diff
changeset
|
241 |
#else |
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
242 |
/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */ |
4563
241260bd5505
(svn r6411) -Fix(r6410): forgot to update openttd*.sln (thx Darkvater and michi_cc :) )
glx
parents:
4379
diff
changeset
|
243 |
# if defined(STRGEN) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
244 |
# include "endian_host.h" |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
245 |
# else |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
246 |
# include "endian_target.h" |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
247 |
# endif |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
248 |
#endif /* WIN32 || __OS2__ || WIN64 */ |
0 | 249 |
|
5591
51e4c59c31dd
(svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge
parents:
5587
diff
changeset
|
250 |
#if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) |
4379
96eb926dcc1d
(svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents:
4316
diff
changeset
|
251 |
# define PATHSEP "\\" |
96eb926dcc1d
(svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents:
4316
diff
changeset
|
252 |
# define PATHSEPCHAR '\\' |
96eb926dcc1d
(svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents:
4316
diff
changeset
|
253 |
#else |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
254 |
# define PATHSEP "/" |
4221
ff4a040f30c6
(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
|
255 |
# define PATHSEPCHAR '/' |
0 | 256 |
#endif |
257 |
||
258 |
typedef unsigned char byte; |
|
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
259 |
#ifndef __BEOS__ /* already defined */ |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
260 |
typedef unsigned char uint8; |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
261 |
typedef unsigned short uint16; |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
262 |
typedef unsigned int uint32; |
0 | 263 |
#endif |
264 |
||
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
265 |
/* This is already defined in unix */ |
5363
11cbdbe10de6
(svn r7548) -Codechange: Some MorphOS changes to get OpenTTD compiled, packaged (tokai)
Darkvater
parents:
5167
diff
changeset
|
266 |
#if !defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) && !defined(__MORPHOS__) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
267 |
typedef unsigned int uint; |
0 | 268 |
#endif |
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
269 |
/* Not defined in QNX Neutrino (6.x) */ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
270 |
#if defined(__QNXNTO__) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
271 |
typedef unsigned int uint; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
272 |
#endif |
0 | 273 |
|
274 |
#ifndef __BEOS__ |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
275 |
typedef signed char int8; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
276 |
typedef signed short int16; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
277 |
typedef signed int int32; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
278 |
typedef signed __int64 int64; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
279 |
typedef unsigned __int64 uint64; |
6083
53aedcdb9e90
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
5976
diff
changeset
|
280 |
#endif /* !__BEOS__ */ |
0 | 281 |
|
2978
a67025958ebb
(svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents:
2976
diff
changeset
|
282 |
#if defined(ARM) || defined(__arm__) || defined(__alpha__) |
a67025958ebb
(svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents:
2976
diff
changeset
|
283 |
# define OTTD_ALIGNMENT |
a67025958ebb
(svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents:
2976
diff
changeset
|
284 |
#endif |
a67025958ebb
(svn r3553) - Revert r3549 "Change the behaviour of OTTD_ALIGNMENT". Some tests showed that forcing aligned reads slowed down the code (drawing smallmap) by 14%. Change back to the old behaviour.
Darkvater
parents:
2976
diff
changeset
|
285 |
|
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
286 |
/* Setup alignment and conversion macros */ |
0 | 287 |
#if defined(TTD_BIG_ENDIAN) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
288 |
static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); } |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
289 |
static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); } |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
290 |
static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); } |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
291 |
static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); } |
2984
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
292 |
# define TO_BE32(x) (x) |
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
293 |
# define TO_BE16(x) (x) |
2639 | 294 |
# define FROM_BE32(x) (x) |
295 |
# define FROM_BE16(x) (x) |
|
2984
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
296 |
# define TO_LE32X(x) BSWAP32(x) |
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
297 |
# define TO_BE32X(x) (x) |
0 | 298 |
#else |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
299 |
static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); } |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
300 |
static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); } |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
301 |
static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); } |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
302 |
static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); } |
2984
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
303 |
# define TO_LE32(x) (x) |
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
304 |
# define TO_LE16(x) (x) |
2639 | 305 |
# define FROM_LE32(x) (x) |
306 |
# define FROM_LE16(x) (x) |
|
2984
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
307 |
# define TO_LE32X(x) (x) |
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2980
diff
changeset
|
308 |
# define TO_BE32X(x) BSWAP32(x) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
309 |
#endif /* TTD_BIG_ENDIAN */ |
0 | 310 |
|
6929
56470c1b8a66
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents:
6834
diff
changeset
|
311 |
#if !defined(WITH_PERSONAL_DIR) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
312 |
# define PERSONAL_DIR "" |
0 | 313 |
#endif |
314 |
||
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
315 |
/* Compile time assertions */ |
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
316 |
#ifdef __OS2__ |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
317 |
# define assert_compile(expr) |
781
4c9177888196
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
318 |
#else |
6083
53aedcdb9e90
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
5976
diff
changeset
|
319 |
# define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)]) |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
320 |
#endif /* __OS2__ */ |
0 | 321 |
|
322 |
assert_compile(sizeof(uint32) == 4); |
|
323 |
assert_compile(sizeof(uint16) == 2); |
|
2639 | 324 |
assert_compile(sizeof(uint8) == 1); |
0 | 325 |
|
326 |
#define lengthof(x) (sizeof(x)/sizeof(x[0])) |
|
327 |
#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
|
328 |
#define lastof(x) (&x[lengthof(x) - 1]) |
5671
c7b6e63f1996
(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:
5591
diff
changeset
|
329 |
|
6083
53aedcdb9e90
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
5976
diff
changeset
|
330 |
#define cpp_offsetof(s,m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8) |
53aedcdb9e90
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
5976
diff
changeset
|
331 |
#ifndef offsetof |
5947
159e7039397a
(svn r8613) -Fix [MorphOS]: offsetof() macro undefined for MorphOS build
KUDr
parents:
5935
diff
changeset
|
332 |
# define offsetof(s,m) cpp_offsetof(s, m) |
6083
53aedcdb9e90
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
5976
diff
changeset
|
333 |
#endif /* offsetof */ |
0 | 334 |
|
335 |
||
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
336 |
/* take care of some name clashes on MacOS */ |
0 | 337 |
#if defined(__APPLE__) |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
338 |
# define GetString OTTD_GetString |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
339 |
# define DrawString OTTD_DrawString |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
340 |
# define Random OTTD_Random |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
341 |
# define CloseConnection OTTD_CloseConnection |
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
342 |
#endif /* __APPLE */ |
0 | 343 |
|
770
c2eacca29601
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
344 |
#ifdef __AMIGA__ |
5934
46e88dcb71ff
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
5933
diff
changeset
|
345 |
/* it seems AmigaOS already have a Point declared */ |
2485
3e83ba6adf27
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
346 |
# define Point OTTD_AMIGA_POINT |
569
1e1755ba1572
(svn r980) Fixed issues where MorphOS would get problems if AmigaOS would get a port, since MorphOS also have the flag __AMIGA__ defined (Tokai)
bjarni
parents:
543
diff
changeset
|
347 |
#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
|
348 |
|
6634
33e42f1ee228
(svn r9865) -Fix (r9862): NOT_REACHED() and error() declarations are needed for strgen
glx
parents:
6633
diff
changeset
|
349 |
void |
6633
fea441267fe7
(svn r9862) -Fix (9842): strgen's error() does return in contrast to OTTD's error().
rubidium
parents:
6622
diff
changeset
|
350 |
#ifndef STRGEN |
6634
33e42f1ee228
(svn r9865) -Fix (r9862): NOT_REACHED() and error() declarations are needed for strgen
glx
parents:
6633
diff
changeset
|
351 |
/* In strgen error is not fatal and returns */ |
33e42f1ee228
(svn r9865) -Fix (r9862): NOT_REACHED() and error() declarations are needed for strgen
glx
parents:
6633
diff
changeset
|
352 |
NORETURN |
33e42f1ee228
(svn r9865) -Fix (r9862): NOT_REACHED() and error() declarations are needed for strgen
glx
parents:
6633
diff
changeset
|
353 |
#endif /* STRGEN */ |
33e42f1ee228
(svn r9865) -Fix (r9862): NOT_REACHED() and error() declarations are needed for strgen
glx
parents:
6633
diff
changeset
|
354 |
CDECL error(const char *str, ...); |
6622
918a98fc95fb
(svn r9842) -Codechange: now NOT_REACHED is also triggered when debugging is disabled.
rubidium
parents:
6524
diff
changeset
|
355 |
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__) |
918a98fc95fb
(svn r9842) -Codechange: now NOT_REACHED is also triggered when debugging is disabled.
rubidium
parents:
6524
diff
changeset
|
356 |
|
7275
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
357 |
#if defined(MORPHOS) |
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
358 |
/* MorphOS doesn't have C++ conformant _stricmp... */ |
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
359 |
#define _stricmp stricmp |
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
360 |
#elif defined(OPENBSD) |
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
361 |
/* OpenBSD uses strcasecmp(3) */ |
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
362 |
#define _stricmp strcasecmp |
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
363 |
#endif |
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
364 |
|
7277
0b39725581e1
(svn r10607) -Fix r10605: use '&&' in preprocessor directives (MSVC doesn't like 'and')
glx
parents:
7275
diff
changeset
|
365 |
#if !defined(MORPHOS) && !defined(OPENBSD) |
7275
81c0163435a5
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7266
diff
changeset
|
366 |
/* MorphOS & OpenBSD don't know wchars, the rest does :( */ |
7255
31eec725265f
(svn r10562) -Fix: most of the MorphOS issues; MorphOS doesn't know about wchars, so disable all code that has to use wchars for MorphOS.
rubidium
parents:
7154
diff
changeset
|
367 |
#define HAS_WCHAR |
7277
0b39725581e1
(svn r10607) -Fix r10605: use '&&' in preprocessor directives (MSVC doesn't like 'and')
glx
parents:
7275
diff
changeset
|
368 |
#endif /* !defined(MORPHOS) && !defined(OPENBSD) */ |
7255
31eec725265f
(svn r10562) -Fix: most of the MorphOS issues; MorphOS doesn't know about wchars, so disable all code that has to use wchars for MorphOS.
rubidium
parents:
7154
diff
changeset
|
369 |
|
7266
b16e67e992b4
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7255
diff
changeset
|
370 |
#if !defined(MAX_PATH) |
b16e67e992b4
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7255
diff
changeset
|
371 |
# define MAX_PATH 260 |
b16e67e992b4
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7255
diff
changeset
|
372 |
#endif |
b16e67e992b4
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7255
diff
changeset
|
373 |
|
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
374 |
#endif /* STDAFX_H */ |