1
+ /*
2
+ ** Copyright 2025 Electronic Arts Inc.
3
+ **
4
+ ** This program is free software: you can redistribute it and/or modify
5
+ ** it under the terms of the GNU General Public License as published by
6
+ ** the Free Software Foundation, either version 3 of the License, or
7
+ ** (at your option) any later version.
8
+ **
9
+ ** This program is distributed in the hope that it will be useful,
10
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ** GNU General Public License for more details.
13
+ **
14
+ ** You should have received a copy of the GNU General Public License
15
+ ** along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ // FILE: BaseTypeCore.h ///////////////////////////////////////////////////////////
19
+ //
20
+ // Project: RTS3
21
+ //
22
+ // Basic types and constants
23
+ // Author: Michael S. Booth, January 1995, September 2000
24
+ // TheSuperHackers @compile feliwir 11/04/2025 Move common BaseType.h code to BaseTypeCore.h
25
+ //
26
+ ///////////////////////////////////////////////////////////////////////////////
27
+
28
+ // tell the compiler to only load this file once
29
+ #pragma once
30
+
31
+
32
+ #ifndef _BASE_TYPE_CORE_H_
33
+ #define _BASE_TYPE_CORE_H_
34
+
35
+ #include <math.h>
36
+ #include <string.h>
37
+ // TheSuperHackers @compile feliwir 07/04/2025 Adds utility macros for cross-platform compatibility
38
+ #include <Utility/compat.h>
39
+ #include <Utility/CppMacros.h>
40
+
41
+ /*
42
+ ** Turn off some unneeded warnings.
43
+ ** Within the windows headers themselves, Microsoft has disabled the warnings 4290, 4514,
44
+ ** 4069, 4200, 4237, 4103, 4001, 4035, 4164. Makes you wonder, eh?
45
+ */
46
+
47
+ // "unreferenced inline function has been removed" Yea, so what?
48
+ #pragma warning(disable : 4514)
49
+
50
+ // Unreferenced local function removed.
51
+ #pragma warning(disable : 4505)
52
+
53
+ // 'unreferenced formal parameter'
54
+ #pragma warning(disable : 4100)
55
+
56
+ // 'identifier was truncated to '255' characters in the browser information':
57
+ // Tempates create LLLOOONNNGGG identifiers!
58
+ #pragma warning(disable : 4786)
59
+
60
+ // 'function selected for automatic inline expansion'. Cool, but since we're treating
61
+ // warnings as errors, don't warn me about this!
62
+ #pragma warning(disable : 4711)
63
+
64
+ #if 0
65
+ // 'assignment within condition expression'. actually a pretty useful warning,
66
+ // but way too much existing code violates it.
67
+ //#pragma warning(disable : 4706)
68
+ #else
69
+ // actually, it turned out not to be too bad, so this is now ENABLED. (srj)
70
+ #pragma warning(error : 4706)
71
+ #endif
72
+
73
+ // 'conditional expression is constant'. used lots in debug builds.
74
+ #pragma warning(disable : 4127)
75
+
76
+ // 'nonstandard extension used : nameless struct/union'. MS headers violate this...
77
+ #pragma warning(disable : 4201)
78
+
79
+ // 'unreachable code'. STL violates this...
80
+ #pragma warning(disable : 4702)
81
+
82
+ // 'local variable is initialized but not referenced'. good thing to know about...
83
+ #pragma warning(error : 4189)
84
+
85
+ // 'unreferenced local variable'. good thing to know about...
86
+ #pragma warning(error : 4101)
87
+
88
+ #ifndef PI
89
+ #define PI 3.14159265359f
90
+ #define TWO_PI 6.28318530718f
91
+ #endif
92
+
93
+ #ifndef NULL
94
+ //#define NULL ((void *)0)
95
+ #define NULL 0 // C++ doesn't like casting void *'s into other pointers
96
+ #endif
97
+
98
+ // MSVC math.h defines overloaded functions with this name...
99
+ //#ifndef abs
100
+ //#define abs(x) (((x) < 0) ? -(x) : (x))
101
+ //#endif
102
+
103
+ #ifndef min
104
+ #define min (x ,y ) (((x)<(y)) ? (x) : (y))
105
+ #endif
106
+
107
+ #ifndef max
108
+ #define max (x ,y ) (((x)>(y)) ? (x) : (y))
109
+ #endif
110
+
111
+ #ifndef TRUE
112
+ #define TRUE true
113
+ #endif
114
+
115
+ #ifndef FALSE
116
+ #define FALSE false
117
+ #endif
118
+
119
+ // Elements in an array
120
+ #ifndef ELEMENTS_OF
121
+ #define ELEMENTS_OF ( x ) ( sizeof( x ) / sizeof( x[0] ) )
122
+ #endif
123
+
124
+ //--------------------------------------------------------------------
125
+ // Fundamental type definitions
126
+ //--------------------------------------------------------------------
127
+ typedef float Real ; // 4 bytes
128
+ typedef int Int ; // 4 bytes
129
+ typedef unsigned int UnsignedInt ; // 4 bytes
130
+ typedef unsigned short UnsignedShort ; // 2 bytes
131
+ typedef short Short ; // 2 bytes
132
+ typedef unsigned char UnsignedByte ; // 1 byte USED TO BE "Byte"
133
+ typedef char Byte ; // 1 byte USED TO BE "SignedByte"
134
+ typedef char Char ; // 1 byte of text
135
+ typedef bool Bool ; //
136
+ // note, the types below should use "long long", but MSVC doesn't support it yet
137
+ #ifdef _MSC_VER
138
+ typedef __int64 Int64 ; // 8 bytes
139
+ typedef unsigned __int64 UnsignedInt64 ; // 8 bytes
140
+ #else
141
+ typedef long long Int64 ; // 8 bytes
142
+ typedef unsigned long long UnsignedInt64 ; // 8 bytes
143
+ #endif
144
+
145
+ #endif // _BASE_TYPE_CORE_H_
0 commit comments