(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:
parent
95ef2b139d
commit
58e93c0ea3
4 changed files with 10 additions and 4 deletions
|
@ -101,7 +101,8 @@ deli(void)
|
||||||
if (!check_sect_ok(§))
|
if (!check_sect_ok(§))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
del = thresh + dir;
|
thresh = min(thresh, ITEM_MAX) & ~7;
|
||||||
|
del = thresh | dir;
|
||||||
sect.sct_del[ich->i_vtype] = del;
|
sect.sct_del[ich->i_vtype] = del;
|
||||||
putsect(§);
|
putsect(§);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,8 @@ do_demo(struct natstr *natp, struct nstr_sect nstr, int number, s_char *p,
|
||||||
continue;
|
continue;
|
||||||
} else if ((deltamil = min(mil, number)) <= 0)
|
} else if ((deltamil = min(mil, number)) <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
if (deltamil > ITEM_MAX - civ)
|
||||||
|
deltamil = ITEM_MAX - civ;
|
||||||
civ += deltamil;
|
civ += deltamil;
|
||||||
mil -= deltamil;
|
mil -= deltamil;
|
||||||
mil_demob += deltamil;
|
mil_demob += deltamil;
|
||||||
|
|
|
@ -715,7 +715,7 @@ lnd_sweep(struct emp_qelem *land_list, int verbose, int takemob,
|
||||||
mines--;
|
mines--;
|
||||||
if (lshells < max)
|
if (lshells < max)
|
||||||
++lshells;
|
++lshells;
|
||||||
else
|
else if (sshells < ITEM_MAX)
|
||||||
++sshells;
|
++sshells;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,10 +220,9 @@ guerrilla(struct sctstr *sp)
|
||||||
if ((tnat->nat_stat & STAT_INUSE) == 0) {
|
if ((tnat->nat_stat & STAT_INUSE) == 0) {
|
||||||
/* target nation has dissolved: che's retire. */
|
/* target nation has dissolved: che's retire. */
|
||||||
logerror("%d Che targeted at country %d retiring", che, target);
|
logerror("%d Che targeted at country %d retiring", che, target);
|
||||||
civ += che;
|
|
||||||
sp->sct_che = 0;
|
sp->sct_che = 0;
|
||||||
sp->sct_che_target = 0;
|
sp->sct_che_target = 0;
|
||||||
sp->sct_item[I_CIVIL] = civ;
|
sp->sct_item[I_CIVIL] = min(civ + che, ITEM_MAX);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +346,10 @@ guerrilla(struct sctstr *sp)
|
||||||
sp->sct_newtype = SCT_AGRI;
|
sp->sct_newtype = SCT_AGRI;
|
||||||
n = civ / 20;
|
n = civ / 20;
|
||||||
civ -= n;
|
civ -= n;
|
||||||
|
if (civ > ITEM_MAX) {
|
||||||
|
uw = ITEM_MAX - civ;
|
||||||
|
civ = ITEM_MAX;
|
||||||
|
}
|
||||||
sp->sct_item[I_CIVIL] = civ;
|
sp->sct_item[I_CIVIL] = civ;
|
||||||
sp->sct_item[I_UW] = uw;
|
sp->sct_item[I_UW] = uw;
|
||||||
sp->sct_item[I_MILIT] = n;
|
sp->sct_item[I_MILIT] = n;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue