diff --git a/src/cmddroid.cpp b/src/cmddroid.cpp index 547c67a807c..c9e61d1377d 100644 --- a/src/cmddroid.cpp +++ b/src/cmddroid.cpp @@ -129,7 +129,7 @@ bool cmdDroidAddDroid(DROID *psCommander, DROID *psDroid) { psDroid->group = fallbackDroidGroup; psDroid->fallbackGroup = UBYTE_MAX; - // fixme: SelectNewDroid doesn't work here for some reason + SelectNewDroid(psDroid); } } diff --git a/src/droid.cpp b/src/droid.cpp index 81de1d38bab..3fa5e4d006d 100644 --- a/src/droid.cpp +++ b/src/droid.cpp @@ -1230,6 +1230,7 @@ void droidWasFullyRepairedAny(DROID *psDroid) { psDroid->group = psDroid->repairGroup; psDroid->repairGroup = UBYTE_MAX; + SelectNewDroid(psDroid); intGroupsChanged(psDroid->group); // update groups UI } } @@ -3497,6 +3498,11 @@ void SelectNewDroid(DROID *psNewDroid) std::vector groupDroids; for (DROID *psDroid : apsDroidLists[psNewDroid->player]) { + // skip itself + if (psDroid == psNewDroid) + { + continue; + } if (psDroid->group == psNewDroid->group) { groupDroids.push_back(psDroid);