(produce_sect): Unless player->simulation, work directly on item
arrays instead of copies made by getvec(). This is safe, because the old code made single copies and always flushed them back into the unit structures. Else make copies by hand, not with getvec. (starv_sects): Replace getvec() by direct, read-only item access. (upd_buildeff, enlist, materials_charge, materials_cost, produce, grow_people, growfood, trunc_people, do_feed, feed_people): Change argument type to match uncopied item arrays. (growfood): Obey ITEM_MAX.
This commit is contained in:
parent
61d57719c2
commit
b62aca0ecd
5 changed files with 36 additions and 52 deletions
|
@ -103,7 +103,7 @@ starv_sects(s_char *range)
|
|||
struct nstr_sect nstr;
|
||||
struct sctstr sect;
|
||||
int nsect = 0;
|
||||
int vec[I_MAX + 1], s, needed;
|
||||
int s, needed;
|
||||
|
||||
if (!snxtsct(&nstr, range))
|
||||
return;
|
||||
|
@ -113,11 +113,10 @@ starv_sects(s_char *range)
|
|||
if (sect.sct_type == SCT_SANCT)
|
||||
continue;
|
||||
|
||||
getvec(VT_ITEM, vec, (s_char *)§, EF_SECTOR);
|
||||
/* This next 2 lines were added to overcompensate for the needy */
|
||||
if (vec[I_FOOD])
|
||||
vec[I_FOOD]--;
|
||||
s = feed_people(vec, etu_per_update, &needed);
|
||||
if (sect.sct_item[I_FOOD])
|
||||
sect.sct_item[I_FOOD]--;
|
||||
s = feed_people(sect.sct_item, etu_per_update, &needed);
|
||||
|
||||
if (s == 0)
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue