Skip to content

Commit

Permalink
Don't allow a player to acquire more construction vehicles than the m…
Browse files Browse the repository at this point in the history
…ax 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 e6cd099)
  • Loading branch information
buginator committed Oct 19, 2010
1 parent 58c0cee commit d6b47d1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/droid.c
Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit d6b47d1

Please sign in to comment.