From 51ded013829b4cd8f73fa7f6313e73d2f7550aa5 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 5 Nov 2009 12:57:13 -0600 Subject: 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(). --- crawl-ref/source/monstuff.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') 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; -- cgit v1.2.3-54-g00ecf