Skip to content

[GEN][ZH] Fix object deselection logic in BuildAssistant::sellObject() #1216

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 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 7 additions & 5 deletions Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,18 +1511,20 @@ void BuildAssistant::sellObject( Object *obj )
// set the model condition in the drawable for this object that will show the buildup
// scaffold and adjust the model height by construction percent
//
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED,
MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED, MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );

// TheSuperHackers @bugfix Mauller 27/06/2025 we need to deselect the object before setting it as unselectable
// If the object is set unselectable too soon, it fails to be removed from the selection group

// for everybody, unselect them at this time. You can't just deselect a drawable. Selection is a logic property.
TheGameLogic->deselectObject(obj, PLAYERMASK_ALL, TRUE);

//
// set this object as under de-construction (sold). It is still a legal target, since you get the money at
// the completion of sale.
//
obj->setStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_SOLD, OBJECT_STATUS_UNSELECTABLE ) );

// for everybody, unselect them at this time. You can't just deselect a drawable. Selection is a logic property.
TheGameLogic->deselectObject(obj, PLAYERMASK_ALL, TRUE);

//
// set the animation durations so that the regular build up loop animations can be
// done a bit faster for selling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1536,18 +1536,20 @@ void BuildAssistant::sellObject( Object *obj )
// set the model condition in the drawable for this object that will show the buildup
// scaffold and adjust the model height by construction percent
//
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED,
MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED, MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );

// TheSuperHackers @bugfix Mauller 27/06/2025 we need to deselect the object before setting it as unselectable
// If the object is set unselectable too soon, it fails to be removed from the selection group

// for everybody, unselect them at this time. You can't just deselect a drawable. Selection is a logic property.
TheGameLogic->deselectObject(obj, PLAYERMASK_ALL, TRUE);

//
// set this object as under de-construction (sold). It is still a legal target, since you get the money at
// the completion of sale.
//
obj->setStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_SOLD, OBJECT_STATUS_UNSELECTABLE ) );

// for everybody, unselect them at this time. You can't just deselect a drawable. Selection is a logic property.
TheGameLogic->deselectObject(obj, PLAYERMASK_ALL, TRUE);

//
// set the animation durations so that the regular build up loop animations can be
// done a bit faster for selling
Expand Down
Loading