Skip to content

Commit 7047265

Browse files
committed
refactor: Ensure stop command can be called on named objects without mismatching with retail
1 parent 74d1f34 commit 7047265

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5534,13 +5534,27 @@ void Object::doCommandButtonAtObject( const CommandButton *commandButton, Object
55345534
switch( commandButton->getCommandType() )
55355535
{
55365536
case GUI_COMMAND_COMBATDROP:
5537+
#if RETAIL_COMPATIBLE_CRC
5538+
if (!obj)
5539+
{
5540+
return;
5541+
}
5542+
#endif
5543+
55375544
if( ai )
55385545
{
55395546
ai->aiCombatDrop( obj, *(obj->getPosition()), cmdSource );
55405547
}
55415548
return;
55425549
case GUI_COMMAND_SPECIAL_POWER:
55435550
{
5551+
#if RETAIL_COMPATIBLE_CRC
5552+
if (!obj)
5553+
{
5554+
return;
5555+
}
5556+
#endif
5557+
55445558
if( commandButton->getSpecialPowerTemplate() )
55455559
{
55465560
CommandOption commandOptions = (CommandOption)(commandButton->getOptions() | COMMAND_FIRED_BY_SCRIPT);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5888,6 +5888,12 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString
58885888
theGroup->getCenter(&pos);
58895889

58905890
bestObj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters);
5891+
#if RETAIL_COMPATIBLE_CRC
5892+
if (!bestObj)
5893+
{
5894+
return;
5895+
}
5896+
#endif
58915897
}
58925898
else
58935899
{
@@ -5926,10 +5932,12 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString
59265932
}
59275933
}
59285934

5935+
#if !RETAIL_COMPATIBLE_CRC
59295936
if (!bestObj)
59305937
{
59315938
return;
59325939
}
5940+
#endif
59335941

59345942
// already been checked for validity
59355943
theGroup->groupDoCommandButtonAtObject(commandButton, bestObj, CMD_FROM_SCRIPT);

0 commit comments

Comments
 (0)