Use u_at macro
This commit is contained in:
@@ -486,5 +486,7 @@ struct you {
|
||||
|
||||
/* point px,py is adjacent to (or same location as) hero */
|
||||
#define next2u(px,py) (distu((px),(py)) <= 2)
|
||||
/* hero at (x,y)? */
|
||||
#define u_at(x,y) ((x) == u.ux && (y) == u.uy)
|
||||
|
||||
#endif /* YOU_H */
|
||||
|
||||
+5
-6
@@ -235,7 +235,7 @@ its_dead(int rx, int ry, int *resp)
|
||||
return TRUE;
|
||||
|
||||
} else if (corpse) {
|
||||
boolean here = (rx == u.ux && ry == u.uy),
|
||||
boolean here = u_at(rx, ry),
|
||||
one = (corpse->quan == 1L && !more_corpses), reviver = FALSE;
|
||||
int visglyph, corpseglyph;
|
||||
|
||||
@@ -265,7 +265,7 @@ its_dead(int rx, int ry, int *resp)
|
||||
mptr = &mons[statue->corpsenm];
|
||||
if (Blind) { /* ignore statue->dknown; it'll always be set */
|
||||
Sprintf(buf, "%s %s",
|
||||
(rx == u.ux && ry == u.uy) ? "This" : "That",
|
||||
u_at(rx, ry) ? "This" : "That",
|
||||
humanoid(mptr) ? "person" : "creature");
|
||||
what = buf;
|
||||
} else {
|
||||
@@ -627,7 +627,7 @@ use_leash(struct obj *obj)
|
||||
if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc))
|
||||
return ECMD_OK;
|
||||
|
||||
if (cc.x == u.ux && cc.y == u.uy) {
|
||||
if (u_at(cc.x, cc.y)) {
|
||||
if (u.usteed && u.dz > 0) {
|
||||
mtmp = u.usteed;
|
||||
spotmon = 1;
|
||||
@@ -2587,8 +2587,7 @@ use_trap(struct obj *otmp)
|
||||
return;
|
||||
}
|
||||
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
|
||||
if (otmp == g.trapinfo.tobj && u.ux == g.trapinfo.tx
|
||||
&& u.uy == g.trapinfo.ty) {
|
||||
if (otmp == g.trapinfo.tobj && u_at(g.trapinfo.tx, g.trapinfo.ty)) {
|
||||
You("resume setting %s%s.", shk_your(buf, otmp),
|
||||
trapname(ttyp, FALSE));
|
||||
set_occupation(set_trap, occutext, 0);
|
||||
@@ -3139,7 +3138,7 @@ use_pole(struct obj *obj, boolean autohit)
|
||||
pline("Too far!");
|
||||
return res;
|
||||
} else if (distu(cc.x, cc.y) < min_range) {
|
||||
if (autohit && cc.x == u.ux && cc.y == u.uy)
|
||||
if (autohit && u_at(cc.x, cc.y))
|
||||
pline("Don't know what to hit.");
|
||||
else
|
||||
pline("Too close!");
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ give_to_nearby_mon(struct obj *otmp, int x, int y)
|
||||
for (yy = y - 1; yy <= y + 1; ++yy) {
|
||||
if (!isok(xx, yy))
|
||||
continue;
|
||||
if (xx == u.ux && yy == u.uy)
|
||||
if (u_at(xx, yy))
|
||||
continue;
|
||||
if (!(mtmp = m_at(xx, yy)))
|
||||
continue;
|
||||
|
||||
@@ -1302,7 +1302,7 @@ wiz_show_seenv(void)
|
||||
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
for (x = startx, curx = 0; x < stopx; x++, curx += 2) {
|
||||
if (x == u.ux && y == u.uy) {
|
||||
if (u_at(x, y)) {
|
||||
row[curx] = row[curx + 1] = '@';
|
||||
} else {
|
||||
v = levl[x][y].seenv & 0xff;
|
||||
@@ -1340,7 +1340,7 @@ wiz_show_vision(void)
|
||||
putstr(win, 0, "");
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
for (x = 1; x < COLNO; x++) {
|
||||
if (x == u.ux && y == u.uy) {
|
||||
if (u_at(x, y)) {
|
||||
row[x] = '@';
|
||||
} else {
|
||||
v = g.viz_array[y][x]; /* data access should be hidden */
|
||||
@@ -1376,7 +1376,7 @@ wiz_show_wmodes(void)
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
for (x = 0; x < COLNO; x++) {
|
||||
lev = &levl[x][y];
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
row[x] = '@';
|
||||
else if (IS_WALL(lev->typ) || lev->typ == SDOOR)
|
||||
row[x] = '0' + (lev->wall_info & WM_MASK);
|
||||
|
||||
+1
-1
@@ -322,7 +322,7 @@ u_to_e(struct entity *etmp)
|
||||
static void
|
||||
set_entity(int x, int y, struct entity *etmp)
|
||||
{
|
||||
if ((x == u.ux) && (y == u.uy))
|
||||
if (u_at(x, y))
|
||||
u_to_e(etmp);
|
||||
else if (MON_AT(x, y))
|
||||
m_to_e(m_at(x, y), x, y, etmp);
|
||||
|
||||
+13
-13
@@ -127,7 +127,7 @@ trapped_chest_at(int ttyp, int x, int y)
|
||||
if (sobj_at(CHEST, x, y) || sobj_at(LARGE_BOX, x, y))
|
||||
return TRUE;
|
||||
/* in inventory, we need to find one which is actually trapped */
|
||||
if (x == u.ux && y == u.uy) {
|
||||
if (u_at(x, y)) {
|
||||
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
||||
if (Is_box(otmp) && otmp->otrapped)
|
||||
return TRUE;
|
||||
@@ -397,7 +397,7 @@ gold_detect(struct obj *sobj)
|
||||
}
|
||||
map_object(temp, 1);
|
||||
}
|
||||
if (temp && temp->ox == u.ux && temp->oy == u.uy)
|
||||
if (temp && u_at(temp->ox, temp->oy))
|
||||
ugold = TRUE;
|
||||
}
|
||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
||||
@@ -426,7 +426,7 @@ gold_detect(struct obj *sobj)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (temp && temp->ox == u.ux && temp->oy == u.uy)
|
||||
if (temp && u_at(temp->ox, temp->oy))
|
||||
ugold = TRUE;
|
||||
}
|
||||
if (!ugold) {
|
||||
@@ -459,7 +459,7 @@ food_detect(struct obj *sobj)
|
||||
|
||||
for (obj = fobj; obj; obj = obj->nobj)
|
||||
if (o_in(obj, oclass)) {
|
||||
if (obj->ox == u.ux && obj->oy == u.uy)
|
||||
if (u_at(obj->ox, obj->oy))
|
||||
ctu++;
|
||||
else
|
||||
ct++;
|
||||
@@ -469,7 +469,7 @@ food_detect(struct obj *sobj)
|
||||
continue;
|
||||
for (obj = mtmp->minvent; obj; obj = obj->nobj)
|
||||
if (o_in(obj, oclass)) {
|
||||
if (mtmp->mx == u.ux && mtmp->my == u.uy)
|
||||
if (u_at(mtmp->mx, mtmp->my))
|
||||
ctu++; /* steed or an engulfer with inventory */
|
||||
else
|
||||
ct++;
|
||||
@@ -610,7 +610,7 @@ object_detect(struct obj *detector, /* object doing the detecting */
|
||||
|
||||
for (obj = fobj; obj; obj = obj->nobj) {
|
||||
if ((!class && !boulder) || o_in(obj, class) || o_in(obj, boulder)) {
|
||||
if (obj->ox == u.ux && obj->oy == u.uy)
|
||||
if (u_at(obj->ox, obj->oy))
|
||||
ctu++;
|
||||
else
|
||||
ct++;
|
||||
@@ -621,7 +621,7 @@ object_detect(struct obj *detector, /* object doing the detecting */
|
||||
|
||||
for (obj = g.level.buriedobjlist; obj; obj = obj->nobj) {
|
||||
if (!class || o_in(obj, class)) {
|
||||
if (obj->ox == u.ux && obj->oy == u.uy)
|
||||
if (u_at(obj->ox, obj->oy))
|
||||
ctu++;
|
||||
else
|
||||
ct++;
|
||||
@@ -885,7 +885,7 @@ detect_obj_traps(struct obj *objlist, boolean show_them,
|
||||
for (otmp = objlist; otmp; otmp = otmp->nobj) {
|
||||
if (Is_box(otmp) && otmp->otrapped
|
||||
&& get_obj_location(otmp, &x, &y, BURIED_TOO | CONTAINED_TOO)) {
|
||||
result |= (x == u.ux && y == u.uy) ? OTRAP_HERE : OTRAP_THERE;
|
||||
result |= u_at(x, y) ? OTRAP_HERE : OTRAP_THERE;
|
||||
if (show_them)
|
||||
sense_trap((struct trap *) 0, x, y, how);
|
||||
}
|
||||
@@ -1467,7 +1467,7 @@ do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */
|
||||
see_monsters() to update visible ones and warned-of ones */
|
||||
for (zx = lo_x; zx <= hi_x; zx++)
|
||||
for (zy = lo_y; zy <= hi_y; zy++) {
|
||||
if (zx == u.ux && zy == u.uy)
|
||||
if (u_at(zx, zy))
|
||||
continue;
|
||||
newglyph = glyph_at(zx, zy);
|
||||
if (glyph_is_monster(newglyph)
|
||||
@@ -1608,7 +1608,7 @@ openone(int zx, int zy, genericptr_t num)
|
||||
newsym(zx, zy);
|
||||
(*num_p)++;
|
||||
}
|
||||
mon = (zx == u.ux && zy == u.uy) ? &g.youmonst : m_at(zx, zy);
|
||||
mon = u_at(zx, zy) ? &g.youmonst : m_at(zx, zy);
|
||||
if (openholdingtrap(mon, &dummy)
|
||||
|| openfallingtrap(mon, TRUE, &dummy))
|
||||
(*num_p)++;
|
||||
@@ -1758,7 +1758,7 @@ dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */
|
||||
for (y = u.uy - 1; y < u.uy + 2; y++) {
|
||||
if (!isok(x, y))
|
||||
continue;
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
continue;
|
||||
|
||||
if (Blind && !aflag)
|
||||
@@ -1832,7 +1832,7 @@ warnreveal(void)
|
||||
|
||||
for (x = u.ux - 1; x <= u.ux + 1; x++)
|
||||
for (y = u.uy - 1; y <= u.uy + 1; y++) {
|
||||
if (!isok(x, y) || (x == u.ux && y == u.uy))
|
||||
if (!isok(x, y) || u_at(x, y))
|
||||
continue;
|
||||
if ((mtmp = m_at(x, y)) != 0
|
||||
&& warning_of(mtmp) && mtmp->mundetected)
|
||||
@@ -1901,7 +1901,7 @@ reveal_terrain_getglyph(int x, int y, int full, unsigned swallowed,
|
||||
the invisible monster glyph, which is handled like
|
||||
an object, replacing any object or trap at its spot) */
|
||||
glyph = !swallowed ? glyph_at(x, y) : levl_glyph;
|
||||
if (keep_mons && x == u.ux && y == u.uy && swallowed)
|
||||
if (keep_mons && u_at(x, y) && swallowed)
|
||||
glyph = mon_to_glyph(u.ustuck, rn2_on_display_rng);
|
||||
else if (((glyph_is_monster(glyph)
|
||||
|| glyph_is_warning(glyph)) && !keep_mons)
|
||||
|
||||
@@ -561,7 +561,7 @@ digactualhole(int x, int y, struct monst *madeby, int ttyp)
|
||||
struct monst *mtmp = m_at(x, y); /* may be madeby */
|
||||
boolean madeby_u = (madeby == BY_YOU);
|
||||
boolean madeby_obj = (madeby == BY_OBJECT);
|
||||
boolean at_u = (x == u.ux) && (y == u.uy);
|
||||
boolean at_u = u_at(x, y);
|
||||
boolean wont_fall = Levitation || Flying;
|
||||
|
||||
if (at_u && u.utrap) {
|
||||
@@ -738,7 +738,7 @@ liquid_flow(xchar x, xchar y, schar typ, struct trap *ttmp,
|
||||
{
|
||||
struct obj *objchain;
|
||||
struct monst *mon;
|
||||
boolean u_spot = (x == u.ux && y == u.uy);
|
||||
boolean u_spot = u_at(x, y);
|
||||
|
||||
if (ttmp)
|
||||
(void) delfloortrap(ttmp);
|
||||
@@ -1131,8 +1131,7 @@ use_pick_axe2(struct obj *obj)
|
||||
|| g.context.digging.down) {
|
||||
if (flags.autodig && dig_target == DIGTYP_ROCK
|
||||
&& !g.context.digging.down
|
||||
&& g.context.digging.pos.x == u.ux
|
||||
&& g.context.digging.pos.y == u.uy
|
||||
&& u_at(g.context.digging.pos.x, g.context.digging.pos.y)
|
||||
&& (g.moves <= g.context.digging.lastdigtime + 2
|
||||
&& g.moves >= g.context.digging.lastdigtime)) {
|
||||
/* avoid messages if repeated autodigging */
|
||||
@@ -1693,7 +1692,7 @@ pit_flow(struct trap *trap, schar filltyp)
|
||||
t = *trap;
|
||||
levl[t.tx][t.ty].typ = filltyp, levl[t.tx][t.ty].flags = 0;
|
||||
liquid_flow(t.tx, t.ty, filltyp, trap,
|
||||
(t.tx == u.ux && t.ty == u.uy)
|
||||
u_at(t.tx, t.ty)
|
||||
? "Suddenly %s flows in from the adjacent pit!"
|
||||
: (char *) 0);
|
||||
for (idx = 0; idx < N_DIRS; ++idx) {
|
||||
@@ -2015,7 +2014,7 @@ rot_corpse(anything *arg, long timeout)
|
||||
if (mtmp && !OBJ_AT(x, y) && mtmp->mundetected
|
||||
&& hides_under(mtmp->data)) {
|
||||
mtmp->mundetected = 0;
|
||||
} else if (x == u.ux && y == u.uy
|
||||
} else if (u_at(x, y)
|
||||
&& u.uundetected && hides_under(g.youmonst.data))
|
||||
(void) hideunder(&g.youmonst);
|
||||
newsym(x, y);
|
||||
|
||||
+5
-5
@@ -749,7 +749,7 @@ newsym(register int x, register int y)
|
||||
|
||||
/* only permit updating the hero when swallowed */
|
||||
if (u.uswallow) {
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
display_self();
|
||||
return;
|
||||
}
|
||||
@@ -794,7 +794,7 @@ newsym(register int x, register int y)
|
||||
return;
|
||||
}
|
||||
|
||||
if (x == u.ux && y == u.uy) {
|
||||
if (u_at(x, y)) {
|
||||
int see_self = canspotself();
|
||||
|
||||
/* update map information for <u.ux,u.uy> (remembered topology
|
||||
@@ -831,7 +831,7 @@ newsym(register int x, register int y)
|
||||
|
||||
/* Can't see the location. */
|
||||
} else {
|
||||
if (x == u.ux && y == u.uy) {
|
||||
if (u_at(x, y)) {
|
||||
feel_location(u.ux, u.uy); /* forces an update */
|
||||
|
||||
if (canspotself())
|
||||
@@ -1216,7 +1216,7 @@ under_water(int mode)
|
||||
for (x = u.ux - 1; x <= u.ux + 1; x++)
|
||||
for (y = u.uy - 1; y <= u.uy + 1; y++)
|
||||
if (isok(x, y) && (is_pool_or_lava(x, y) || is_ice(x, y))) {
|
||||
if (Blind && !(x == u.ux && y == u.uy))
|
||||
if (Blind && !u_at(x, y))
|
||||
show_glyph(x, y, GLYPH_UNEXPLORED);
|
||||
else
|
||||
newsym(x, y);
|
||||
@@ -2182,7 +2182,7 @@ map_glyphinfo(
|
||||
glyph_info *glyphinfo)
|
||||
{
|
||||
int offset;
|
||||
boolean is_you = (x == u.ux && y == u.uy
|
||||
boolean is_you = (u_at(x, y)
|
||||
/* verify hero or steed (not something underneath
|
||||
when hero is invisible without see invisible,
|
||||
or a temporary display effect like an explosion);
|
||||
|
||||
@@ -166,7 +166,7 @@ flooreffects(struct obj *obj, int x, int y, const char *verb)
|
||||
ttyp = t->ttyp;
|
||||
tseen = t->tseen ? TRUE : FALSE;
|
||||
if (((mtmp = m_at(x, y)) && mtmp->mtrapped)
|
||||
|| (u.utrap && u.ux == x && u.uy == y)) {
|
||||
|| (u.utrap && u_at(x,y))) {
|
||||
if (*verb && (cansee(x, y) || distu(x, y) == 0))
|
||||
pline("%s boulder %s into the pit%s.",
|
||||
Blind ? "A" : "The",
|
||||
@@ -213,7 +213,7 @@ flooreffects(struct obj *obj, int x, int y, const char *verb)
|
||||
}
|
||||
}
|
||||
if (*verb) {
|
||||
if (Blind && (x == u.ux) && (y == u.uy)) {
|
||||
if (Blind && u_at(x, y)) {
|
||||
You_hear("a CRASH! beneath you.");
|
||||
} else if (!Blind && cansee(x, y)) {
|
||||
pline_The("boulder %s%s.",
|
||||
@@ -244,8 +244,7 @@ flooreffects(struct obj *obj, int x, int y, const char *verb)
|
||||
/* Reasonably bulky objects (arbitrary) splash when dropped.
|
||||
* If you're floating above the water even small things make
|
||||
* noise. Stuff dropped near fountains always misses */
|
||||
if ((Blind || (Levitation || Flying)) && !Deaf
|
||||
&& ((x == u.ux) && (y == u.uy))) {
|
||||
if ((Blind || (Levitation || Flying)) && !Deaf && u_at(x, y)) {
|
||||
if (!Underwater) {
|
||||
if (weight(obj) > 9) {
|
||||
pline("Splash!");
|
||||
@@ -257,7 +256,7 @@ flooreffects(struct obj *obj, int x, int y, const char *verb)
|
||||
newsym(x, y);
|
||||
}
|
||||
res = water_damage(obj, NULL, FALSE) == ER_DESTROYED;
|
||||
} else if (u.ux == x && u.uy == y && (t = t_at(x, y)) != 0
|
||||
} else if (u_at(x, y) && (t = t_at(x, y)) != 0
|
||||
&& (uteetering_at_seen_pit(t) || uescaped_shaft(t))) {
|
||||
if (is_pit(t->ttyp)) {
|
||||
if (Blind && !Deaf)
|
||||
|
||||
+4
-5
@@ -447,8 +447,7 @@ gather_locs(coord **arr_p, int *cnt_p, int gloc)
|
||||
for (pass = 0; pass < 2; pass++) {
|
||||
for (x = 1; x < COLNO; x++)
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
if ((x == u.ux && y == u.uy)
|
||||
|| gather_locs_interesting(x, y, gloc)) {
|
||||
if (u_at(x, y) || gather_locs_interesting(x, y, gloc)) {
|
||||
if (!pass) {
|
||||
++*cnt_p;
|
||||
} else {
|
||||
@@ -1165,7 +1164,7 @@ do_mgivenname(void)
|
||||
return;
|
||||
cx = cc.x, cy = cc.y;
|
||||
|
||||
if (cx == u.ux && cy == u.uy) {
|
||||
if (u_at(cx, cy)) {
|
||||
if (u.usteed && canspotmon(u.usteed)) {
|
||||
mtmp = u.usteed;
|
||||
} else {
|
||||
@@ -1596,7 +1595,7 @@ namefloorobj(void)
|
||||
? "over" : "under");
|
||||
if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0)
|
||||
return;
|
||||
if (cc.x == u.ux && cc.y == u.uy) {
|
||||
if (u_at(cc.x, cc.y)) {
|
||||
obj = vobj_at(u.ux, u.uy);
|
||||
} else {
|
||||
glyph = glyph_at(cc.x, cc.y);
|
||||
@@ -1607,7 +1606,7 @@ namefloorobj(void)
|
||||
if (!obj) {
|
||||
/* "under you" is safe here since there's no object to hide under */
|
||||
pline("There doesn't seem to be any object %s.",
|
||||
(cc.x == u.ux && cc.y == u.uy) ? "under you" : "there");
|
||||
u_at(cc.x, cc.y) ? "under you" : "there");
|
||||
return;
|
||||
}
|
||||
/* note well: 'obj' might be an instance of STRANGE_OBJECT if target
|
||||
|
||||
+2
-2
@@ -570,7 +570,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
|
||||
&& g.moves < edog->hungrytime)) {
|
||||
g.gx = u.ux;
|
||||
g.gy = u.uy;
|
||||
if (after && udist <= 4 && g.gx == u.ux && g.gy == u.uy)
|
||||
if (after && udist <= 4 && u_at(g.gx, g.gy))
|
||||
return -2;
|
||||
appr = (udist >= 9) ? 1 : (mtmp->mflee) ? -1 : 0;
|
||||
if (udist > 1) {
|
||||
@@ -591,7 +591,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
|
||||
appr = 0;
|
||||
|
||||
#define FARAWAY (COLNO + 2) /* position outside screen */
|
||||
if (g.gx == u.ux && g.gy == u.uy && !in_masters_sight) {
|
||||
if (u_at(g.gx, g.gy) && !in_masters_sight) {
|
||||
register coord *cp;
|
||||
|
||||
cp = gettrack(omx, omy);
|
||||
|
||||
+1
-1
@@ -2874,7 +2874,7 @@ recalc_mapseen(void)
|
||||
*/
|
||||
for (x = 1; x < COLNO; x++) {
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
if (cansee(x, y) || (x == u.ux && y == u.uy && !Levitation)) {
|
||||
if (cansee(x, y) || (u_at(x, y) && !Levitation)) {
|
||||
ltyp = levl[x][y].typ;
|
||||
if (ltyp == DRAWBRIDGE_UP)
|
||||
ltyp = db_under_typ(levl[x][y].drawbridgemask);
|
||||
|
||||
+1
-1
@@ -191,7 +191,7 @@ surface(int x, int y)
|
||||
{
|
||||
struct rm *lev = &levl[x][y];
|
||||
|
||||
if (x == u.ux && y == u.uy && u.uswallow && is_animal(u.ustuck->data))
|
||||
if (u_at(x, y) && u.uswallow && is_animal(u.ustuck->data))
|
||||
return "maw";
|
||||
else if (IS_AIR(lev->typ) && Is_airlevel(&u.uz))
|
||||
return "air";
|
||||
|
||||
+6
-7
@@ -182,7 +182,7 @@ explode(
|
||||
} else
|
||||
explmask[i][j] = 0;
|
||||
|
||||
if (i + x - 1 == u.ux && j + y - 1 == u.uy) {
|
||||
if (u_at(i + x - 1, j + y - 1)) {
|
||||
switch (adtyp) {
|
||||
case AD_PHYS:
|
||||
explmask[i][j] = 0;
|
||||
@@ -219,7 +219,7 @@ explode(
|
||||
}
|
||||
/* can be both you and mtmp if you're swallowed or riding */
|
||||
mtmp = m_at(i + x - 1, j + y - 1);
|
||||
if (!mtmp && i + x - 1 == u.ux && j + y - 1 == u.uy)
|
||||
if (!mtmp && u_at(i + x - 1, j + y - 1))
|
||||
mtmp = u.usteed;
|
||||
if (mtmp) {
|
||||
if (DEADMONSTER(mtmp))
|
||||
@@ -327,7 +327,7 @@ explode(
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (explmask[i][j] == 2)
|
||||
continue;
|
||||
if (i + x - 1 == u.ux && j + y - 1 == u.uy) {
|
||||
if (u_at(i + x - 1, j + y - 1)) {
|
||||
uhurt = (explmask[i][j] == 1) ? 1 : 2;
|
||||
/* If the player is attacking via polyself into something
|
||||
* with an explosion attack, leave them (and their gear)
|
||||
@@ -348,7 +348,7 @@ explode(
|
||||
&shopdamage, exploding_wand_typ);
|
||||
|
||||
mtmp = m_at(i + x - 1, j + y - 1);
|
||||
if (!mtmp && i + x - 1 == u.ux && j + y - 1 == u.uy)
|
||||
if (!mtmp && u_at(i + x - 1, j + y - 1))
|
||||
mtmp = u.usteed;
|
||||
if (!mtmp)
|
||||
continue;
|
||||
@@ -766,7 +766,7 @@ scatter(int sx, int sy, /* location of objects to scatter */
|
||||
stmp->stopped = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
|
||||
} else if (u_at(g.bhitpos.x, g.bhitpos.y)) {
|
||||
if (scflags & MAY_HITYOU) {
|
||||
int hitvalu, hitu;
|
||||
|
||||
@@ -836,8 +836,7 @@ scatter(int sx, int sy, /* location of objects to scatter */
|
||||
newsym(x, y);
|
||||
}
|
||||
newsym(sx, sy);
|
||||
if (sx == u.ux && sy == u.uy && u.uundetected
|
||||
&& hides_under(g.youmonst.data))
|
||||
if (u_at(sx, sy) && u.uundetected && hides_under(g.youmonst.data))
|
||||
(void) hideunder(&g.youmonst);
|
||||
if (lostgoods) /* implies shop_origin and therefore shkp valid */
|
||||
credit_report(shkp, 1, FALSE);
|
||||
|
||||
+2
-2
@@ -125,7 +125,7 @@ gush(int x, int y, genericptr_t poolcnt)
|
||||
register struct monst *mtmp;
|
||||
register struct trap *ttmp;
|
||||
|
||||
if (((x + y) % 2) || (x == u.ux && y == u.uy)
|
||||
if (((x + y) % 2) || u_at(x, y)
|
||||
|| (rn2(1 + distmin(u.ux, u.uy, x, y))) || (levl[x][y].typ != ROOM)
|
||||
|| (sobj_at(BOULDER, x, y)) || nexttodoor(x, y))
|
||||
return;
|
||||
@@ -519,7 +519,7 @@ dipfountain(register struct obj *obj)
|
||||
void
|
||||
breaksink(int x, int y)
|
||||
{
|
||||
if (cansee(x, y) || (x == u.ux && y == u.uy))
|
||||
if (cansee(x, y) || u_at(x, y))
|
||||
pline_The("pipes break! Water spurts out!");
|
||||
g.level.flags.nsinks--;
|
||||
levl[x][y].typ = FOUNTAIN, levl[x][y].looted = 0;
|
||||
|
||||
+6
-6
@@ -633,7 +633,7 @@ still_chewing(xchar x, xchar y)
|
||||
updates hunger state and requests status update if changed */
|
||||
morehungry(-nut);
|
||||
}
|
||||
digtxt = (x == u.ux && y == u.uy)
|
||||
digtxt = u_at(x, y)
|
||||
? "devour the iron bars."
|
||||
: "eat through the bars.";
|
||||
dissolve_bars(x, y);
|
||||
@@ -1282,7 +1282,7 @@ findtravelpath(int mode)
|
||||
}
|
||||
}
|
||||
|
||||
if (px == u.ux && py == u.uy) {
|
||||
if (u_at(px, py)) {
|
||||
/* no guesses, just go in the general direction */
|
||||
u.dx = sgn(u.tx - u.ux);
|
||||
u.dy = sgn(u.ty - u.uy);
|
||||
@@ -1332,7 +1332,7 @@ is_valid_travelpt(int x, int y)
|
||||
boolean ret;
|
||||
int glyph = glyph_at(x,y);
|
||||
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
return TRUE;
|
||||
if (isok(x,y) && glyph_is_cmap(glyph) && S_stone == glyph_to_cmap(glyph)
|
||||
&& !levl[x][y].seenv)
|
||||
@@ -2489,7 +2489,7 @@ spoteffects(boolean pick)
|
||||
/* prevent recursion from affecting the hero all over again
|
||||
[hero poly'd to iron golem enters water here, drown() inflicts
|
||||
damage that triggers rehumanize() which calls spoteffects()...] */
|
||||
if (inspoteffects && u.ux == spotloc.x && u.uy == spotloc.y
|
||||
if (inspoteffects && u_at(spotloc.x, spotloc.y)
|
||||
/* except when reason is transformed terrain (ice -> water) */
|
||||
&& spotterrain == levl[u.ux][u.uy].typ
|
||||
/* or transformed trap (land mine -> pit) */
|
||||
@@ -3042,7 +3042,7 @@ lookaround(void)
|
||||
for (x = u.ux - 1; x <= u.ux + 1; x++)
|
||||
for (y = u.uy - 1; y <= u.uy + 1; y++) {
|
||||
/* ignore out of bounds, and our own location */
|
||||
if (!isok(x, y) || (x == u.ux && y == u.uy))
|
||||
if (!isok(x, y) || u_at(x, y))
|
||||
continue;
|
||||
/* (grid bugs) ignore diagonals */
|
||||
if (NODIAG(u.umonnum) && x != u.ux && y != u.uy)
|
||||
@@ -3246,7 +3246,7 @@ monster_nearby(void)
|
||||
/* Also see the similar check in dochugw() in monmove.c */
|
||||
for (x = u.ux - 1; x <= u.ux + 1; x++)
|
||||
for (y = u.uy - 1; y <= u.uy + 1; y++) {
|
||||
if (!isok(x, y) || (x == u.ux && y == u.uy))
|
||||
if (!isok(x, y) || u_at(x, y))
|
||||
continue;
|
||||
if ((mtmp = m_at(x, y)) != 0
|
||||
&& M_AP_TYPE(mtmp) != M_AP_FURNITURE
|
||||
|
||||
+1
-1
@@ -3935,7 +3935,7 @@ void
|
||||
useupf(struct obj *obj, long numused)
|
||||
{
|
||||
struct obj *otmp;
|
||||
boolean at_u = (obj->ox == u.ux && obj->oy == u.uy);
|
||||
boolean at_u = u_at(obj->ox, obj->oy);
|
||||
|
||||
/* burn_floor_objects() keeps an object pointer that it tries to
|
||||
* useupf() multiple times, so obj must survive if plural */
|
||||
|
||||
+2
-2
@@ -162,7 +162,7 @@ do_light_sources(xchar **cs_rows)
|
||||
|
||||
/* minor optimization: don't bother with duplicate light sources
|
||||
at hero */
|
||||
if (ls->x == u.ux && ls->y == u.uy) {
|
||||
if (u_at(ls->x, ls->y)) {
|
||||
if (at_hero_range >= ls->range)
|
||||
ls->flags &= ~LSF_SHOW;
|
||||
else
|
||||
@@ -190,7 +190,7 @@ do_light_sources(xchar **cs_rows)
|
||||
if ((max_x = (ls->x + offset)) >= COLNO)
|
||||
max_x = COLNO - 1;
|
||||
|
||||
if (ls->x == u.ux && ls->y == u.uy) {
|
||||
if (u_at(ls->x, ls->y)) {
|
||||
/*
|
||||
* If the light source is located at the hero, then
|
||||
* we can use the COULD_SEE bits already calculated
|
||||
|
||||
+3
-3
@@ -416,7 +416,7 @@ pick_lock(struct obj *pick,
|
||||
return PICKLOCK_DID_NOTHING;
|
||||
}
|
||||
|
||||
if (cc.x == u.ux && cc.y == u.uy) { /* pick lock on a container */
|
||||
if (u_at(cc.x, cc.y)) { /* pick lock on a container */
|
||||
const char *verb;
|
||||
char qsfx[QBUFSZ];
|
||||
boolean it;
|
||||
@@ -740,7 +740,7 @@ doopen_indir(int x, int y)
|
||||
return ECMD_OK;
|
||||
|
||||
/* open at yourself/up/down */
|
||||
if ((cc.x == u.ux) && (cc.y == u.uy))
|
||||
if (u_at(cc.x, cc.y))
|
||||
return doloot();
|
||||
|
||||
if (stumble_on_door_mimic(cc.x, cc.y))
|
||||
@@ -885,7 +885,7 @@ doclose(void)
|
||||
|
||||
x = u.ux + u.dx;
|
||||
y = u.uy + u.dy;
|
||||
if ((x == u.ux) && (y == u.uy)) {
|
||||
if (u_at(x, y)) {
|
||||
You("are in the way!");
|
||||
return ECMD_TIME;
|
||||
}
|
||||
|
||||
+2
-2
@@ -251,7 +251,7 @@ md_stop(coord *stopp, /* stopping position (we fill it in) */
|
||||
|
||||
for (x = u.ux - 1; x <= u.ux + 1; x++)
|
||||
for (y = u.uy - 1; y <= u.uy + 1; y++) {
|
||||
if (!isok(x, y) || (x == u.ux && y == u.uy))
|
||||
if (!isok(x, y) || u_at(x, y))
|
||||
continue;
|
||||
|
||||
if (accessible(x, y) && !MON_AT(x, y)) {
|
||||
@@ -334,7 +334,7 @@ md_rush(struct monst *md,
|
||||
|
||||
if ((mon = m_at(fx, fy)) != 0) /* save monster at this position */
|
||||
verbalize1(md_exclamations());
|
||||
else if (fx == u.ux && fy == u.uy)
|
||||
else if (u_at(fx, fy))
|
||||
verbalize("Excuse me.");
|
||||
|
||||
if (mon)
|
||||
|
||||
+1
-1
@@ -1118,7 +1118,7 @@ makemon(register struct permonst *ptr,
|
||||
coord cc;
|
||||
int mndx, mcham, ct, mitem;
|
||||
boolean anymon = !ptr,
|
||||
byyou = (x == u.ux && y == u.uy),
|
||||
byyou = u_at(x, y),
|
||||
allow_minvent = ((mmflags & NO_MINVENT) == 0),
|
||||
countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0),
|
||||
allowtail = ((mmflags & MM_NOTAIL) == 0);
|
||||
|
||||
+1
-1
@@ -403,7 +403,7 @@ mattacku(register struct monst *mtmp)
|
||||
*/
|
||||
boolean ranged = (distu(mtmp->mx, mtmp->my) > 3),
|
||||
range2 = !monnear(mtmp, mtmp->mux, mtmp->muy),
|
||||
foundyou = (mtmp->mux == u.ux && mtmp->muy == u.uy),
|
||||
foundyou = u_at(mtmp->mux, mtmp->muy),
|
||||
youseeit = canseemon(mtmp),
|
||||
skipnonmagc = FALSE;
|
||||
|
||||
|
||||
+1
-1
@@ -1432,7 +1432,7 @@ movebubbles(void)
|
||||
mon->mx = mon->my = 0;
|
||||
mon->mstate |= MON_BUBBLEMOVE;
|
||||
}
|
||||
if (!u.uswallow && x == u.ux && y == u.uy) {
|
||||
if (!u.uswallow && u_at(x, y)) {
|
||||
cons = (struct container *) alloc(sizeof *cons);
|
||||
cons->x = x;
|
||||
cons->y = y;
|
||||
|
||||
@@ -1891,9 +1891,9 @@ mfndpos(
|
||||
continue;
|
||||
info[cnt] |= ALLOW_SSM;
|
||||
}
|
||||
if ((nx == u.ux && ny == u.uy)
|
||||
if (u_at(nx, ny)
|
||||
|| (nx == mon->mux && ny == mon->muy)) {
|
||||
if (nx == u.ux && ny == u.uy) {
|
||||
if (u_at(nx, ny)) {
|
||||
/* If it's right next to you, it found you,
|
||||
* displaced or no. We must set mux and muy
|
||||
* right now, so when we return we can tell
|
||||
|
||||
+4
-5
@@ -175,8 +175,7 @@ onscary(int x, int y, struct monst* mtmp)
|
||||
* Astral Plane; the influence of the Valar only reaches so far.
|
||||
*/
|
||||
return (sengr_at("Elbereth", x, y, TRUE)
|
||||
&& ((u.ux == x && u.uy == y)
|
||||
|| (Displaced && mtmp->mux == x && mtmp->muy == y))
|
||||
&& (u_at(x, y) || (Displaced && mtmp->mux == x && mtmp->muy == y))
|
||||
&& !(mtmp->isshk || mtmp->isgd || !mtmp->mcansee
|
||||
|| mtmp->mpeaceful || mtmp->data->mlet == S_HUMAN
|
||||
|| mtmp->data == &mons[PM_MINOTAUR]
|
||||
@@ -1398,7 +1397,7 @@ m_move(register struct monst* mtmp, register int after)
|
||||
nix = mtmp->mux;
|
||||
niy = mtmp->muy;
|
||||
}
|
||||
if (nix == u.ux && niy == u.uy) {
|
||||
if (u_at(nix, niy)) {
|
||||
mtmp->mux = u.ux;
|
||||
mtmp->muy = u.uy;
|
||||
return 0;
|
||||
@@ -1751,7 +1750,7 @@ dissolve_bars(register int x, register int y)
|
||||
levl[x][y].typ = (Is_special(&u.uz) || *in_rooms(x, y, 0)) ? ROOM : CORR;
|
||||
levl[x][y].flags = 0;
|
||||
newsym(x, y);
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
switch_terrain();
|
||||
}
|
||||
|
||||
@@ -1792,7 +1791,7 @@ set_apparxy(register struct monst* mtmp)
|
||||
|
||||
/* monsters which know where you are don't suddenly forget,
|
||||
if you haven't moved away */
|
||||
if (mx == u.ux && my == u.uy)
|
||||
if (u_at(mx, my))
|
||||
goto found_you;
|
||||
|
||||
notseen = (!mtmp->mcansee || (Invis && !perceives(mtmp->data)));
|
||||
|
||||
+4
-4
@@ -181,7 +181,7 @@ drop_throw(
|
||||
if (!objgone) {
|
||||
if (!flooreffects(obj, x, y, "fall")) {
|
||||
place_object(obj, x, y);
|
||||
if (!mtmp && x == u.ux && y == u.uy)
|
||||
if (!mtmp && u_at(x, y))
|
||||
mtmp = &g.youmonst;
|
||||
if (mtmp && ohit)
|
||||
passive_obj(mtmp, obj, (struct attack *) 0);
|
||||
@@ -598,7 +598,7 @@ m_throw(
|
||||
} else if (mtmp) {
|
||||
if (ohitmon(mtmp, singleobj, range, TRUE))
|
||||
break;
|
||||
} else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
|
||||
} else if (u_at(g.bhitpos.x, g.bhitpos.y)) {
|
||||
if (g.multi)
|
||||
nomul(0);
|
||||
|
||||
@@ -1110,8 +1110,8 @@ linedup(
|
||||
/* straight line, orthogonal to the map or diagonal */
|
||||
if ((!g.tbx || !g.tby || abs(g.tbx) == abs(g.tby))
|
||||
&& distmin(g.tbx, g.tby, 0, 0) < BOLT_LIM) {
|
||||
if ((ax == u.ux && ay == u.uy) ? (boolean) couldsee(bx, by)
|
||||
: clear_path(ax, ay, bx, by))
|
||||
if (u_at(ax, ay) ? (boolean) couldsee(bx, by)
|
||||
: clear_path(ax, ay, bx, by))
|
||||
return TRUE;
|
||||
/* don't have line of sight, but might still be lined up
|
||||
if that lack of sight is due solely to boulders */
|
||||
|
||||
+3
-3
@@ -484,7 +484,7 @@ find_defensive(struct monst* mtmp)
|
||||
/* skip if it's hero's location
|
||||
or a diagonal spot and monster can't move diagonally
|
||||
or some other monster is there */
|
||||
if ((xx == u.ux && yy == u.uy)
|
||||
if (u_at(xx, yy)
|
||||
|| (xx != x && yy != y && !diag_ok)
|
||||
|| (g.level.monsters[xx][yy] && !(xx == x && yy == y)))
|
||||
continue;
|
||||
@@ -1483,7 +1483,7 @@ mbhit(
|
||||
case WAN_STRIKING:
|
||||
destroy_drawbridge(x, y);
|
||||
}
|
||||
if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
|
||||
if (u_at(g.bhitpos.x, g.bhitpos.y)) {
|
||||
(*fhitm)(&g.youmonst, obj);
|
||||
range -= 3;
|
||||
} else if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) {
|
||||
@@ -1854,7 +1854,7 @@ find_misc(struct monst* mtmp)
|
||||
monster from attempting disarm every turn */
|
||||
&& uwep && !rn2(5) && obj == MON_WEP(mtmp)
|
||||
/* hero's location must be known and adjacent */
|
||||
&& mtmp->mux == u.ux && mtmp->muy == u.uy
|
||||
&& u_at(mtmp->mux, mtmp->muy)
|
||||
&& next2u(mtmp->mx, mtmp->my)
|
||||
/* don't bother if it can't work (this doesn't
|
||||
prevent cursed weapons from being targetted) */
|
||||
|
||||
+2
-2
@@ -349,7 +349,7 @@ do_earthquake(int force)
|
||||
if ((otmp = sobj_at(BOULDER, x, y)) != 0) {
|
||||
if (cansee(x, y))
|
||||
pline("KADOOM! The boulder falls into a chasm%s!",
|
||||
(x == u.ux && y == u.uy) ? " below you" : "");
|
||||
u_at(x, y) ? " below you" : "");
|
||||
if (mtmp)
|
||||
mtmp->mtrapped = 0;
|
||||
obj_extract_self(otmp);
|
||||
@@ -391,7 +391,7 @@ do_earthquake(int force)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (x == u.ux && y == u.uy) {
|
||||
} else if (u_at(x, y)) {
|
||||
if (u.utrap && u.utraptype == TT_BURIEDBALL) {
|
||||
/* Note: the chain should break if a pit gets
|
||||
created at the buried ball's location, which
|
||||
|
||||
+3
-3
@@ -533,7 +533,7 @@ lookat(int x, int y, char *buf, char *monbuf)
|
||||
|
||||
buf[0] = monbuf[0] = '\0';
|
||||
glyph = glyph_at(x, y);
|
||||
if (u.ux == x && u.uy == y && canspotself()
|
||||
if (u_at(x, y) && canspotself()
|
||||
&& !(iflags.save_uswallow
|
||||
&& glyph == mon_to_glyph(u.ustuck, rn2_on_display_rng))
|
||||
&& (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0)) {
|
||||
@@ -1161,7 +1161,7 @@ do_screen_description(coord cc, boolean looked, int sym, char *out_str,
|
||||
playing a character which isn't normally displayed by that
|
||||
symbol; firstmatch is assumed to already be set for '@' */
|
||||
if ((looked ? (sym == g.showsyms[S_HUMAN + SYM_OFF_M]
|
||||
&& cc.x == u.ux && cc.y == u.uy)
|
||||
&& u_at(cc.x, cc.y))
|
||||
: (sym == def_monsyms[S_HUMAN].sym && !flags.showrace))
|
||||
&& !(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd)
|
||||
found += append_str(out_str, "you"); /* tack on "or you" */
|
||||
@@ -1664,7 +1664,7 @@ look_all(
|
||||
|
||||
g.bhitpos.x = x; /* [is this actually necessary?] */
|
||||
g.bhitpos.y = y;
|
||||
if (x == u.ux && y == u.uy && canspotself()) {
|
||||
if (u_at(x, y) && canspotself()) {
|
||||
(void) self_lookat(lookbuf);
|
||||
++count;
|
||||
} else if ((mtmp = m_at(x, y)) != 0) {
|
||||
|
||||
+1
-1
@@ -2040,7 +2040,7 @@ doloot_core(void)
|
||||
if (!get_adjacent_loc("Loot in what direction?",
|
||||
"Invalid loot location", u.ux, u.uy, &cc))
|
||||
return ECMD_OK;
|
||||
if (cc.x == u.ux && cc.y == u.uy) {
|
||||
if (u_at(cc.x, cc.y)) {
|
||||
underfoot = TRUE;
|
||||
if (container_at(cc.x, cc.y, FALSE))
|
||||
goto lootcont;
|
||||
|
||||
+1
-1
@@ -755,7 +755,7 @@ ghod_hitsu(struct monst *priest)
|
||||
ay = y = EPRI(priest)->shrpos.y;
|
||||
troom = &g.rooms[roomno - ROOMOFFSET];
|
||||
|
||||
if ((u.ux == x && u.uy == y) || !linedup(u.ux, u.uy, x, y, 1)) {
|
||||
if (u_at(x, y) || !linedup(u.ux, u.uy, x, y, 1)) {
|
||||
if (IS_DOOR(levl[u.ux][u.uy].typ)) {
|
||||
if (u.ux == troom->lx - 1) {
|
||||
x = troom->hx;
|
||||
|
||||
+1
-1
@@ -1757,7 +1757,7 @@ seffect_fire(struct obj **sobjp)
|
||||
cc.y = u.uy;
|
||||
}
|
||||
}
|
||||
if (cc.x == u.ux && cc.y == u.uy) {
|
||||
if (u_at(cc.x, cc.y)) {
|
||||
pline_The("scroll erupts in a tower of flame!");
|
||||
iflags.last_msg = PLNMSG_TOWER_OF_FLAME; /* for explode() */
|
||||
burn_away_slime();
|
||||
|
||||
+1
-1
@@ -985,7 +985,7 @@ expire_gas_cloud(genericptr_t p1, genericptr_t p2 UNUSED)
|
||||
if (inside_region(reg, x, y)) {
|
||||
if (!does_block(x, y, &levl[x][y]))
|
||||
unblock_point(x, y);
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
g.gas_cloud_diss_within = TRUE;
|
||||
if (cansee(x, y))
|
||||
g.gas_cloud_diss_seen++;
|
||||
|
||||
@@ -534,7 +534,7 @@ deserted_shop(/*const*/ char* enterstring)
|
||||
|
||||
for (x = r->lx; x <= r->hx; ++x)
|
||||
for (y = r->ly; y <= r->hy; ++y) {
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
continue;
|
||||
if ((mtmp = m_at(x, y)) != 0) {
|
||||
++n;
|
||||
@@ -1304,7 +1304,7 @@ dopay(void)
|
||||
pline("Try again...");
|
||||
return ECMD_OK;
|
||||
}
|
||||
if (u.ux == cx && u.uy == cy) {
|
||||
if (u_at(cx, cy)) {
|
||||
You("are generous to yourself.");
|
||||
return ECMD_OK;
|
||||
}
|
||||
@@ -1888,7 +1888,7 @@ set_repo_loc(struct monst* shkp)
|
||||
/* if you're not in this shk's shop room, or if you're in its doorway
|
||||
or entry spot, then your gear gets dumped all the way inside */
|
||||
if (*u.ushops != eshkp->shoproom || IS_DOOR(levl[u.ux][u.uy].typ)
|
||||
|| (u.ux == eshkp->shk.x && u.uy == eshkp->shk.y)) {
|
||||
|| u_at(eshkp->shk.x, eshkp->shk.y)) {
|
||||
/* shk.x,shk.y is the position immediately in
|
||||
* front of the door -- move in one more space
|
||||
*/
|
||||
@@ -3544,7 +3544,7 @@ repairable_damage(struct damage *dam, struct monst *shkp)
|
||||
return FALSE;
|
||||
/* is it a wall? don't fix if anyone is in the way */
|
||||
if (!IS_ROOM(dam->typ)) {
|
||||
if ((x == u.ux && y == u.uy && !Passes_walls)
|
||||
if ((u_at(x, y) && !Passes_walls)
|
||||
|| (x == shkp->mx && y == shkp->my)
|
||||
|| ((mtmp = m_at(x, y)) != 0 && !passes_walls(mtmp->data)))
|
||||
return FALSE;
|
||||
@@ -3552,7 +3552,7 @@ repairable_damage(struct damage *dam, struct monst *shkp)
|
||||
/* is it a trap? don't fix if hero or monster is in it */
|
||||
ttmp = t_at(x, y);
|
||||
if (ttmp) {
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
return FALSE;
|
||||
if ((mtmp = m_at(x,y)) != 0 && mtmp->mtrapped)
|
||||
return FALSE;
|
||||
@@ -3956,7 +3956,7 @@ shk_move(struct monst* shkp)
|
||||
if (Invis || u.usteed) {
|
||||
avoid = FALSE;
|
||||
} else {
|
||||
uondoor = (u.ux == eshkp->shd.x && u.uy == eshkp->shd.y);
|
||||
uondoor = u_at(eshkp->shd.x, eshkp->shd.y);
|
||||
if (uondoor) {
|
||||
badinv =
|
||||
(carrying(PICK_AXE) || carrying(DWARVISH_MATTOCK)
|
||||
|
||||
+1
-1
@@ -449,7 +449,7 @@ landing_spot(
|
||||
for (; !found && i < 2; ++i) {
|
||||
for (x = u.ux - 1; x <= u.ux + 1; x++)
|
||||
for (y = u.uy - 1; y <= u.uy + 1; y++) {
|
||||
if (!isok(x, y) || (x == u.ux && y == u.uy))
|
||||
if (!isok(x, y) || u_at(x, y))
|
||||
continue;
|
||||
|
||||
if (accessible(x, y) && !MON_AT(x, y)
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ goodpos(int x, int y, struct monst* mtmp, long gpflags)
|
||||
* oh well.
|
||||
*/
|
||||
if (!allow_u) {
|
||||
if (x == u.ux && y == u.uy && mtmp != &g.youmonst
|
||||
if (u_at(x, y) && mtmp != &g.youmonst
|
||||
&& (mtmp != u.ustuck || !u.uswallow)
|
||||
&& (!u.usteed || mtmp != u.usteed))
|
||||
return FALSE;
|
||||
@@ -532,7 +532,7 @@ scrolltele(struct obj* scroll)
|
||||
if (teleok(cc.x, cc.y, FALSE)) {
|
||||
/* for scroll, discover it regardless of destination */
|
||||
teleds(cc.x, cc.y, TELEDS_TELEPORT);
|
||||
if (iflags.travelcc.x == u.ux && iflags.travelcc.y == u.uy)
|
||||
if (u_at(iflags.travelcc.x, iflags.travelcc.y))
|
||||
iflags.travelcc.x = iflags.travelcc.y = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
+12
-12
@@ -350,7 +350,7 @@ maketrap(int x, int y, int typ)
|
||||
if (undestroyable_trap(ttmp->ttyp))
|
||||
return (struct trap *) 0;
|
||||
oldplace = TRUE;
|
||||
if (u.utrap && x == u.ux && y == u.uy
|
||||
if (u.utrap && u_at(x, y)
|
||||
&& ((u.utraptype == TT_BEARTRAP && typ != BEAR_TRAP)
|
||||
|| (u.utraptype == TT_WEB && typ != WEB)
|
||||
|| (u.utraptype == TT_PIT && !is_pit(typ))
|
||||
@@ -691,7 +691,7 @@ animate_statue(
|
||||
: golem_xform ? "turns into flesh"
|
||||
: (nonliving(mon->data) || is_vampshifter(mon)) ? "moves"
|
||||
: "comes to life";
|
||||
if ((x == u.ux && y == u.uy) || cause == ANIMATE_SPELL) {
|
||||
if (u_at(x, y) || cause == ANIMATE_SPELL) {
|
||||
/* "the|your|Manlobbi's statue [of a wombat]" */
|
||||
shkp = shop_keeper(*in_rooms(mon->mx, mon->my, SHOPBASE));
|
||||
Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
|
||||
@@ -761,7 +761,7 @@ animate_statue(
|
||||
delobj(statue);
|
||||
|
||||
/* avoid hiding under nothing */
|
||||
if (x == u.ux && y == u.uy && Upolyd && hides_under(g.youmonst.data)
|
||||
if (u_at(x, y) && Upolyd && hides_under(g.youmonst.data)
|
||||
&& !OBJ_AT(x, y))
|
||||
u.uundetected = 0;
|
||||
|
||||
@@ -2797,7 +2797,7 @@ launch_obj(
|
||||
launch_drop_spot((struct obj *) 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
} else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
|
||||
} else if (u_at(g.bhitpos.x, g.bhitpos.y)) {
|
||||
if (g.multi)
|
||||
nomul(0);
|
||||
if (thitu(9 + singleobj->spe, dmgval(singleobj, &g.youmonst),
|
||||
@@ -4461,7 +4461,7 @@ cnv_trap_obj(
|
||||
stackobj(otmp);
|
||||
}
|
||||
newsym(ttmp->tx, ttmp->ty);
|
||||
if (u.utrap && ttmp->tx == u.ux && ttmp->ty == u.uy)
|
||||
if (u.utrap && u_at(ttmp->tx, ttmp->ty))
|
||||
reset_utrap(TRUE);
|
||||
deltrap(ttmp);
|
||||
}
|
||||
@@ -4882,7 +4882,7 @@ untrap(boolean force)
|
||||
if (ttmp && !ttmp->tseen)
|
||||
ttmp = 0;
|
||||
trapdescr = ttmp ? trapname(ttmp->ttyp, FALSE) : 0;
|
||||
here = (x == u.ux && y == u.uy); /* !u.dx && !u.dy */
|
||||
here = u_at(x, y); /* !u.dx && !u.dy */
|
||||
|
||||
if (here) /* are there are one or more containers here? */
|
||||
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
|
||||
@@ -4941,7 +4941,7 @@ untrap(boolean force)
|
||||
if (deal_with_floor_trap) {
|
||||
if (u.utrap) {
|
||||
You("cannot deal with %s while trapped%s!", the_trap,
|
||||
(x == u.ux && y == u.uy) ? " in it" : "");
|
||||
u_at(x, y) ? " in it" : "");
|
||||
return 1;
|
||||
}
|
||||
if ((mtmp = m_at(x, y)) != 0
|
||||
@@ -5354,9 +5354,9 @@ chest_trap(
|
||||
delete_contents(obj);
|
||||
/* unpunish() in advance if either ball or chain (or both)
|
||||
is going to be destroyed */
|
||||
if (Punished && ((uchain->ox == u.ux && uchain->oy == u.uy)
|
||||
if (Punished && (u_at(uchain->ox, uchain->oy)
|
||||
|| (uball->where == OBJ_FLOOR
|
||||
&& uball->ox == u.ux && uball->oy == u.uy)))
|
||||
&& u_at(uball->ox, uball->oy))))
|
||||
unpunish();
|
||||
|
||||
for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
|
||||
@@ -5613,7 +5613,7 @@ boolean
|
||||
uteetering_at_seen_pit(struct trap* trap)
|
||||
{
|
||||
return (trap && is_pit(trap->ttyp) && trap->tseen
|
||||
&& trap->tx == u.ux && trap->ty == u.uy
|
||||
&& u_at(trap->tx, trap->ty)
|
||||
&& !(u.utrap && u.utraptype == TT_PIT));
|
||||
}
|
||||
|
||||
@@ -5625,7 +5625,7 @@ boolean
|
||||
uescaped_shaft(struct trap* trap)
|
||||
{
|
||||
return (trap && is_hole(trap->ttyp) && trap->tseen
|
||||
&& trap->tx == u.ux && trap->ty == u.uy);
|
||||
&& u_at(trap->tx, trap->ty));
|
||||
}
|
||||
|
||||
/* Destroy a trap that emanates from the floor. */
|
||||
@@ -5642,7 +5642,7 @@ delfloortrap(struct trap* ttmp)
|
||||
|| (ttmp->ttyp == ANTI_MAGIC))) {
|
||||
register struct monst *mtmp;
|
||||
|
||||
if (ttmp->tx == u.ux && ttmp->ty == u.uy) {
|
||||
if (u_at(ttmp->tx, ttmp->ty)) {
|
||||
if (u.utraptype != TT_BURIEDBALL)
|
||||
reset_utrap(TRUE);
|
||||
} else if ((mtmp = m_at(ttmp->tx, ttmp->ty)) != 0) {
|
||||
|
||||
+3
-3
@@ -63,7 +63,7 @@ clear_fcorr(struct monst *grd, boolean forceshow)
|
||||
if ((DEADMONSTER(grd) || !in_fcorridor(grd, u.ux, u.uy))
|
||||
&& egrd->gddone)
|
||||
forceshow = TRUE;
|
||||
if ((u.ux == fcx && u.uy == fcy && !DEADMONSTER(grd))
|
||||
if ((u_at(fcx, fcy) && !DEADMONSTER(grd))
|
||||
|| (!forceshow && couldsee(fcx, fcy))
|
||||
|| (Punished && !carried(uball) && uball->ox == fcx
|
||||
&& uball->oy == fcy))
|
||||
@@ -352,7 +352,7 @@ invault(void)
|
||||
else
|
||||
y += dy;
|
||||
}
|
||||
if (x == u.ux && y == u.uy) {
|
||||
if (u_at(x, y)) {
|
||||
if (levl[x + 1][y].typ == HWALL || levl[x + 1][y].typ == DOOR)
|
||||
x = x + 1;
|
||||
else if (levl[x - 1][y].typ == HWALL
|
||||
@@ -686,7 +686,7 @@ gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy)
|
||||
coord newcc, bestcc;
|
||||
int gdelta, newdelta, bestdelta, tryct,
|
||||
guardx = grd->mx, guardy = grd->my;
|
||||
boolean under_u = (goldx == u.ux && goldy == u.uy),
|
||||
boolean under_u = u_at(goldx, goldy),
|
||||
see_it = cansee(goldx, goldy);
|
||||
|
||||
if (under_u) {
|
||||
|
||||
+1
-1
@@ -394,7 +394,7 @@ tactics(struct monst *mtmp)
|
||||
if (!targ) { /* simply wants you to close */
|
||||
return 0;
|
||||
}
|
||||
if ((u.ux == tx && u.uy == ty) || where == STRAT_PLAYER) {
|
||||
if (u_at(tx, ty) || where == STRAT_PLAYER) {
|
||||
/* player is standing on it (or has it) */
|
||||
mnexto(mtmp, RLOC_MSG);
|
||||
return 0;
|
||||
|
||||
@@ -3772,7 +3772,7 @@ boomhit(struct obj *obj, int dx, int dy)
|
||||
g.bhitpos.y -= dy;
|
||||
break;
|
||||
}
|
||||
if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) { /* ct == 9 */
|
||||
if (u_at(g.bhitpos.x, g.bhitpos.y)) { /* ct == 9 */
|
||||
if (Fumbling || rn2(20) >= ACURR(A_DEX)) {
|
||||
/* we hit ourselves */
|
||||
(void) thitu(10 + obj->spe, dmgval(obj, &g.youmonst), &obj,
|
||||
@@ -4149,11 +4149,11 @@ burn_floor_objects(int x, int y,
|
||||
/* save name before potential delobj() */
|
||||
if (give_feedback) {
|
||||
obj->quan = 1L;
|
||||
Strcpy(buf1, (x == u.ux && y == u.uy)
|
||||
Strcpy(buf1, u_at(x, y)
|
||||
? xname(obj)
|
||||
: distant_name(obj, xname));
|
||||
obj->quan = 2L;
|
||||
Strcpy(buf2, (x == u.ux && y == u.uy)
|
||||
Strcpy(buf2, u_at(x, y)
|
||||
? xname(obj)
|
||||
: distant_name(obj, xname));
|
||||
obj->quan = scrquan;
|
||||
@@ -4412,7 +4412,7 @@ dobuzz(int type, int nd, xchar sx, xchar sy, int dx, int dy,
|
||||
if (say || canseemon(mon))
|
||||
miss(flash_str(fltyp, FALSE), mon);
|
||||
}
|
||||
} else if (sx == u.ux && sy == u.uy && range >= 0) {
|
||||
} else if (u_at(sx, sy) && range >= 0) {
|
||||
nomul(0);
|
||||
if (u.usteed && !rn2(3) && !mon_reflects(u.usteed, (char *) 0)) {
|
||||
mon = u.usteed;
|
||||
@@ -4545,7 +4545,7 @@ melt_ice(xchar x, xchar y, const char *msg)
|
||||
if (Underwater)
|
||||
vision_recalc(1);
|
||||
newsym(x, y);
|
||||
if (cansee(x, y) || (x == u.ux && y == u.uy))
|
||||
if (cansee(x, y) || u_at(x, y))
|
||||
Norep("%s", msg);
|
||||
if ((otmp = sobj_at(BOULDER, x, y)) != 0) {
|
||||
if (cansee(x, y))
|
||||
@@ -4558,7 +4558,7 @@ melt_ice(xchar x, xchar y, const char *msg)
|
||||
} while (is_pool(x, y) && (otmp = sobj_at(BOULDER, x, y)) != 0);
|
||||
newsym(x, y);
|
||||
}
|
||||
if (x == u.ux && y == u.uy)
|
||||
if (u_at(x, y))
|
||||
spoteffects(TRUE); /* possibly drown, notice objects */
|
||||
else if (is_pool(x, y) && (mtmp = m_at(x, y)) != 0)
|
||||
(void) minliquid(mtmp);
|
||||
@@ -4739,7 +4739,7 @@ zap_over_floor(xchar x, xchar y, int type, boolean *shopdamage,
|
||||
} else if (!lava)
|
||||
You_hear("a crackling sound.");
|
||||
|
||||
if (x == u.ux && y == u.uy) {
|
||||
if (u_at(x, y)) {
|
||||
if (u.uinwater) { /* not just `if (Underwater)' */
|
||||
/* leave the no longer existent water */
|
||||
set_uinwater(0); /* u.uinwater = 0 */
|
||||
|
||||
Reference in New Issue
Block a user