Skip to content

Commit e6384bd

Browse files
authored
[GEN] Backport fix to prevent building multi-selection from Zero Hour (#1305)
This was supposed to fix Scud Bug
1 parent 3eda4ba commit e6384bd

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,15 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
11221122
else
11231123
{
11241124

1125+
Drawable *draw = TheInGameUI->getFirstSelectedDrawable();
1126+
if( draw && draw->isKindOf( KINDOF_STRUCTURE ) )
1127+
{
1128+
//Kris: Jan 12, 2005
1129+
//Can't select other units if you have a structure selected. So deselect the structure to prevent
1130+
//group force attack exploit.
1131+
TheInGameUI->deselectAllDrawables();
1132+
}
1133+
11251134
// no need to send two messages for selecting the same group.
11261135
TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_ADD_TEAM0 + group));
11271136
Player *player = ThePlayerList->getLocalPlayer();

Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5312,6 +5312,14 @@ StateReturnType AIAttackState::onEnter()
53125312
if (m_attackParameters && m_attackParameters->shouldExit(getMachine()))
53135313
return STATE_SUCCESS;
53145314

5315+
//Kris: Jan 12, 2005
5316+
//Don't allow units under construction to attack! The selection/action manager system was responsible for preventing this
5317+
//from ever happening, but failed in two cases which I fixed. This is an extra check to mitigate cheats.
5318+
if( source->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) )
5319+
{
5320+
return STATE_FAILURE;
5321+
}
5322+
53155323
// if all of our weapons are out of ammo, can't attack.
53165324
// (this can happen for units which never auto-reload, like the Raptor)
53175325
if (source->isOutOfAmmo() && !source->isKindOf(KINDOF_PROJECTILE))

0 commit comments

Comments
 (0)