summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ghost.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-13 03:59:23 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-13 03:59:23 +0000
commit53fa153719a82b238120b85f3e16644c31a67ff4 (patch)
tree0e028464cbe53d6f521621ad1227e162ad03935c /crawl-ref/source/ghost.cc
parent2269f51342b63e5b8670da098b71998d4b4dd901 (diff)
downloadcrawl-ref-53fa153719a82b238120b85f3e16644c31a67ff4.tar.gz
crawl-ref-53fa153719a82b238120b85f3e16644c31a67ff4.zip
When searching for multiple ghosts, also check the transit list. Only applies
to Abyssal ghosts at the moment. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1290 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/ghost.cc')
-rw-r--r--crawl-ref/source/ghost.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 6bcaa281f0..5216cc4352 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -15,6 +15,7 @@
#include "skills2.h"
#include "stuff.h"
#include "misc.h"
+#include "mtransit.h"
#include "player.h"
#include <vector>
@@ -459,6 +460,31 @@ std::vector<ghost_demon> ghost_demon::find_ghosts()
return (gs);
}
+void ghost_demon::find_transiting_ghosts(
+ std::vector<ghost_demon> &gs, int n)
+{
+ if (n <= 0)
+ return;
+
+ const m_transit_list *mt = get_transit_list(level_id::current());
+ if (mt)
+ {
+ for (m_transit_list::const_iterator i = mt->begin();
+ i != mt->end() && n > 0; ++i)
+ {
+ if (i->mons.type == MONS_PLAYER_GHOST)
+ {
+ const monsters &m = i->mons;
+ if (m.ghost.get())
+ {
+ gs.push_back(*m.ghost);
+ --n;
+ }
+ }
+ }
+ }
+}
+
void ghost_demon::find_extra_ghosts( std::vector<ghost_demon> &gs, int n )
{
for (int i = 0; n > 0 && i < MAX_MONSTERS; ++i)
@@ -473,6 +499,9 @@ void ghost_demon::find_extra_ghosts( std::vector<ghost_demon> &gs, int n )
--n;
}
}
+
+ // Check the transit list for the current level.
+ find_transiting_ghosts(gs, n);
}
int ghost_demon::n_extra_ghosts()