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 e1e5832
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,27 @@ 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)
{
continue;
}

if (!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 e1e5832

Please sign in to comment.