summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/files.cc5
-rw-r--r--crawl-ref/source/ghost.cc15
2 files changed, 14 insertions, 6 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 2dbce76869..3a25835dde 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1830,7 +1830,7 @@ static void _restore_ghost_version( FILE *ghostFile,
void save_ghost( bool force )
{
- if (!force && (you.your_level < 2 || you.is_undead))
+ if (!force && you.your_level < 2)
return;
std::string cha_fil = make_filename( "bones", you.your_level,
@@ -1849,6 +1849,9 @@ void save_ghost( bool force )
ghosts = ghost_demon::find_ghosts();
+ if (ghosts.empty())
+ return;
+
gfile = lk_open("wb", cha_fil);
if (gfile == NULL)
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 728489b8f2..3535f4c449 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -470,12 +470,17 @@ std::vector<ghost_demon> ghost_demon::find_ghosts()
{
std::vector<ghost_demon> gs;
- ghost_demon player;
- player.init_player_ghost();
- announce_ghost(player);
- gs.push_back(player);
+ if (!you.is_undead)
+ {
+ ghost_demon player;
+ player.init_player_ghost();
+ announce_ghost(player);
+ gs.push_back(player);
+ }
- find_extra_ghosts( gs, n_extra_ghosts() );
+ // Pick up any other ghosts that happen to be on the level if we have space.
+ // If the player is undead, add one to the ghost quota for the level.
+ find_extra_ghosts( gs, n_extra_ghosts() + 1 - gs.size() );
return (gs);
}