summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/decks.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-13 00:47:33 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-13 00:47:33 +0000
commit412bcd6e779cd3883bc5c6ce29a8e79ad32c63f4 (patch)
tree45316891325a63a834b5baef43896e464ed8fedb /crawl-ref/source/decks.cc
parent2dd4fe4a7f0b809a9f3a565f64ed6b5dcb1ab814 (diff)
downloadcrawl-ref-412bcd6e779cd3883bc5c6ce29a8e79ad32c63f4.tar.gz
crawl-ref-412bcd6e779cd3883bc5c6ce29a8e79ad32c63f4.zip
Remove a great many cases where mgrd is accessed directly in favour
of monster_at(). The hope is to eventually remove mgrd completely (in favour of scanning through the monster list, or a different datastructure which gets updated automatically when monsters move), and thus fix all the mgrd-out-of-sync bugs in one fell swoop. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9056 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/decks.cc')
-rw-r--r--crawl-ref/source/decks.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index c5b56ffa0c..8e9ca93b77 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1738,14 +1738,12 @@ static int _drain_monsters(coord_def where, int pow, int, actor *)
drain_exp();
else
{
- const int mnstr = mgrd(where);
- if (mnstr == NON_MONSTER)
+ monsters* mon = monster_at(where);
+ if (mon == NULL)
return (0);
- monsters& mon = menv[mnstr];
-
- if (!mon.drain_exp(&you, false, pow / 50))
- simple_monster_message(&mon, " is unaffected.");
+ if (mon->drain_exp(&you, false, pow / 50))
+ simple_monster_message(mon, " is unaffected.");
}
return (1);
@@ -2533,7 +2531,7 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
{
// Do-nothing (effectively): create a cosmetic feature
const coord_def pos = pick_adjacent_free_square(you.pos());
- if (pos.x >= 0 && pos.y >= 0)
+ if (in_bounds(pos))
{
const dungeon_feature_type statfeat[] = {
DNGN_GRANITE_STATUE, DNGN_ORCISH_IDOL