summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
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/dungeon.cc
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/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc16
1 files changed, 8 insertions, 8 deletions
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;