extern int unit_interdict(coord, coord, natid, char *, int, int);
extern int off_support(coord, coord, natid, natid);
extern int def_support(coord, coord, natid, natid);
-extern int oprange(struct empobj *, int *);
+extern int oprange(struct empobj *);
extern int cando(int, int);
extern void show_mission(int, struct nstr_item *);
extern int air_defense(coord, coord, natid, struct emp_qelem *,
radius = 999;
if ((mission == MI_INTERDICT || mission == MI_SUPPORT ||
mission == MI_OSUPPORT || mission == MI_DSUPPORT ||
- mission == MI_AIR_DEFENSE) &&
- (oprange(gp, &radius) < dist)) {
- pr("%s: out of range! (range %d)\n",
- obj_nameof(gp), oprange(gp, &radius));
- continue;
+ mission == MI_AIR_DEFENSE)) {
+ radius = oprange(gp);
+ if (radius < dist) {
+ pr("%s: out of range! (range %d)\n",
+ obj_nameof(gp), radius);
+ continue;
+ }
}
if (radius > desired_radius)
continue;
dist = mapdist(x, y, gp->opx, gp->opy);
-
- radius = gp->radius;
- if (mission != MI_RESERVE) /* XXX */
- oprange(gp, &radius);
-
- if (dist > radius)
+ if (dist > gp->radius)
continue;
/* Ok, it is within the operations range. */
/* Now check from where the object actually is */
dist = mapdist(x, y, gp->x, gp->y);
- radius = 999;
- oprange(gp, &radius);
+ radius = oprange(gp);
if (dist > radius)
continue;
/* Ok, the object can get to where the x,y is */
case MI_AIR_DEFENSE:
case MI_DSUPPORT:
case MI_OSUPPORT:
- radius = gp->radius;
- oprange(gp, &radius);
prxy(" %3d,%-3d", gp->opx, gp->opy, player->cnum);
- pr(" %4d", radius);
+ pr(" %4d", gp->radius);
break;
case MI_RESERVE:
radius = item.land.lnd_rad_max;
}
int
-oprange(struct empobj *gp, int *radius)
+oprange(struct empobj *gp)
{
- int range;
-
switch (gp->ef_type) {
case EF_SHIP:
- range = ldround(shp_fire_range((struct shpstr *)gp), 1);
- break;
+ return ldround(shp_fire_range((struct shpstr *)gp), 1);
case EF_LAND:
- range = ldround(lnd_fire_range((struct lndstr *)gp), 1);
- break;
+ return ldround(lnd_fire_range((struct lndstr *)gp), 1);
case EF_PLANE:
/* missiles go one way, so we can use all the range */
if (plchr[(int)gp->type].pl_flags & P_M)
- range = ((struct plnstr *)gp)->pln_range;
- else
- range = ((struct plnstr *)gp)->pln_range / 2;
- break;
- default:
- CANT_REACH();
- range = -1;
+ return ((struct plnstr *)gp)->pln_range;
+ return ((struct plnstr *)gp)->pln_range / 2;
}
-
- if (*radius > range)
- *radius = range;
-
- return range;
+ CANT_REACH();
+ return -1;
}
/*