(item_prewrite): New.
(checksect, shp_prewrite, lnd_prewrite): Use it.
This commit is contained in:
parent
311ad32a88
commit
1e1f8088a8
4 changed files with 22 additions and 2 deletions
|
@ -75,11 +75,26 @@ sct_prewrite(int id, s_char *ptr)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
item_prewrite(short *item)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= I_MAX; ++i) {
|
||||
if (CANT_HAPPEN(item[i] < 0))
|
||||
item[i] = 0;
|
||||
else if (CANT_HAPPEN(item[i] > ITEM_MAX))
|
||||
item[i] = ITEM_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
checksect(struct sctstr *sp)
|
||||
{
|
||||
int mil, civs, loyalcivs;
|
||||
|
||||
item_prewrite(sp->sct_item);
|
||||
|
||||
/* shouldn't happen, but... */
|
||||
if (sp->sct_mobil > 127)
|
||||
sp->sct_mobil = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue