(nxtitemp): Use void * for generic pointer function value.

This commit is contained in:
Markus Armbruster 2006-01-06 16:55:17 +00:00
parent e66d0bfb83
commit 8e5d576fff
4 changed files with 10 additions and 11 deletions

View file

@ -771,7 +771,7 @@ extern int load_it(struct shpstr *, struct sctstr *,
extern void unload_it(struct shpstr *);
extern void auto_fuel_ship(struct shpstr *);
/* nxtitemp.c */
extern s_char *nxtitemp(struct nstr_item *);
extern void *nxtitemp(struct nstr_item *);
/* plague.c */
extern void do_plague(struct sctstr *, struct natstr *, int);
extern int plague_people(struct natstr *, short *, int *, int *, int);

View file

@ -45,7 +45,7 @@
#include "gen.h"
#include "common.h"
s_char *
void *
nxtitemp(struct nstr_item *np)
{
struct genitem *gp;
@ -106,5 +106,5 @@ nxtitemp(struct nstr_item *np)
selected = 0;
}
} while (!selected);
return (s_char *)gp;
return gp;
}

View file

@ -170,7 +170,7 @@ guerrilla(struct sctstr *sp)
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (NULL != (lp = (struct lndstr *)nxtitemp(&ni))) {
while (NULL != (lp = nxtitemp(&ni))) {
if (lp->lnd_own != sp->sct_own)
continue;
@ -459,7 +459,7 @@ take_casualties(struct sctstr *sp, int mc)
* Try not to kill any unit.
*/
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (NULL != (lp = (struct lndstr *)nxtitemp(&ni))) {
while (NULL != (lp = nxtitemp(&ni))) {
nunits++;
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
nunits++;
@ -472,7 +472,7 @@ take_casualties(struct sctstr *sp, int mc)
/* kill some security troops */
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (NULL != (lp = (struct lndstr *)nxtitemp(&ni))) {
while (NULL != (lp = nxtitemp(&ni))) {
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
continue;
@ -503,7 +503,7 @@ take_casualties(struct sctstr *sp, int mc)
/* kill some normal troops */
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (NULL != (lp = (struct lndstr *)nxtitemp(&ni))) {
while (NULL != (lp = nxtitemp(&ni))) {
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
continue;
@ -531,7 +531,7 @@ take_casualties(struct sctstr *sp, int mc)
/* Hmm.. still some left.. kill off units now */
/* kill some normal troops */
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (NULL != (lp = (struct lndstr *)nxtitemp(&ni))) {
while (NULL != (lp = nxtitemp(&ni))) {
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
continue;
@ -549,7 +549,7 @@ take_casualties(struct sctstr *sp, int mc)
/* Hmm.. still some left.. kill off units now */
/* kill some security troops */
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (NULL != (lp = (struct lndstr *)nxtitemp(&ni))) {
while (NULL != (lp = nxtitemp(&ni))) {
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
continue;

View file

@ -435,8 +435,7 @@ feed_ship(struct shpstr *sp, int etus, int *needed, int doit)
/* doit - only steal food from land units during the update */
if (ifood_eaten > sp->shp_item[I_FOOD] && sp->shp_nland > 0 && doit) {
snxtitem_all(&ni, EF_LAND);
while ((lp = (struct lndstr *)nxtitemp(&ni)) &&
ifood_eaten > sp->shp_item[I_FOOD]) {
while ((lp = nxtitemp(&ni)) && ifood_eaten > sp->shp_item[I_FOOD]) {
if (lp->lnd_ship != sp->shp_uid)
continue;
need = ifood_eaten - sp->shp_item[I_FOOD];