summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-05 12:57:13 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-05 12:57:13 -0600
commit51ded013829b4cd8f73fa7f6313e73d2f7550aa5 (patch)
tree58a2f3973efdd6fb016f3ab7a3a71809d0d888d0 /crawl-ref/source
parent418a2664a3de915971c847d9fb16e93bc263661e (diff)
downloadcrawl-ref-51ded013829b4cd8f73fa7f6313e73d2f7550aa5.tar.gz
crawl-ref-51ded013829b4cd8f73fa7f6313e73d2f7550aa5.zip
Make many checks for monster (non)existence on squares use monster_at().
Not all are changed yet, as there are several index checks still needed for debugging purposes. Also, make many checks for player/monster (non)existence use actor_at().
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abyss.cc4
-rw-r--r--crawl-ref/source/arena.cc2
-rw-r--r--crawl-ref/source/debug.cc4
-rw-r--r--crawl-ref/source/dungeon.cc16
-rw-r--r--crawl-ref/source/losparam.cc7
-rw-r--r--crawl-ref/source/maps.cc7
-rw-r--r--crawl-ref/source/mon-abil.cc2
-rw-r--r--crawl-ref/source/mon-act.cc2
-rw-r--r--crawl-ref/source/mon-cast.cc8
-rw-r--r--crawl-ref/source/monplace.cc2
-rw-r--r--crawl-ref/source/monster.cc6
-rw-r--r--crawl-ref/source/monstuff.cc4
-rw-r--r--crawl-ref/source/player.cc8
-rw-r--r--crawl-ref/source/spl-cast.cc4
-rw-r--r--crawl-ref/source/tags.cc2
-rw-r--r--crawl-ref/source/terrain.cc8
-rw-r--r--crawl-ref/source/tilepick.cc14
-rw-r--r--crawl-ref/source/tilereg.cc10
-rw-r--r--crawl-ref/source/tilesdl.cc16
-rw-r--r--crawl-ref/source/tutorial.cc10
-rw-r--r--crawl-ref/source/view.cc2
21 files changed, 67 insertions, 71 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index c7d96b3b6d..db0a527fec 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -496,7 +496,7 @@ void area_shift(void)
move_item_stack_to_grid(*ri, newpos);
// Move monster.
- if (mgrd(*ri) != NON_MONSTER)
+ if (monster_at(*ri))
{
menv[mgrd(*ri)].moveto(newpos);
mgrd(newpos) = mgrd(*ri);
@@ -569,7 +569,7 @@ void abyss_teleport( bool new_area )
if ((grd(newspot) == DNGN_FLOOR
|| grd(newspot) == DNGN_SHALLOW_WATER)
- && mgrd(newspot) == NON_MONSTER
+ && !monster_at(newspot)
&& env.cgrid(newspot) == EMPTY_CLOUD)
{
found = true;
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc
index 3dbcfa9c28..d6ae03e1ef 100644
--- a/crawl-ref/source/arena.cc
+++ b/crawl-ref/source/arena.cc
@@ -783,7 +783,7 @@ namespace arena
true);
if (idx == -1 && fac.active_members == 0
- && mgrd(pos) != NON_MONSTER)
+ && monster_at(pos))
{
// We have no members left, so to prevent the round
// from ending attempt to displace whatever is in
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 867697a8fc..fee098066b 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -2607,7 +2607,7 @@ void debug_stethoscope(int mon)
env.cloud[ env.cgrid(stethpos) ].decay );
}
- if (mgrd(stethpos) == NON_MONSTER)
+ if (!monster_at(stethpos))
{
mprf(MSGCH_DIAGNOSTICS, "item grid = %d", igrd(stethpos) );
return;
@@ -6305,7 +6305,7 @@ static void _dump_player(FILE *file)
}
fprintf(file, EOL);
- if (in_bounds(you.pos()) && mgrd(you.pos()) != NON_MONSTER)
+ if (in_bounds(you.pos()) && monster_at(you.pos()))
{
fprintf(file, "Standing on same square as: ");
const unsigned short midx = mgrd(you.pos());
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 17d488a8e9..0236a8b39a 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -2966,7 +2966,7 @@ static void _place_specific_feature(dungeon_feature_type feat)
do
c = random_in_bounds();
- while (grd(c) != DNGN_FLOOR || mgrd(c) != NON_MONSTER);
+ while (grd(c) != DNGN_FLOOR || monster_at(c));
grd(c) = feat;
}
@@ -3832,9 +3832,9 @@ static void _special_room(int level_number, spec_room &sr,
} // end special_room()
// Used for placement of rivers/lakes.
-static bool _may_overwrite_pos(const int i, const int j)
+static bool _may_overwrite_pos(coord_def c)
{
- const dungeon_feature_type grid = grd[i][j];
+ const dungeon_feature_type grid = grd(c);
// Don't overwrite any stairs or branch entrances.
if (grid >= DNGN_ENTER_SHOP && grid <= DNGN_EXIT_PORTAL_VAULT
@@ -3845,7 +3845,7 @@ static bool _may_overwrite_pos(const int i, const int j)
// Don't overwrite feature if there's a monster or item there.
// Otherwise, items/monsters might end up stuck in deep water.
- return (mgrd[i][j] == NON_MONSTER && igrd[i][j] == NON_ITEM);
+ return (!monster_at(c) && igrd(c) == NON_ITEM);
}
static void _build_rooms(const dgn_region_list &excluded,
@@ -4779,7 +4779,7 @@ int dgn_place_monster(mons_spec &mspec,
mg.mname = mspec.monname;
coord_def place(where);
- if (!force_pos && mgrd(place) != NON_MONSTER
+ if (!force_pos && monster_at(place)
&& (mg.cls < NUM_MONSTERS || mg.cls == RANDOM_MONSTER))
{
const monster_type habitat_target =
@@ -5573,7 +5573,7 @@ static void _place_altar()
for (int i = px - 2; i <= px + 2; i++)
for (int j = py - 2; j <= py + 2; j++)
{
- if (mgrd[i][j] != NON_MONSTER)
+ if (monster_at(coord_def(i, j)))
mon_there = true;
}
@@ -7574,7 +7574,7 @@ static void _build_river( dungeon_feature_type river_type ) //mv
// Note that vaults might have been created in this area!
// So we'll avoid the silliness of orcs/royal jelly on
// lava and deep water grids. -- bwr
- if (!one_chance_in(200) && _may_overwrite_pos(i, j))
+ if (!one_chance_in(200) && _may_overwrite_pos(coord_def(i, j)))
{
if (width == 2 && river_type == DNGN_DEEP_WATER
&& coinflip())
@@ -7638,7 +7638,7 @@ static void _build_lake(dungeon_feature_type lake_type) //mv
// Note that vaults might have been created in this area!
// So we'll avoid the silliness of monsters and items
// on lava and deep water grids. -- bwr
- if (!one_chance_in(200) && _may_overwrite_pos(i,j))
+ if (!one_chance_in(200) && _may_overwrite_pos(coord_def(i, j)))
{
grd[i][j] = lake_type;
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc
index 27f32b73c2..5417e9d62e 100644
--- a/crawl-ref/source/losparam.cc
+++ b/crawl-ref/source/losparam.cc
@@ -10,11 +10,11 @@
#include "cloud.h"
#include "externs.h"
#include "los.h"
+#include "mon-util.h"
#include "terrain.h"
opacity_type opacity_default::operator()(const coord_def& p) const
{
- int m;
dungeon_feature_type f = env.grid(p);
if (feat_is_opaque(f))
return OPC_OPAQUE;
@@ -22,7 +22,7 @@ opacity_type opacity_default::operator()(const coord_def& p) const
return OPC_HALF;
else if (f == DNGN_TREES)
return OPC_HALF;
- else if ((m = mgrd(p)) != NON_MONSTER && menv[m].type == MONS_BUSH)
+ else if (monster_at(p) && monster_at(p)->type == MONS_BUSH)
return OPC_HALF;
else
return OPC_CLEAR;
@@ -40,7 +40,6 @@ opacity_type opacity_fullyopaque::operator()(const coord_def& p) const
// XXX: Are trees, bushes solid?
opacity_type opacity_solid::operator()(const coord_def& p) const
{
- int m;
dungeon_feature_type f = env.grid(p);
if (feat_is_solid(f))
return OPC_OPAQUE;
@@ -48,7 +47,7 @@ opacity_type opacity_solid::operator()(const coord_def& p) const
return OPC_HALF;
else if (f == DNGN_TREES)
return OPC_HALF;
- else if ((m = mgrd(p)) != NON_MONSTER && menv[m].type == MONS_BUSH)
+ else if (monster_at(p) && monster_at(p)->type == MONS_BUSH)
return OPC_HALF;
else
return OPC_CLEAR;
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index 2c7060f31b..dbbabd1dab 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -21,8 +21,9 @@
#include "enum.h"
#include "files.h"
#include "message.h"
-#include "monplace.h"
#include "mapdef.h"
+#include "mon-util.h"
+#include "monplace.h"
#include "random.h"
#include "state.h"
#include "terrain.h"
@@ -228,8 +229,8 @@ static bool _safe_vault_place(const map_def &map,
if (!_may_overwrite_feature(dfeat, water_ok))
return (false);
- // Don't overwrite items or monsters, either!
- if (igrd(cp) != NON_ITEM || mgrd(cp) != NON_MONSTER)
+ // Don't overwrite monsters or items, either!
+ if (monster_at(cp) || igrd(cp) != NON_ITEM)
return (false);
}
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 094e64abef..1742d00860 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -501,7 +501,7 @@ static bool _siren_movement_effect(const monsters *monster)
if (swapping)
{
- if (mgrd(oldpos) != NON_MONSTER)
+ if (monster_at(oldpos))
{
mprf("Something prevents you from swapping places "
"with %s.",
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 2ad17e09a2..ffa34a4804 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -534,7 +534,7 @@ static void _handle_movement(monsters *monster)
// First, check whether the monster is smart enough to even consider
// this.
if ((newpos == you.pos()
- || mgrd(newpos) != NON_MONSTER && monster->foe == mgrd(newpos))
+ || monster_at(newpos) && monster->foe == mgrd(newpos))
&& mons_intel(monster) >= I_ANIMAL
&& coinflip()
&& !mons_is_confused(monster) && !mons_is_caught(monster)
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index a9535cea2e..0c78d3e7ef 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1896,7 +1896,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (adjacent_iterator ai(monster->pos()); ai; ++ai)
{
// we can blink away the crowd, but only our allies
- if (mgrd(*ai) != NON_MONSTER
+ if (monster_at(*ai)
&& monster_at(*ai)->attitude != monster->attitude)
sumcount++;
if (grd(*ai) != DNGN_FLOOR && grd(*ai) > DNGN_MAX_NONREACH
@@ -1915,13 +1915,13 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
sumcount = 0;
for (adjacent_iterator ai(monster->pos()); ai; ++ai)
{
- if (mgrd(*ai) != NON_MONSTER && monster_at(*ai) != monster)
+ if (monster_at(*ai) && monster_at(*ai) != monster)
{
monster_at(*ai)->blink();
- if (mgrd(*ai) != NON_MONSTER)
+ if (monster_at(*ai))
{
monster_at(*ai)->teleport(true);
- if (mgrd(*ai) != NON_MONSTER)
+ if (monster_at(*ai))
continue;
}
}
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 0bfa4d2897..77b31695f5 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -1047,7 +1047,7 @@ static int _place_monster_aux(const mgen_data &mg,
return (-1);
}
- ASSERT(mgrd(fpos) == NON_MONSTER);
+ ASSERT(!monster_at(fpos));
if (crawl_state.arena
&& arena_veto_place_monster(mg, first_band_member, fpos))
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 300c44a4ae..4fb0f265ba 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -3898,7 +3898,7 @@ static bool _prepare_del_ench(monsters* mon, const mon_enchant &me)
int midx = mon->mindex();
- if (mgrd(mon->pos()) == NON_MONSTER)
+ if (!monster_at(mon->pos()))
mgrd(mon->pos()) = midx;
if (mon->pos() != you.pos() && midx == mgrd(mon->pos()))
@@ -3935,7 +3935,7 @@ static bool _prepare_del_ench(monsters* mon, const mon_enchant &me)
int okay_squares = 0;
for (adjacent_iterator ai; ai; ++ai)
- if (mgrd(*ai) == NON_MONSTER && *ai != you.pos()
+ if (!actor_at(*ai)
&& monster_can_submerge(mon, grd(*ai))
&& one_chance_in(++okay_squares))
{
@@ -3957,7 +3957,7 @@ static bool _prepare_del_ench(monsters* mon, const mon_enchant &me)
// Try to move to an adjacent square where it would be happy.
for (adjacent_iterator ai; ai; ++ai)
{
- if (mgrd(*ai) == NON_MONSTER
+ if (!monster_at(*ai)
&& monster_habitable_grid(mon, grd(*ai))
&& !find_trap(*ai))
{
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index ff2eddd821..661e7c62d6 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2611,7 +2611,7 @@ bool swap_places(monsters *monster, const coord_def &loc)
ASSERT(map_bounds(loc));
ASSERT(_habitat_okay(monster, grd(loc)));
- if (mgrd(loc) != NON_MONSTER)
+ if (monster_at(loc))
{
mpr("Something prevents you from swapping places.");
return (false);
@@ -2657,7 +2657,7 @@ bool swap_check(monsters *monster, coord_def &loc, bool quiet)
int num_found = 0;
for (adjacent_iterator ai; ai; ++ai)
- if (mgrd(*ai) == NON_MONSTER && _habitat_okay( monster, grd(*ai))
+ if (!monster_at(*ai) && _habitat_okay(monster, grd(*ai))
&& one_chance_in(++num_found))
{
loc = *ai;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 40c39454aa..254c1c17ac 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -120,10 +120,10 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
ASSERT( you.can_pass_through_feat( new_grid ) );
// Better not be an unsubmerged monster either.
- ASSERT(swapping && mgrd(p) != NON_MONSTER
- || !swapping && (mgrd(p) == NON_MONSTER
- || menv[ mgrd(p) ].submerged()
- || feawn_passthrough(&menv[mgrd(p)])));
+ ASSERT(swapping && monster_at(p)
+ || !swapping && (!monster_at(p)
+ || monster_at(p)->submerged()
+ || feawn_passthrough(monster_at(p))));
// Don't prompt if force is true.
if (!force)
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 6b4c21bd08..bc2b9a6bb6 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1037,7 +1037,7 @@ static bool _spell_is_uncastable(spell_type spell)
static void _try_monster_cast(spell_type spell, int powc,
dist &spd, bolt &beam)
{
- if (mgrd(you.pos()) != NON_MONSTER)
+ if (monster_at(you.pos()))
{
mpr("Couldn't try casting monster spell because you're "
"on top of a monster.");
@@ -1074,7 +1074,7 @@ static void _try_monster_cast(spell_type spell, int powc,
if (!spd.isTarget)
mon->foe = MHITNOT;
- else if (mgrd(spd.target) == NON_MONSTER)
+ else if (!monster_at(spd.target))
{
if (spd.isMe)
mon->foe = MHITYOU;
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index a11c8676eb..45471455d9 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2277,7 +2277,7 @@ static void tag_read_level_monsters(reader &th, char minorVersion)
}
int midx = mgrd(m.pos());
if (midx != NON_MONSTER)
- mprf(MSGCH_ERROR, "(%d,%d) for %s already occupied by %s",
+ mprf(MSGCH_ERROR, "(%d, %d) for %s already occupied by %s",
m.pos().x, m.pos().y,
m.name(DESC_PLAIN, true).c_str(),
menv[midx].name(DESC_PLAIN, true).c_str());
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index 8a834dac7b..e7f9458985 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -958,9 +958,9 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2,
mgrd(pos1) = m2;
mgrd(pos2) = m1;
- if (mgrd(pos1) != NON_MONSTER)
+ if (monster_at(pos1))
menv[mgrd(pos1)].position = pos1;
- if (mgrd(pos2) != NON_MONSTER)
+ if (monster_at(pos2))
menv[mgrd(pos2)].position = pos2;
// Swap clouds.
@@ -1099,8 +1099,8 @@ bool fall_into_a_pool( const coord_def& entry, bool allow_shift,
else
{
// back out the way we came in, if possible
- if (grid_distance( you.pos(), entry ) == 1
- && mgrd(entry) == NON_MONSTER)
+ if (grid_distance(you.pos(), entry) == 1
+ && !monster_at(entry))
{
escape = true;
empty = entry;
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 579d704cf1..47caa84e56 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -2406,9 +2406,9 @@ int tileidx_feature(dungeon_feature_type feat, int gx, int gy)
else if (player_in_branch(BRANCH_SHOALS))
t = TILE_SHOALS_SHALLOW_WATER;
- if (mgrd[gx][gy] != NON_MONSTER)
+ monsters *mon = monster_at(coord_def(gx, gy));
+ if (mon)
{
- monsters *mon = &menv[mgrd[gx][gy]];
// Add disturbance to tile.
if (mon->submerged())
t += tile_dngn_count(t);
@@ -4764,12 +4764,12 @@ void tile_finish_dngn(unsigned int *tileb, int cx, int cy)
bool print_blood = true;
if (inside_halo(gc))
{
- if (see_cell(gc) && mgrd(gc) != NON_MONSTER)
+ monsters *mon = monster_at(gc);
+ if (see_cell(gc) && mon)
{
- monsters* m = &menv[mgrd(gc)];
- if (!mons_class_flag(m->type, M_NO_EXP_GAIN)
- && (!mons_is_mimic(m->type)
- || testbits(m->flags, MF_KNOWN_MIMIC)))
+ if (!mons_class_flag(mon->type, M_NO_EXP_GAIN)
+ && (!mons_is_mimic(mon->type)
+ || testbits(mon->flags, MF_KNOWN_MIMIC)))
{
tileb[count+1] |= TILE_FLAG_HALO;
print_blood = false;
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index cff4edb5ae..f54d178452 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1382,14 +1382,12 @@ bool DungeonRegion::update_tip_text(std::string& tip)
if (!cell_is_solid(m_cursor[CURSOR_MOUSE]))
{
- int mon_num = mgrd(m_cursor[CURSOR_MOUSE]);
- if (mon_num == NON_MONSTER || mons_friendly(&menv[mon_num]))
- {
+ const monsters *mon = monster_at(m_cursor[CURSOR_MOUSE]));
+ if (!mon || mons_friendly(mon))
tip = "[L-Click] Move\n";
- }
- else if (mon_num != NON_MONSTER)
+ else if (mon)
{
- tip = menv[mon_num].name(DESC_CAP_A);
+ tip = mon->name(DESC_CAP_A);
tip += "\n[L-Click] Attack\n";
}
}
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index ce00292b20..20cd825e36 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1330,19 +1330,17 @@ void TilesFramework::update_minimap(int gx, int gy, map_feature f)
coord_def gc(gx, gy);
- if (you.pos() == gc && you.on_current_level)
- {
+ if (gc == you.pos() && you.on_current_level)
f = MF_PLAYER;
- }
- else if (f == MF_MONS_HOSTILE && mgrd[gx][gy] != NON_MONSTER)
+ else if (monster_at(gc) && f == MF_MONS_HOSTILE)
{
- const int grid = mgrd[gx][gy];
- if (mons_friendly_real(&menv[grid]))
+ const monsters *mon = monster_at(gc);
+ if (mons_friendly_real(mon))
f = MF_MONS_FRIENDLY;
- else if (mons_class_flag(menv[grid].type, M_NO_EXP_GAIN))
- f = MF_MONS_NO_EXP;
- else if (mons_neutral(&menv[grid]))
+ else if (mons_neutral(mon))
f = MF_MONS_NEUTRAL;
+ else if (mons_class_flag(mon->type, M_NO_EXP_GAIN))
+ f = MF_MONS_NO_EXP;
}
else if (f == MF_FLOOR || f == MF_MAP_FLOOR || f == MF_WATER)
{
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index d011841572..e1607229cc 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -1407,7 +1407,7 @@ void tutorial_first_item(const item_def &item)
// corpse is first seen.
if (!Options.tut_just_triggered
&& item.base_type == OBJ_CORPSES
- && monster_at(item.pos) == NULL)
+ && !monster_at(item.pos))
{
learned_something_new(TUT_SEEN_CARRION, item.pos);
}
@@ -2135,7 +2135,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
case TUT_STAIR_BRAND:
// Monster or player standing on stairs.
- if (monster_at(gc) || you.pos() == gc)
+ if (actor_at(gc))
DELAY_EVENT;
viewwindow(true, false);
@@ -2152,7 +2152,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
case TUT_HEAP_BRAND:
// Monster or player standing on heap.
- if (monster_at(gc) || you.pos() == gc)
+ if (actor_at(gc))
DELAY_EVENT;
viewwindow(true, false);
@@ -2174,7 +2174,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
return;
#else
// Monster or player standing on trap.
- if (monster_at(gc) || (you.pos() == gc))
+ if (actor_at(gc))
DELAY_EVENT;
viewwindow(true, false);
@@ -4460,7 +4460,7 @@ static bool _water_is_disturbed(int x, int y)
const coord_def c(x,y);
const monsters *mon = monster_at(c);
- if (mon == NULL || grd(c) != DNGN_SHALLOW_WATER || !see_cell(c))
+ if (!mon || grd(c) != DNGN_SHALLOW_WATER || !see_cell(c))
return (false);
return (!mon->visible_to(&you) && !mons_flies(mon));
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 4b4ad25e4d..8e89b2639b 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -745,7 +745,7 @@ void monster_grid(bool do_updates)
"improperly placed. Updating mgrd.",
monster->name(DESC_PLAIN, true).c_str(), s,
monster->pos().x, monster->pos().y);
- ASSERT(mgrd(monster->pos()) == NON_MONSTER);
+ ASSERT(!monster_at(monster->pos()));
mgrd(monster->pos()) = s;
}