Skip to content

Commit

Permalink
Implemented automatic addition of units of the given group to the sel…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
Monsterovich committed Mar 9, 2024
1 parent 4416697 commit 4541dad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down

0 comments on commit 4541dad

Please sign in to comment.