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+
40+ /*
41+ ** Turn off some unneeded warnings.
42+ ** Within the windows headers themselves, Microsoft has disabled the warnings 4290, 4514,
43+ ** 4069, 4200, 4237, 4103, 4001, 4035, 4164. Makes you wonder, eh?
44+ */
45+
46+ // "unreferenced inline function has been removed" Yea, so what?
47+ #pragma warning(disable : 4514)
48+
49+ // Unreferenced local function removed.
50+ #pragma warning(disable : 4505)
51+
52+ // 'unreferenced formal parameter'
53+ #pragma warning(disable : 4100)
54+
55+ // 'identifier was truncated to '255' characters in the browser information':
56+ // Tempates create LLLOOONNNGGG identifiers!
57+ #pragma warning(disable : 4786)
58+
59+ // 'function selected for automatic inline expansion'. Cool, but since we're treating
60+ // warnings as errors, don't warn me about this!
61+ #pragma warning(disable : 4711)
62+
63+ #if 0
64+ // 'assignment within condition expression'. actually a pretty useful warning,
65+ // but way too much existing code violates it.
66+ //#pragma warning(disable : 4706)
67+ #else
68+ // actually, it turned out not to be too bad, so this is now ENABLED. (srj)
69+ #pragma warning(error : 4706)
70+ #endif
71+
72+ // 'conditional expression is constant'. used lots in debug builds.
73+ #pragma warning(disable : 4127)
74+
75+ // 'nonstandard extension used : nameless struct/union'. MS headers violate this...
76+ #pragma warning(disable : 4201)
77+
78+ // 'unreachable code'. STL violates this...
79+ #pragma warning(disable : 4702)
80+
81+ // 'local variable is initialized but not referenced'. good thing to know about...
82+ #pragma warning(error : 4189)
83+
84+ // 'unreferenced local variable'. good thing to know about...
85+ #pragma warning(error : 4101)
86+
87+ #ifndef PI
88+ #define PI 3.14159265359f
89+ #define TWO_PI 6.28318530718f
90+ #endif
91+
92+ #ifndef NULL
93+ //#define NULL ((void *)0)
94+ #define NULL 0 // C++ doesn't like casting void *'s into other pointers
95+ #endif
96+
97+ // MSVC math.h defines overloaded functions with this name...
98+ //#ifndef abs
99+ //#define abs(x) (((x) < 0) ? -(x) : (x))
100+ //#endif
101+
102+ #ifndef min
103+ #define min (x ,y ) (((x)<(y)) ? (x) : (y))
104+ #endif
105+
106+ #ifndef max
107+ #define max (x ,y ) (((x)>(y)) ? (x) : (y))
108+ #endif
109+
110+ #ifndef TRUE
111+ #define TRUE true
112+ #endif
113+
114+ #ifndef FALSE
115+ #define FALSE false
116+ #endif
117+
118+ // Elements in an array
119+ #ifndef ELEMENTS_OF
120+ #define ELEMENTS_OF ( x ) ( sizeof( x ) / sizeof( x[0] ) )
121+ #endif
122+
123+ //--------------------------------------------------------------------
124+ // Fundamental type definitions
125+ //--------------------------------------------------------------------
126+ typedef float Real ; // 4 bytes
127+ typedef int Int ; // 4 bytes
128+ typedef unsigned int UnsignedInt ; // 4 bytes
129+ typedef unsigned short UnsignedShort ; // 2 bytes
130+ typedef short Short ; // 2 bytes
131+ typedef unsigned char UnsignedByte ; // 1 byte USED TO BE "Byte"
132+ typedef char Byte ; // 1 byte USED TO BE "SignedByte"
133+ typedef char Char ; // 1 byte of text
134+ typedef bool Bool ; //
135+ // note, the types below should use "long long", but MSVC doesn't support it yet
136+ #ifdef _MSC_VER
137+ typedef __int64 Int64 ; // 8 bytes
138+ typedef unsigned __int64 UnsignedInt64 ; // 8 bytes
139+ #else
140+ typedef long long Int64 ; // 8 bytes
141+ typedef unsigned long long UnsignedInt64 ; // 8 bytes
142+ #endif
143+
144+ #endif // _BASE_TYPE_CORE_H_
0 commit comments