(deli, do_demo, lnd_sweep, guerrilla): Saturate items at ITEM_MAX.

With variables, item increases beyond the capacity of variables
(65535) were ignored here.

This should cover all item changes not going through putvec().
This commit is contained in:
Markus Armbruster 2004-03-05 06:48:57 +00:00
parent 95ef2b139d
commit 58e93c0ea3
4 changed files with 10 additions and 4 deletions

View file

@ -220,10 +220,9 @@ guerrilla(struct sctstr *sp)
if ((tnat->nat_stat & STAT_INUSE) == 0) {
/* target nation has dissolved: che's retire. */
logerror("%d Che targeted at country %d retiring", che, target);
civ += che;
sp->sct_che = 0;
sp->sct_che_target = 0;
sp->sct_item[I_CIVIL] = civ;
sp->sct_item[I_CIVIL] = min(civ + che, ITEM_MAX);
return;
}
@ -347,6 +346,10 @@ guerrilla(struct sctstr *sp)
sp->sct_newtype = SCT_AGRI;
n = civ / 20;
civ -= n;
if (civ > ITEM_MAX) {
uw = ITEM_MAX - civ;
civ = ITEM_MAX;
}
sp->sct_item[I_CIVIL] = civ;
sp->sct_item[I_UW] = uw;
sp->sct_item[I_MILIT] = n;