(dodeliver): Remove parameter vec, work with sp->sct_item[] instead.
This is safe, because the only caller passed a copy of the latter created with getvec(), and dodeliver() doesn't change it. Caller changed. Return value no longer needed, remove.
This commit is contained in:
parent
a46cee180a
commit
d68a0b96c6
3 changed files with 7 additions and 17 deletions
|
@ -615,7 +615,7 @@ extern void guerrilla(struct sctstr *);
|
|||
/* sail.c */
|
||||
extern void sail_ship(natid);
|
||||
/* sect.c */
|
||||
extern int dodeliver(struct sctstr *, int *);
|
||||
extern void dodeliver(struct sctstr *);
|
||||
extern void do_fallout(register struct sctstr *, register int);
|
||||
extern void spread_fallout(struct sctstr *, int);
|
||||
extern void decay_fallout(struct sctstr *, int);
|
||||
|
|
|
@ -80,8 +80,6 @@ finish_sects(int etu)
|
|||
register struct sctstr *sp;
|
||||
struct natstr *np;
|
||||
int n;
|
||||
int vec[I_MAX + 1];
|
||||
int changed;
|
||||
struct distinfo *infptr;
|
||||
|
||||
if (g_distptrs == (struct distinfo *)0) {
|
||||
|
@ -112,11 +110,7 @@ finish_sects(int etu)
|
|||
np = getnatp(sp->sct_own);
|
||||
if (np->nat_money < 0)
|
||||
continue;
|
||||
changed = 0;
|
||||
if (getvec(VT_ITEM, vec, (s_char *)sp, EF_SECTOR) > 0)
|
||||
changed += dodeliver(sp, vec);
|
||||
if (changed)
|
||||
putvec(VT_ITEM, vec, (s_char *)sp, EF_SECTOR);
|
||||
dodeliver(sp);
|
||||
}
|
||||
logerror("done delivering\n");
|
||||
|
||||
|
|
|
@ -55,34 +55,30 @@
|
|||
#include "lost.h"
|
||||
#include "gen.h"
|
||||
|
||||
int
|
||||
dodeliver(struct sctstr *sp, int *vec)
|
||||
void
|
||||
dodeliver(struct sctstr *sp)
|
||||
{
|
||||
register int i;
|
||||
int thresh;
|
||||
int dir;
|
||||
int plague;
|
||||
int n;
|
||||
int changed;
|
||||
|
||||
if (sp->sct_mobil <= 0)
|
||||
return 0;
|
||||
changed = 0;
|
||||
return;
|
||||
plague = sp->sct_pstage;
|
||||
for (i = 1; i <= I_MAX; i++) {
|
||||
if (sp->sct_del[i] == 0)
|
||||
continue;
|
||||
thresh = sp->sct_del[i] & ~0x7;
|
||||
dir = sp->sct_del[i] & 0x7;
|
||||
n = deliver(sp, &ichr[i], dir, thresh, vec[i], plague);
|
||||
n = deliver(sp, &ichr[i], dir, thresh, sp->sct_item[i], plague);
|
||||
if (n > 0) {
|
||||
vec[i] -= n;
|
||||
changed++;
|
||||
sp->sct_item[i] -= n;
|
||||
if (sp->sct_mobil <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue