From 83ee195c68183a12ca508caa0cc08b503db1b1a5 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 29 Jun 2025 10:56:32 +0100 Subject: [PATCH] [GEN][ZH] fix object deselection logic in BuildAssistant::sellObject() --- .../Source/Common/System/BuildAssistant.cpp | 12 +++++++----- .../Source/Common/System/BuildAssistant.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 9a700aacbc..c775ae4db7 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -1511,8 +1511,13 @@ 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 @@ -1520,9 +1525,6 @@ void BuildAssistant::sellObject( Object *obj ) // 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 diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 03a13937e2..f5cb417f38 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -1536,8 +1536,13 @@ 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 @@ -1545,9 +1550,6 @@ void BuildAssistant::sellObject( Object *obj ) // 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