diff --git a/src/droid.c b/src/droid.c index 9f6efd320..eadec8dfa 100644 --- a/src/droid.c +++ b/src/droid.c @@ -4298,6 +4298,14 @@ DROID * giftSingleDroid(DROID *psD, UDWORD to) if (droidRemove(psD, apsDroidLists)) // remove droid from one list { + if (psD->droidType == DROID_CYBORG_CONSTRUCT || psD->droidType == DROID_CONSTRUCT) + { + if (getNumConstructorDroids(selectedPlayer) > MAX_CONSTRUCTOR_DROIDS) + { + CONPRINTF(ConsoleString, (ConsoleString, _("%s wanted to give you a %s but you have too many!"), getPlayerName(psD->player), psD->aName)); + return NULL; + } + } if (!isHumanPlayer(psD->player)) { droidSetName(psD, "Enemy Unit"); @@ -4332,6 +4340,11 @@ DROID * giftSingleDroid(DROID *psD, UDWORD to) } } } + else + { + // if we couldn't remove it, then get rid of it. + return NULL; + } // add back into cluster system clustNewDroid(psD);