Skip to content

[GEN] Backport structure multi selection fix from Zero Hour #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,15 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
else
{

Drawable *draw = TheInGameUI->getFirstSelectedDrawable();
if( draw && draw->isKindOf( KINDOF_STRUCTURE ) )
{
//Kris: Jan 12, 2005
//Can't select other units if you have a structure selected. So deselect the structure to prevent
//group force attack exploit.
TheInGameUI->deselectAllDrawables();
}

// no need to send two messages for selecting the same group.
TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_ADD_TEAM0 + group));
Player *player = ThePlayerList->getLocalPlayer();
Expand Down
10 changes: 10 additions & 0 deletions Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5263,6 +5263,16 @@ StateReturnType AIAttackState::onEnter()
if (m_attackParameters && m_attackParameters->shouldExit(getMachine()))
return STATE_SUCCESS;


//Kris: Jan 12, 2005
//Don't allow units under construction to attack! The selection/action manager system was responsible for preventing this
//from ever happening, but failed in two cases which I fixed. This is an extra check to mitigate cheats.
if( source->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) )
{
return STATE_FAILURE;
}


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can remove the extra added white space before and after this block, then this should be good to go.

// if all of our weapons are out of ammo, can't attack.
// (this can happen for units which never auto-reload, like the Raptor)
if (source->isOutOfAmmo() && !source->isKindOf(KINDOF_PROJECTILE))
Expand Down
Loading