Don't allow a player to acquire more construction vehicles than the max amount allowed.
Fixes ticket:2175 git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/2.3@11674 4a71c877-e1ca-e34f-864e-861f7616d084 (cherry picked from commit e6cd09968b23f0d7941cc6f15569fbe8c8ef8457)master
parent
58c0ceec95
commit
d6b47d1122
13
src/droid.c
13
src/droid.c
|
@ -4298,6 +4298,14 @@ DROID * giftSingleDroid(DROID *psD, UDWORD to)
|
||||||
|
|
||||||
if (droidRemove(psD, apsDroidLists)) // remove droid from one list
|
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))
|
if (!isHumanPlayer(psD->player))
|
||||||
{
|
{
|
||||||
droidSetName(psD, "Enemy Unit");
|
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
|
// add back into cluster system
|
||||||
clustNewDroid(psD);
|
clustNewDroid(psD);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue