Skip to content

Commit d001380

Browse files
committed
[ZH] Fix misc compile errors for Zero Hour build (TheSuperHackers#426)
1 parent b5f6d65 commit d001380

File tree

23 files changed

+83
-75
lines changed

23 files changed

+83
-75
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public: \
318318
inline DLINK_ITERATOR<OBJCLASS> iterate_##LISTNAME() const \
319319
{ \
320320
DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \
321-
return DLINK_ITERATOR<OBJCLASS>(m_dlinkhead_##LISTNAME.m_head, OBJCLASS::dlink_next_##LISTNAME); \
321+
return DLINK_ITERATOR<OBJCLASS>(m_dlinkhead_##LISTNAME.m_head, &OBJCLASS::dlink_next_##LISTNAME); \
322322
} \
323323
inline OBJCLASS *getFirstItemIn_##LISTNAME() const \
324324
{ \

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

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

4545
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
4646
struct FieldParse;
47-
typedef enum _TerrainLOD;
47+
enum _TerrainLOD;
4848
class GlobalData;
4949
class INI;
5050
class WeaponBonusSet;

GeneralsMD/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();

GeneralsMD/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 );

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

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

776776
const int STACKTRACE_SIZE = 12;
777777
const int STACKTRACE_SKIP = 6;

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

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

254254
Player *player = ThePlayerList->getLocalPlayer();
255255
UnicodeString name, cost, descrip;
256-
UnicodeString requires = UnicodeString::TheEmptyString, requiresList;
256+
UnicodeString requiresFormat = UnicodeString::TheEmptyString, requiresList;
257257
Bool firstRequirement = true;
258258
const ProductionPrerequisite *prereq;
259259
Bool fireScienceButton = false;
@@ -425,17 +425,17 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
425425
if (firstRequirement)
426426
firstRequirement = false;
427427
else
428-
requires.concat(L", ");
428+
requiresFormat.concat(L", ");
429429
}
430-
requires.concat(requiresList);
430+
requiresFormat.concat(requiresList);
431431
}
432-
if( !requires.isEmpty() )
432+
if( !requiresFormat.isEmpty() )
433433
{
434434
UnicodeString requireFormat = TheGameText->fetch("CONTROLBAR:Requirements");
435-
requires.format(requireFormat.str(), requires.str());
435+
requiresFormat.format(requireFormat.str(), requiresFormat.str());
436436
if(!descrip.isEmpty())
437437
descrip.concat(L"\n");
438-
descrip.concat(requires);
438+
descrip.concat(requiresFormat);
439439

440440
}
441441
}
@@ -514,8 +514,8 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
514514
{
515515
if( !descrip.isEmpty() )
516516
descrip.concat(L"\n");
517-
requires.format( TheGameText->fetch( "CONTROLBAR:Requirements" ).str(), TheGameText->fetch( "CONTROLBAR:GeneralsPromotion" ).str() );
518-
descrip.concat( requires );
517+
requiresFormat.format( TheGameText->fetch( "CONTROLBAR:Requirements" ).str(), TheGameText->fetch( "CONTROLBAR:GeneralsPromotion" ).str() );
518+
descrip.concat( requiresFormat );
519519
}
520520
}
521521
}
@@ -543,17 +543,17 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
543543
if (firstRequirement)
544544
firstRequirement = false;
545545
else
546-
requires.concat(L", ");
546+
requiresFormat.concat(L", ");
547547
}
548-
requires.concat(requiresList);
548+
requiresFormat.concat(requiresList);
549549
}
550-
if( !requires.isEmpty() )
550+
if( !requiresFormat.isEmpty() )
551551
{
552552
UnicodeString requireFormat = TheGameText->fetch("CONTROLBAR:Requirements");
553-
requires.format(requireFormat.str(), requires.str());
553+
requiresFormat.format(requireFormat.str(), requiresFormat.str());
554554
if(!descrip.isEmpty())
555555
descrip.concat(L"\n");
556-
descrip.concat(requires);
556+
descrip.concat(requiresFormat);
557557
}
558558
}
559559

GeneralsMD/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

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

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

339339
//-----------------------------------------------------------------------------
340+
static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
341+
static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
342+
static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
343+
static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
344+
static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms);
345+
static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms);
346+
static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms);
347+
static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms);
340348

341349
static void projectCoord3D(Coord3D *coord, const Coord3D *unitDir, Real dist);
342350
static void flipCoord3D(Coord3D *coord);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,20 +2575,21 @@ void ScriptActions::doDisplayCinematicText(const AsciiString& displayText, const
25752575
char buf[256];
25762576
char *c;
25772577
strcpy(buf, fontType.str());
2578-
for( c = buf; c != '\0'; *c++ )
2578+
// TheSuperHackers @fix xezon 16/03/2025 Fixes potential buffer overrun via prior c!='\0' test.
2579+
for( c = buf; *c != '\0'; c++ )
25792580
{
25802581
if( *c != ' ' && *c++ != '-' )
25812582
fontName.concat(c);
25822583
else
25832584
break;
25842585
}
25852586
while( *c != ':' )
2586-
*c++;
2587-
*c++; // eat through " - Size:"
2587+
c++;
2588+
c++; // eat through " - Size:"
25882589

25892590
// get font size
25902591
AsciiString fontSize = AsciiString::TheEmptyString;
2591-
for( ; *c != '\0'; *c++ )
2592+
for( ; *c != '\0'; c++ )
25922593
{
25932594
if( *c != '\0' && *c != ' ' )
25942595
{

GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/camerashakesystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ class CameraShakeSystemClass
7373
bool IsCameraShaking(void);
7474
void Update_Camera_Shaker(Vector3 camera_position, Vector3 * shaker_angles);
7575

76-
protected:
77-
7876
/**
7977
** CameraShakerClass
8078
** This class encapsulates the current state of a camera shaker. It is a multi-list object
@@ -102,6 +100,8 @@ class CameraShakeSystemClass
102100
Vector3 Phi;
103101
};
104102

103+
protected:
104+
105105
MultiListClass<CameraShakerClass> CameraShakerList;
106106

107107
};

0 commit comments

Comments
 (0)