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