summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/delay.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/delay.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/delay.cc')
-rw-r--r--crawl-ref/source/delay.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 08a7e92d9f..b8caa84917 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -83,11 +83,11 @@ static bool _recite_mons_useless(const monsters *mon)
// Power is maximum 50.
static int _recite_to_monsters(coord_def where, int pow, int, actor *)
{
- const int mon = mgrd(where);
- if (mon == NON_MONSTER)
- return (0);
- monsters *mons = &menv[mon];
+ monsters *mons = monster_at(where);
+
+ if (mons == NULL)
+ return (0);
if (_recite_mons_useless(mons))
return (0);
@@ -676,13 +676,14 @@ int check_recital_audience()
for ( radius_iterator ri(you.pos(), 8); ri; ++ri )
{
- if ( mgrd(*ri) == NON_MONSTER )
+ monsters* mons = monster_at(*ri);
+ if (mons == NULL)
continue;
found_monsters = true;
// Check if audience can listen.
- if (!_recite_mons_useless( &menv[mgrd(*ri)] ) )
+ if (!_recite_mons_useless(mons))
return (1);
}
@@ -1139,13 +1140,11 @@ static void _finish_delay(const delay_queue_item &delay)
}
// Move any monsters out of the way:
- int mon = mgrd(pass);
- if (mon != NON_MONSTER)
+ if (monsters* m = monster_at(pass))
{
- monsters* m = &menv[mon];
// One square, a few squares, anywhere...
if (!shift_monster(m) && !monster_blink(m))
- monster_teleport( m, true, true );
+ monster_teleport(m, true, true);
}
move_player_to_grid(pass, false, true, true);