(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 */
|
/* sail.c */
|
||||||
extern void sail_ship(natid);
|
extern void sail_ship(natid);
|
||||||
/* sect.c */
|
/* sect.c */
|
||||||
extern int dodeliver(struct sctstr *, int *);
|
extern void dodeliver(struct sctstr *);
|
||||||
extern void do_fallout(register struct sctstr *, register int);
|
extern void do_fallout(register struct sctstr *, register int);
|
||||||
extern void spread_fallout(struct sctstr *, int);
|
extern void spread_fallout(struct sctstr *, int);
|
||||||
extern void decay_fallout(struct sctstr *, int);
|
extern void decay_fallout(struct sctstr *, int);
|
||||||
|
|
|
@ -80,8 +80,6 @@ finish_sects(int etu)
|
||||||
register struct sctstr *sp;
|
register struct sctstr *sp;
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
int n;
|
int n;
|
||||||
int vec[I_MAX + 1];
|
|
||||||
int changed;
|
|
||||||
struct distinfo *infptr;
|
struct distinfo *infptr;
|
||||||
|
|
||||||
if (g_distptrs == (struct distinfo *)0) {
|
if (g_distptrs == (struct distinfo *)0) {
|
||||||
|
@ -112,11 +110,7 @@ finish_sects(int etu)
|
||||||
np = getnatp(sp->sct_own);
|
np = getnatp(sp->sct_own);
|
||||||
if (np->nat_money < 0)
|
if (np->nat_money < 0)
|
||||||
continue;
|
continue;
|
||||||
changed = 0;
|
dodeliver(sp);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
logerror("done delivering\n");
|
logerror("done delivering\n");
|
||||||
|
|
||||||
|
|
|
@ -55,34 +55,30 @@
|
||||||
#include "lost.h"
|
#include "lost.h"
|
||||||
#include "gen.h"
|
#include "gen.h"
|
||||||
|
|
||||||
int
|
void
|
||||||
dodeliver(struct sctstr *sp, int *vec)
|
dodeliver(struct sctstr *sp)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
int thresh;
|
int thresh;
|
||||||
int dir;
|
int dir;
|
||||||
int plague;
|
int plague;
|
||||||
int n;
|
int n;
|
||||||
int changed;
|
|
||||||
|
|
||||||
if (sp->sct_mobil <= 0)
|
if (sp->sct_mobil <= 0)
|
||||||
return 0;
|
return;
|
||||||
changed = 0;
|
|
||||||
plague = sp->sct_pstage;
|
plague = sp->sct_pstage;
|
||||||
for (i = 1; i <= I_MAX; i++) {
|
for (i = 1; i <= I_MAX; i++) {
|
||||||
if (sp->sct_del[i] == 0)
|
if (sp->sct_del[i] == 0)
|
||||||
continue;
|
continue;
|
||||||
thresh = sp->sct_del[i] & ~0x7;
|
thresh = sp->sct_del[i] & ~0x7;
|
||||||
dir = 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) {
|
if (n > 0) {
|
||||||
vec[i] -= n;
|
sp->sct_item[i] -= n;
|
||||||
changed++;
|
|
||||||
if (sp->sct_mobil <= 0)
|
if (sp->sct_mobil <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue