(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
|
@ -46,15 +46,14 @@
|
|||
#include "optlist.h"
|
||||
#include "budg.h"
|
||||
|
||||
static void materials_charge(struct pchrstr *, register int *,
|
||||
register int);
|
||||
static int materials_cost(struct pchrstr *, register int *, int *);
|
||||
static void materials_charge(struct pchrstr *, short *, int);
|
||||
static int materials_cost(struct pchrstr *, short *, int *);
|
||||
|
||||
s_char *levelnames[] =
|
||||
{ "Technology", "Research", "Education", "Happiness" };
|
||||
|
||||
int
|
||||
produce(struct natstr *np, struct sctstr *sp, int *vec, int work,
|
||||
produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
||||
int desig, int neweff, int *cost, int *amount)
|
||||
{
|
||||
register struct pchrstr *product;
|
||||
|
@ -190,7 +189,7 @@ produce(struct natstr *np, struct sctstr *sp, int *vec, int work,
|
|||
}
|
||||
|
||||
static int
|
||||
materials_cost(struct pchrstr *product, register int *vec, int *costp)
|
||||
materials_cost(struct pchrstr *product, short *vec, int *costp)
|
||||
{
|
||||
register u_char *vp;
|
||||
register u_short *ap;
|
||||
|
@ -216,8 +215,7 @@ materials_cost(struct pchrstr *product, register int *vec, int *costp)
|
|||
}
|
||||
|
||||
static void
|
||||
materials_charge(struct pchrstr *product, register int *vec,
|
||||
register int count)
|
||||
materials_charge(struct pchrstr *product, short *vec, int count)
|
||||
{
|
||||
register u_char *vp;
|
||||
register u_short *ap;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue