Skip to content

Commit 2e0cff4

Browse files
committed
[GEN] Fix misc compile errors for Generals build (#484)
1 parent 7a23cbc commit 2e0cff4

File tree

17 files changed

+68
-62
lines changed

17 files changed

+68
-62
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public: \
299299
inline DLINK_ITERATOR<OBJCLASS> iterate_##LISTNAME() const \
300300
{ \
301301
DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \
302-
return DLINK_ITERATOR<OBJCLASS>(m_dlinkhead_##LISTNAME.m_head, OBJCLASS::dlink_next_##LISTNAME); \
302+
return DLINK_ITERATOR<OBJCLASS>(m_dlinkhead_##LISTNAME.m_head, &OBJCLASS::dlink_next_##LISTNAME); \
303303
} \
304304
inline OBJCLASS *getFirstItemIn_##LISTNAME() const \
305305
{ \

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
4444
struct FieldParse;
45-
typedef enum _TerrainLOD;
45+
enum _TerrainLOD;
4646
class GlobalData;
4747
class INI;
4848
class WeaponBonusSet;

Generals/Code/GameEngine/Include/GameClient/Display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Display : public SubsystemInterface
6767
DRAW_IMAGE_ADDITIVE //additive blend the image into frame buffer
6868
};
6969

70-
typedef void (DebugDisplayCallback)( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp = NULL );
70+
typedef void (DebugDisplayCallback)( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp );
7171

7272
Display();
7373
virtual ~Display();

Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,14 @@ typedef AllObjectTypes::iterator AllObjectTypesIt;
122122
typedef std::vector<NamedReveal> VecNamedReveal;
123123
typedef VecNamedReveal::iterator VecNamedRevealIt;
124124

125-
class AttackPriorityInfo : public MemoryPoolObject, public Snapshot
125+
// TheSuperHackers @compile xezon 17/03/2025 Fixes destructor visibility by removing MemoryPoolObject base class.
126+
// MemoryPoolObject looks to be unnecessary because it is never dynamically allocated.
127+
class AttackPriorityInfo : public Snapshot
126128
{
127-
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AttackPriorityInfo, "AttackPriorityInfo")
128-
129-
// friend bad for MPOs. (srj)
130-
//friend class ScriptEngine;
131-
132129
public:
133130

134131
AttackPriorityInfo();
135-
//~AttackPriorityInfo();
132+
~AttackPriorityInfo();
136133

137134
public:
138135

@@ -150,7 +147,7 @@ class AttackPriorityInfo : public MemoryPoolObject, public Snapshot
150147

151148
protected:
152149

153-
// sanapshot methods
150+
// snapshot methods
154151
virtual void crc( Xfer *xfer );
155152
virtual void xfer( Xfer *xfer );
156153
virtual void loadPostProcess( void );

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m)
762762
theReleaseCrashLogFile = fopen(curbuf, "w");
763763
if (theReleaseCrashLogFile)
764764
{
765-
fprintf(theReleaseCrashLogFile, "Release Crash at %s; Reason %s\n", getCurrentTimeString(), mesg.str());
765+
fprintf(theReleaseCrashLogFile, "Release Crash at %s; Reason %ls\n", getCurrentTimeString(), mesg.str());
766766

767767
const int STACKTRACE_SIZE = 12;
768768
const int STACKTRACE_SKIP = 6;

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
255255

256256
Player *player = ThePlayerList->getLocalPlayer();
257257
UnicodeString name, cost, descrip;
258-
UnicodeString requires = UnicodeString::TheEmptyString, requiresList;
258+
UnicodeString requiresFormat = UnicodeString::TheEmptyString, requiresList;
259259
Bool firstRequirement = true;
260260
const ProductionPrerequisite *prereq;
261261
Bool fireScienceButton = false;
@@ -405,17 +405,17 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
405405
if (firstRequirement)
406406
firstRequirement = false;
407407
else
408-
requires.concat(L", ");
408+
requiresFormat.concat(L", ");
409409
}
410-
requires.concat(requiresList);
410+
requiresFormat.concat(requiresList);
411411
}
412-
if( !requires.isEmpty() )
412+
if( !requiresFormat.isEmpty() )
413413
{
414414
UnicodeString requireFormat = TheGameText->fetch("CONTROLBAR:Requirements");
415-
requires.format(requireFormat.str(), requires.str());
415+
requiresFormat.format(requireFormat.str(), requiresFormat.str());
416416
if(!descrip.isEmpty())
417417
descrip.concat(L"\n");
418-
descrip.concat(requires);
418+
descrip.concat(requiresFormat);
419419

420420
}
421421
}
@@ -496,17 +496,17 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
496496
if (firstRequirement)
497497
firstRequirement = false;
498498
else
499-
requires.concat(L", ");
499+
requiresFormat.concat(L", ");
500500
}
501-
requires.concat(requiresList);
501+
requiresFormat.concat(requiresList);
502502
}
503-
if( !requires.isEmpty() )
503+
if( !requiresFormat.isEmpty() )
504504
{
505505
UnicodeString requireFormat = TheGameText->fetch("CONTROLBAR:Requirements");
506-
requires.format(requireFormat.str(), requires.str());
506+
requiresFormat.format(requireFormat.str(), requiresFormat.str());
507507
if(!descrip.isEmpty())
508508
descrip.concat(L"\n");
509-
descrip.concat(requires);
509+
descrip.concat(requiresFormat);
510510
}
511511
}
512512

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ static AsciiString obfuscate( AsciiString in )
117117
{
118118
char *buf = NEW char[in.getLength() + 1];
119119
strcpy(buf, in.str());
120-
static const char *xor = "1337Munkee";
120+
static const char *xorWord = "1337Munkee";
121121
char *c = buf;
122-
const char *c2 = xor;
122+
const char *c2 = xorWord;
123123
while (*c)
124124
{
125125
if (!*c2)
126-
c2 = xor;
126+
c2 = xorWord;
127127
if (*c != *c2)
128128
*c = *c++ ^ *c2++;
129129
else

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ inline Real maxReal(Real a, Real b)
333333
//-----------------------------------------------------------------------------
334334

335335
//-----------------------------------------------------------------------------
336+
static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
337+
static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
338+
static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
339+
static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
340+
static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms);
341+
static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms);
342+
static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms);
343+
static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms);
336344

337345
static void projectCoord3D(Coord3D *coord, const Coord3D *unitDir, Real dist);
338346
static void flipCoord3D(Coord3D *coord);

Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,20 +2498,21 @@ void ScriptActions::doDisplayCinematicText(const AsciiString& displayText, const
24982498
char buf[256];
24992499
char *c;
25002500
strcpy(buf, fontType.str());
2501-
for( c = buf; c != '\0'; *c++ )
2501+
// TheSuperHackers @fix xezon 22/03/2025 Fixes potential buffer overrun via prior c!='\0' test.
2502+
for( c = buf; *c != '\0'; c++ )
25022503
{
25032504
if( *c != ' ' && *c++ != '-' )
25042505
fontName.concat(c);
25052506
else
25062507
break;
25072508
}
25082509
while( *c != ':' )
2509-
*c++;
2510-
*c++; // eat through " - Size:"
2510+
c++;
2511+
c++; // eat through " - Size:"
25112512

25122513
// get font size
25132514
AsciiString fontSize = AsciiString::TheEmptyString;
2514-
for( ; *c != '\0'; *c++ )
2515+
for( ; *c != '\0'; c++ )
25152516
{
25162517
if( *c != '\0' && *c != ' ' )
25172518
{

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,8 @@ void W3DVolumetricShadow::RenderMeshVolume(Int meshIndex, Int lightIndex, const
12991299
Matrix4 mWorld(*meshXform);
13001300

13011301
///@todo: W3D always does transpose on all of matrix sets. Slow??? Better to hack view matrix.
1302-
m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorld.Transpose());
1302+
Matrix4 mWorldTransposed = mWorld.Transpose();
1303+
m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed);
13031304

13041305
W3DBufferManager::W3DVertexBufferSlot *vbSlot=m_shadowVolumeVB[lightIndex][ meshIndex ];
13051306
if (!vbSlot)
@@ -1414,7 +1415,8 @@ void W3DVolumetricShadow::RenderDynamicMeshVolume(Int meshIndex, Int lightIndex,
14141415

14151416
Matrix4 mWorld(*meshXform);
14161417

1417-
m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorld.Transpose());
1418+
Matrix4 mWorldTransposed = mWorld.Transpose();
1419+
m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed);
14181420

14191421
if (shadowVertexBufferD3D != lastActiveVertexBuffer)
14201422
{ m_pDev->SetStreamSource(0,shadowVertexBufferD3D,sizeof(SHADOW_DYNAMIC_VOLUME_VERTEX));
@@ -1569,7 +1571,8 @@ void W3DVolumetricShadow::RenderMeshVolumeBounds(Int meshIndex, Int lightIndex,
15691571
//todo: replace this with mesh transform
15701572
Matrix4 mWorld(1); //identity since boxes are pre-transformed to world space.
15711573

1572-
m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorld.Transpose());
1574+
Matrix4 mWorldTransposed = mWorld.Transpose();
1575+
m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed);
15731576

15741577
m_pDev->SetStreamSource(0,shadowVertexBufferD3D,sizeof(SHADOW_DYNAMIC_VOLUME_VERTEX));
15751578
m_pDev->SetVertexShader(SHADOW_DYNAMIC_VOLUME_FVF);

0 commit comments

Comments
 (0)