summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/describe.cc2
-rw-r--r--crawl-ref/source/ghost.cc6
-rw-r--r--crawl-ref/source/ghost.h1
-rw-r--r--crawl-ref/source/mon-util.cc1
-rw-r--r--crawl-ref/source/tags.cc2
5 files changed, 11 insertions, 1 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 2150e15e31..dfb4517cf3 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2997,7 +2997,7 @@ std::string get_ghost_description(const monsters &mons, bool concise)
<< skill_title( ghost.best_skill,
(unsigned char)ghost.best_skill_level,
gspecies,
- str, dex, GOD_NO_GOD )
+ str, dex, ghost.religion )
<< ", a"
<< ((ghost.xl < 4) ? " weakling" :
(ghost.xl < 7) ? "n average" :
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 2b8048a426..5322114bc9 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -22,6 +22,7 @@ REVISION("$Rev$");
#include "mtransit.h"
#include "place.h"
#include "player.h"
+#include "religion.h"
#include <vector>
std::vector<ghost_demon> ghosts;
@@ -118,6 +119,7 @@ void ghost_demon::reset()
name.clear();
species = SP_UNKNOWN;
job = JOB_UNKNOWN;
+ religion = GOD_NO_GOD;
best_skill = SK_FIGHTING;
best_skill_level = 0;
xl = 0;
@@ -346,6 +348,10 @@ void ghost_demon::init_player_ghost()
species = you.species;
job = you.char_class;
+
+ // Ghosts can't worship good gods.
+ religion = is_good_god(you.religion) ? GOD_NO_GOD : you.religion;
+
best_skill = ::best_skill(SK_FIGHTING, (NUM_SKILLS - 1), 99);
best_skill_level = you.skills[best_skill];
xl = you.experience_level;
diff --git a/crawl-ref/source/ghost.h b/crawl-ref/source/ghost.h
index 91206885a5..8cb574dd4b 100644
--- a/crawl-ref/source/ghost.h
+++ b/crawl-ref/source/ghost.h
@@ -23,6 +23,7 @@ public:
species_type species;
job_type job;
+ god_type religion;
skill_type best_skill;
short best_skill_level;
short xl;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index ac0a59680e..08dc4be5fa 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -6159,6 +6159,7 @@ void monsters::pandemon_init()
void monsters::ghost_init()
{
type = MONS_PLAYER_GHOST;
+ god = ghost->religion;
hit_dice = ghost->xl;
hit_points = ghost->max_hp;
max_hit_points = ghost->max_hp;
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index f3388f935f..72bbfb85f2 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2425,6 +2425,7 @@ static void marshallGhost(writer &th, const ghost_demon &ghost)
marshallShort(th, ghost.species);
marshallShort(th, ghost.job);
+ marshallByte(th, ghost.religion);
marshallShort(th, ghost.best_skill);
marshallShort(th, ghost.best_skill_level);
marshallShort(th, ghost.xl);
@@ -2453,6 +2454,7 @@ static ghost_demon unmarshallGhost(reader &th)
ghost.species = static_cast<species_type>( unmarshallShort(th) );
ghost.job = static_cast<job_type>( unmarshallShort(th) );
+ ghost.religion = static_cast<god_type>( unmarshallByte(th) );
ghost.best_skill = static_cast<skill_type>( unmarshallShort(th) );
ghost.best_skill_level = unmarshallShort(th);
ghost.xl = unmarshallShort(th);