Skip to content

Commit 1a8475d

Browse files
authored
[GEN][ZH] Fix object deselection logic in BuildAssistant::sellObject() (#1216)
1 parent 321ff11 commit 1a8475d

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,18 +1506,30 @@ void BuildAssistant::sellObject( Object *obj )
15061506
// set the model condition in the drawable for this object that will show the buildup
15071507
// scaffold and adjust the model height by construction percent
15081508
//
1509-
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED,
1510-
MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );
1509+
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED, MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );
15111510

1511+
#if RETAIL_COMPATIBLE_AIGROUP
15121512
//
15131513
// set this object as under de-construction (sold). It is still a legal target, since you get the money at
15141514
// the completion of sale.
15151515
//
15161516
obj->setStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_SOLD, OBJECT_STATUS_UNSELECTABLE ) );
1517+
#endif
1518+
1519+
// TheSuperHackers @bugfix Mauller 27/06/2025 we need to deselect the object before setting it as unselectable
1520+
// If the object is set unselectable too soon, it fails to be removed from the selection group
15171521

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

1525+
#if !RETAIL_COMPATIBLE_AIGROUP
1526+
//
1527+
// set this object as under de-construction (sold). It is still a legal target, since you get the money at
1528+
// the completion of sale.
1529+
//
1530+
obj->setStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_SOLD, OBJECT_STATUS_UNSELECTABLE ) );
1531+
#endif
1532+
15211533
//
15221534
// set the animation durations so that the regular build up loop animations can be
15231535
// done a bit faster for selling

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,18 +1531,30 @@ void BuildAssistant::sellObject( Object *obj )
15311531
// set the model condition in the drawable for this object that will show the buildup
15321532
// scaffold and adjust the model height by construction percent
15331533
//
1534-
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED,
1535-
MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );
1534+
obj->setModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_PARTIALLY_CONSTRUCTED, MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED) );
15361535

1536+
#if RETAIL_COMPATIBLE_AIGROUP
15371537
//
15381538
// set this object as under de-construction (sold). It is still a legal target, since you get the money at
15391539
// the completion of sale.
15401540
//
15411541
obj->setStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_SOLD, OBJECT_STATUS_UNSELECTABLE ) );
1542+
#endif
1543+
1544+
// TheSuperHackers @bugfix Mauller 27/06/2025 we need to deselect the object before setting it as unselectable
1545+
// If the object is set unselectable too soon, it fails to be removed from the selection group
15421546

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

1550+
#if !RETAIL_COMPATIBLE_AIGROUP
1551+
//
1552+
// set this object as under de-construction (sold). It is still a legal target, since you get the money at
1553+
// the completion of sale.
1554+
//
1555+
obj->setStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_SOLD, OBJECT_STATUS_UNSELECTABLE ) );
1556+
#endif
1557+
15461558
//
15471559
// set the animation durations so that the regular build up loop animations can be
15481560
// done a bit faster for selling

0 commit comments

Comments
 (0)