(unit_map): Don't use snxtsct(), it obeys conditionals. Use

snxtsct_area().  Callers march() and navi() clearly don't want it to
use conditionals.  navi() used to zap them (just removed).  march()
doesn't, which was a bug similar to #785447.  It's less clear for
caller map().  I'd argue that conditionals apply to map's argument,
the unit number, not to the map itself.  draw_map() zaps them anyway.
This commit is contained in:
Markus Armbruster 2006-03-27 18:45:20 +00:00
parent 38f4026aee
commit 2ff3fe97a2

View file

@ -307,35 +307,32 @@ unit_map(int unit_type, int uid, struct nstr_sect *nsp, s_char *originp)
struct shpstr origs; struct shpstr origs;
struct lndstr origl; struct lndstr origl;
struct plnstr origp; struct plnstr origp;
s_char what[64]; struct genitem *gp;
struct natstr *np; struct range range;
np = getnatp(player->cnum);
if (unit_type == EF_LAND) { if (unit_type == EF_LAND) {
if (!getland(uid, &origl) || !player->owner || origl.lnd_own == 0) if (!getland(uid, &origl) || !player->owner || origl.lnd_own == 0)
return RET_FAIL; return RET_FAIL;
sprintf(what, "%d:%d,%d:%d", xrel(np, origl.lnd_x - 10), gp = (struct genitem *)&origl;
xrel(np, origl.lnd_x + 10),
yrel(np, origl.lnd_y - 5), yrel(np, origl.lnd_y + 5));
*originp = *lchr[(int)origl.lnd_type].l_name; *originp = *lchr[(int)origl.lnd_type].l_name;
} else if (unit_type == EF_PLANE) { } else if (unit_type == EF_PLANE) {
if (!getplane(uid, &origp) || !player->owner || origp.pln_own == 0) if (!getplane(uid, &origp) || !player->owner || origp.pln_own == 0)
return RET_FAIL; return RET_FAIL;
sprintf(what, "%d:%d,%d:%d", xrel(np, origp.pln_x - 10), gp = (struct genitem *)&origp;
xrel(np, origp.pln_x + 10),
yrel(np, origp.pln_y - 5), yrel(np, origp.pln_y + 5));
*originp = *plchr[(int)origp.pln_type].pl_name; *originp = *plchr[(int)origp.pln_type].pl_name;
} else { } else {
if (!getship(uid, &origs) || !player->owner || origs.shp_own == 0) if (!getship(uid, &origs) || !player->owner || origs.shp_own == 0)
return RET_FAIL; return RET_FAIL;
sprintf(what, "%d:%d,%d:%d", xrel(np, origs.shp_x - 10), gp = (struct genitem *)&origs;
xrel(np, origs.shp_x + 10),
yrel(np, origs.shp_y - 5), yrel(np, origs.shp_y + 5));
unit_type = EF_SHIP;
*originp = *mchr[(int)origs.shp_type].m_name; *originp = *mchr[(int)origs.shp_type].m_name;
} }
if (!snxtsct(nsp, what))
return RET_FAIL; range.lx = xnorm(gp->x - 10);
range.hx = xnorm(gp->x + 11);
range.ly = ynorm(gp->y - 5);
range.hy = ynorm(gp->y + 6);
xysize_range(&range);
snxtsct_area(nsp, &range);
return RET_OK; return RET_OK;
} }