Skip to content

Commit d19cccd

Browse files
authored
[GEN][ZH] Make games compile with clang-cl in VS2022 (#888)
1 parent 887892d commit d19cccd

File tree

36 files changed

+123
-110
lines changed

36 files changed

+123
-110
lines changed

Core/Libraries/Source/WWVegas/WW3D2/prim_anim.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class LERPAnimationChannelClass : public PrimitiveAnimationChannelClass<T>
163163
using PrimitiveAnimationChannelClass<T>::m_Data;
164164
using PrimitiveAnimationChannelClass<T>::m_LastIndex;
165165
public:
166-
using PrimitiveAnimationChannelClass<T>::KeyClass;
166+
using typename PrimitiveAnimationChannelClass<T>::KeyClass;
167167

168168
public:
169169

@@ -187,7 +187,7 @@ int PrimitiveAnimationChannelClass<T>::Get_Key_Count (void) const
187187
// Set_Key_Value
188188
/////////////////////////////////////////////////////////
189189
template<class T>
190-
typename const PrimitiveAnimationChannelClass<T>::KeyClass &PrimitiveAnimationChannelClass<T>::Get_Key (int index) const
190+
const PrimitiveAnimationChannelClass<T>::KeyClass &PrimitiveAnimationChannelClass<T>::Get_Key (int index) const
191191
{
192192
return m_Data[index];
193193
}

Generals/Code/GameEngine/Include/Common/BorderColors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
struct BorderColor
2424
{
2525
const char *m_colorName;
26-
long m_borderColor;
26+
unsigned long m_borderColor;
2727
};
2828

2929
const BorderColor BORDER_COLORS[] =

Generals/Code/GameEngine/Source/Common/BitFlags.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "Common/ModelState.h"
3838
#include "GameLogic/ArmorSet.h"
3939

40+
template<>
4041
const char* ModelConditionFlags::s_bitNameList[] =
4142
{
4243
"TOPPLED",
@@ -147,7 +148,8 @@ const char* ModelConditionFlags::s_bitNameList[] =
147148

148149
NULL
149150
};
150-
151+
152+
template<>
151153
const char* ArmorSetFlags::s_bitNameList[] =
152154
{
153155
"VETERAN",

Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ SpecialPowerStore *TheSpecialPowerStore = NULL;
5353
///////////////////////////////////////////////////////////////////////////////////////////////////
5454

5555
// Externs ////////////////////////////////////////////////////////////////////////////////////////
56+
template<>
5657
const char* SpecialPowerMaskType::s_bitNameList[] =
5758
{
5859
"SPECIAL_INVALID",

Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "Common/DisabledTypes.h"
3131
#include "Common/BitFlagsIO.h"
3232

33+
template<>
3334
const char* DisabledMaskType::s_bitNameList[] =
3435
{
3536
"DEFAULT",

Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ MemoryPoolBlob* MemoryPool::createBlob(Int allocationCount)
15781578
{
15791579
DEBUG_ASSERTCRASH(allocationCount > 0 && allocationCount%MEM_BOUND_ALIGNMENT==0, ("bad allocationCount (must be >0 and evenly divisible by %d)",MEM_BOUND_ALIGNMENT));
15801580

1581-
MemoryPoolBlob* blob = new (::sysAllocate(sizeof MemoryPoolBlob)) MemoryPoolBlob; // will throw on failure
1581+
MemoryPoolBlob* blob = new (::sysAllocate(sizeof(MemoryPoolBlob))) MemoryPoolBlob; // will throw on failure
15821582

15831583
blob->initBlob(this, allocationCount); // will throw on failure
15841584

@@ -2674,7 +2674,7 @@ MemoryPool *MemoryPoolFactory::createMemoryPool(const char *poolName, Int alloca
26742674
throw ERROR_OUT_OF_MEMORY;
26752675
}
26762676

2677-
pool = new (::sysAllocate(sizeof MemoryPool)) MemoryPool; // will throw on failure
2677+
pool = new (::sysAllocate(sizeof(MemoryPool))) MemoryPool; // will throw on failure
26782678
pool->init(this, poolName, allocationSize, initialAllocationCount, overflowAllocationCount); // will throw on failure
26792679

26802680
pool->addToList(&m_firstPoolInFactory);
@@ -2730,7 +2730,7 @@ DynamicMemoryAllocator *MemoryPoolFactory::createDynamicMemoryAllocator(Int numS
27302730
{
27312731
DynamicMemoryAllocator *dma;
27322732

2733-
dma = new (::sysAllocate(sizeof DynamicMemoryAllocator)) DynamicMemoryAllocator; // will throw on failure
2733+
dma = new (::sysAllocate(sizeof(DynamicMemoryAllocator))) DynamicMemoryAllocator; // will throw on failure
27342734
dma->init(this, numSubPools, pParms); // will throw on failure
27352735

27362736
dma->addToList(&m_firstDmaInFactory);
@@ -3425,7 +3425,7 @@ void initMemoryManager()
34253425
Int numSubPools;
34263426
const PoolInitRec *pParms;
34273427
userMemoryManagerGetDmaParms(&numSubPools, &pParms);
3428-
TheMemoryPoolFactory = new (::sysAllocate(sizeof MemoryPoolFactory)) MemoryPoolFactory; // will throw on failure
3428+
TheMemoryPoolFactory = new (::sysAllocate(sizeof(MemoryPoolFactory))) MemoryPoolFactory; // will throw on failure
34293429
TheMemoryPoolFactory->init(); // will throw on failure
34303430
TheDynamicMemoryAllocator = TheMemoryPoolFactory->createDynamicMemoryAllocator(numSubPools, pParms); // will throw on failure
34313431
userMemoryManagerInitPools();
@@ -3471,7 +3471,6 @@ void initMemoryManager()
34713471
#endif
34723472
{
34733473
DEBUG_CRASH(("Wrong operator new/delete linked in! Fix this...\n"));
3474-
exit(-1);
34753474
}
34763475

34773476
theMainInitFlag = true;
@@ -3500,7 +3499,7 @@ static void preMainInitMemoryManager()
35003499
Int numSubPools;
35013500
const PoolInitRec *pParms;
35023501
userMemoryManagerGetDmaParms(&numSubPools, &pParms);
3503-
TheMemoryPoolFactory = new (::sysAllocate(sizeof MemoryPoolFactory)) MemoryPoolFactory; // will throw on failure
3502+
TheMemoryPoolFactory = new (::sysAllocate(sizeof(MemoryPoolFactory))) MemoryPoolFactory; // will throw on failure
35043503
TheMemoryPoolFactory->init(); // will throw on failure
35053504

35063505
TheDynamicMemoryAllocator = TheMemoryPoolFactory->createDynamicMemoryAllocator(numSubPools, pParms); // will throw on failure

Generals/Code/GameEngine/Source/Common/System/KindOf.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "Common/KindOf.h"
3232
#include "Common/BitFlagsIO.h"
3333

34+
template<>
3435
const char* KindOfMaskType::s_bitNameList[] =
3536
{
3637
"OBSTACLE",

Generals/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "Common/ObjectStatusTypes.h"
3333
#include "Common/BitFlagsIO.h"
3434

35+
template<>
3536
const char* ObjectStatusMaskType::s_bitNameList[] =
3637
{
3738
"NONE",

Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
// PUBLIC DATA ////////////////////////////////////////////////////////////////////////////////////
6464
///////////////////////////////////////////////////////////////////////////////////////////////////
6565

66+
template<>
6667
const char* WeaponSetFlags::s_bitNameList[] =
6768
{
6869
"VETERAN",

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,19 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData )
172172
IRegion2D topHorizontal1 ={pos.x, pos.y, pos.x + size.x, pos.y };
173173
IRegion2D topHorizontal1drop ={pos.x, pos.y+1, pos.x + size.x, pos.y+1 };
174174

175-
IRegion2D topHorizontal2 ={pos.x, pos.y + (size.y * .1) , pos.x + size.x, pos.y + (size.y * .1) };
176-
IRegion2D topHorizontal2drop ={pos.x, pos.y + (size.y * .12) , pos.x + size.x, pos.y + (size.y * .12) };
175+
IRegion2D topHorizontal2 ={pos.x, pos.y + Int(size.y * .1) , pos.x + size.x, pos.y + Int(size.y * .1) };
176+
IRegion2D topHorizontal2drop ={pos.x, pos.y + Int(size.y * .12) , pos.x + size.x, pos.y + Int(size.y * .12) };
177177

178-
IRegion2D bottomHorizontal1={pos.x, pos.y + (size.y * .9), pos.x + size.x, pos.y + (size.y * .9) };
179-
IRegion2D bottomHorizontal1drop={pos.x, pos.y + (size.y * .92), pos.x + size.x, pos.y + (size.y * .92) };
178+
IRegion2D bottomHorizontal1={pos.x, pos.y + Int(size.y * .9), pos.x + size.x, pos.y + Int(size.y * .9) };
179+
IRegion2D bottomHorizontal1drop={pos.x, pos.y + Int(size.y * .92), pos.x + size.x, pos.y + Int(size.y * .92) };
180180

181181
IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y };
182182
IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 };
183183

184-
IRegion2D verticle1 ={pos.x + (size.x * .225), pos.y , pos.x + (size.x * .225), height };
185-
IRegion2D verticle2 ={pos.x + (size.x * .445), pos.y, pos.x + (size.x * .445), height };
186-
IRegion2D verticle3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height };
187-
IRegion2D verticle4 ={pos.x + (size.x * .885), pos.y , pos.x + (size.x * .885), height };
184+
IRegion2D verticle1 ={pos.x + Int(size.x * .225), pos.y , pos.x + Int(size.x * .225), height };
185+
IRegion2D verticle2 ={pos.x + Int(size.x * .445), pos.y, pos.x + Int(size.x * .445), height };
186+
IRegion2D verticle3 ={pos.x + Int(size.x * .6662), pos.y, pos.x + Int(size.x * .6662), height };
187+
IRegion2D verticle4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height };
188188
// static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) };
189189
// static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) };
190190

@@ -236,19 +236,19 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData )
236236
IRegion2D topHorizontal1 ={pos.x, pos.y, pos.x + size.x, pos.y };
237237
IRegion2D topHorizontal1drop ={pos.x, pos.y+1, pos.x + size.x, pos.y+1 };
238238

239-
IRegion2D topHorizontal2 ={pos.x, pos.y + (size.y * .1) , pos.x + size.x, pos.y + (size.y * .1) };
240-
IRegion2D topHorizontal2drop ={pos.x, pos.y + (size.y * .12) , pos.x + size.x, pos.y + (size.y * .12) };
239+
IRegion2D topHorizontal2 ={pos.x, pos.y + Int(size.y * .1) , pos.x + size.x, pos.y + Int(size.y * .1) };
240+
IRegion2D topHorizontal2drop ={pos.x, pos.y + Int(size.y * .12) , pos.x + size.x, pos.y + Int(size.y * .12) };
241241

242-
IRegion2D bottomHorizontal1={pos.x, pos.y + (size.y * .9), pos.x + size.x, pos.y + (size.y * .9) };
243-
IRegion2D bottomHorizontal1drop={pos.x, pos.y + (size.y * .92), pos.x + size.x, pos.y + (size.y * .92) };
242+
IRegion2D bottomHorizontal1={pos.x, pos.y + Int(size.y * .9), pos.x + size.x, pos.y + Int(size.y * .9) };
243+
IRegion2D bottomHorizontal1drop={pos.x, pos.y + Int(size.y * .92), pos.x + size.x, pos.y + Int(size.y * .92) };
244244

245245
IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y };
246246
IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 };
247247

248-
IRegion2D verticle1 ={pos.x + (size.x * .295), pos.y , pos.x + (size.x * .295), height };
249-
IRegion2D verticle2 ={pos.x + (size.x * .59), pos.y, pos.x + (size.x * .59), height };
248+
IRegion2D verticle1 ={pos.x + Int(size.x * .295), pos.y , pos.x + Int(size.x * .295), height };
249+
IRegion2D verticle2 ={pos.x + Int(size.x * .59), pos.y, pos.x + Int(size.x * .59), height };
250250
//IRegion2D verticle3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height };
251-
IRegion2D verticle4 ={pos.x + (size.x * .885), pos.y , pos.x + (size.x * .885), height };
251+
IRegion2D verticle4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height };
252252
// static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) };
253253
// static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) };
254254

0 commit comments

Comments
 (0)