summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ghost.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/ghost.cc')
-rw-r--r--crawl-ref/source/ghost.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 901a4b92d4..1886b65f8b 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -16,6 +16,7 @@
#include "externs.h"
#include "itemname.h"
#include "itemprop.h"
+#include "mon-iter.h"
#include "ng-input.h"
#include "random.h"
#include "skills2.h"
@@ -846,16 +847,13 @@ void ghost_demon::announce_ghost(const ghost_demon &g)
void ghost_demon::find_extra_ghosts( std::vector<ghost_demon> &gs, int n )
{
- for (int i = 0; n > 0 && i < MAX_MONSTERS; ++i)
+ for (monster_iterator mi; mi; ++mi)
{
- if (!menv[i].alive())
- continue;
-
- if (menv[i].type == MONS_PLAYER_GHOST && menv[i].ghost.get())
+ if (mi->type == MONS_PLAYER_GHOST && mi->ghost.get())
{
// Bingo!
- announce_ghost(*menv[i].ghost);
- gs.push_back(*menv[i].ghost);
+ announce_ghost(*(mi->ghost));
+ gs.push_back(*(mi->ghost));
--n;
}
}