Skip to content

Commit 3411aac

Browse files
author
Bart Roossien
committed
[ZH] Replacing 'register' keyword by a macro as it is deprecated since c++17 (TheSuperHackers#534)
1 parent 7f4c703 commit 3411aac

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

Dependencies/Utility/Utility/CppMacros.h

+6
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88
#else
99
#define NOEXCEPT_17
1010
#endif
11+
12+
#if __cplusplus >= 201703L
13+
#define REGISTER
14+
#else
15+
#define REGISTER register
16+
#endif

GeneralsMD/Code/GameEngine/Include/Common/QuickTrig.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
3737

38+
#include "Utility/CppMacros.h"
39+
3840
//-----------------------------------------------------------------------------
3941

4042
extern Real TheQuickSinTable[];
@@ -88,8 +90,8 @@ inline Real QMag(Real x, Real y, Real z)
8890
//-----------------------------------------------------------------------------
8991
inline Real QSin(Real a)
9092
{
91-
register Real angle = a;
92-
register long sgn = 1;
93+
REGISTER Real angle = a;
94+
REGISTER long sgn = 1;
9395

9496
if (angle < 0) // DO POSITIVE MATH AND PRESERVE SIGN
9597
{
@@ -108,8 +110,8 @@ inline Real QSin(Real a)
108110
angle = PI - angle; // FLIP
109111
}
110112

111-
register int index = REAL_TO_INT((angle/QUARTER_CIRCLE) * TheQuickTanTableCount);
112-
register Real x = TheQuickSinTable[index];
113+
REGISTER int index = REAL_TO_INT((angle/QUARTER_CIRCLE) * TheQuickTanTableCount);
114+
REGISTER Real x = TheQuickSinTable[index];
113115

114116
return x * sgn;
115117

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
#include "Common/UnitTimings.h" //Contains the DO_UNIT_TIMINGS define jba.
5454

55+
#include "Utility/CppMacros.h"
5556

5657
#define no_INTENSE_DEBUG
5758

@@ -2641,7 +2642,7 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
26412642
// // DEBUG_ASSERTCRASH(map[i][j].getZone() != 0, ("Cleared the zone."));
26422643
// }
26432644
// }
2644-
register UnsignedInt maxZone = m_maxZone;
2645+
REGISTER UnsignedInt maxZone = m_maxZone;
26452646
j=globalBounds.lo.y;
26462647
while( j <= globalBounds.hi.y )
26472648
{
@@ -2754,7 +2755,7 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
27542755
//FLATTEN HIERARCHICAL ZONES
27552756
{
27562757
i = 1;
2757-
register Int zone;
2758+
REGISTER Int zone;
27582759
while ( i < maxZone )
27592760
{ // Flatten hierarchical zones.
27602761
zone = m_hierarchicalZones[i];

GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/intersec.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "scene.h"
4242
#include "intersec.inl"
4343

44+
#include "Utility/CppMacros.h"
4445

4546
//////////////////////////////////////////////////////////////////////
4647
// Construction/Destruction
@@ -190,7 +191,7 @@ bool IntersectionClass::Intersect_Box(Vector3 &Box_Min, Vector3 &Box_Max, Inters
190191
float distance[PLANE_COUNT];
191192
float candidate_plane[PLANE_COUNT];
192193

193-
register Vector3 *intersection = &FinalResult->Intersection;
194+
REGISTER Vector3 *intersection = &FinalResult->Intersection;
194195

195196
// Find candidate planes and determine if the ray is outside the box
196197
for (counter = 0; counter < PLANE_COUNT; counter++) {

0 commit comments

Comments
 (0)