From 4541dadfafd6ee17003c6781b81397def8193ea7 Mon Sep 17 00:00:00 2001 From: Nikolay Borodin Date: Sat, 9 Mar 2024 19:01:48 +0200 Subject: [PATCH] Implemented automatic addition of units of the given group to the selection --- src/structure.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/structure.cpp b/src/structure.cpp index 522e63ef884..f2216242639 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -2487,6 +2487,22 @@ static bool structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl, DR { psNewDroid->group = psStructure->productToGroup; intGroupsChanged(psNewDroid->group); // update groups UI + + // if the whole group is selected, add new droids of this group to the selection after production + bool bPutToGroup = true; + for (DROID *psDroid : apsDroidLists[psNewDroid->player]) + { + if (psDroid->group == psNewDroid->group && !psDroid->selected) + { + bPutToGroup = false; + break; + } + } + + if (bPutToGroup) + { + SelectDroid(psNewDroid); + } } setFactorySecondaryState(psNewDroid, psStructure); const auto mapCoord = map_coord({x, y});