diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/tags.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/tags.h | 3 |
2 files changed, 10 insertions, 6 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 72bbfb85f2..3f64344891 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -187,7 +187,7 @@ static void tag_construct_ghost(writer &th); static void tag_read_ghost(reader &th, char minorVersion); static void marshallGhost(writer &th, const ghost_demon &ghost); -static ghost_demon unmarshallGhost(reader &th); +static ghost_demon unmarshallGhost(reader &th, char minorVersion); static void marshallResists(writer &, const mon_resist_def &); static void unmarshallResists(reader &, mon_resist_def &); @@ -2175,7 +2175,7 @@ static void unmarshall_monster(reader &th, monsters &m) m.god = static_cast<god_type>( unmarshallByte(th) ); if (m.type == MONS_PLAYER_GHOST || m.type == MONS_PANDEMONIUM_DEMON) - m.set_ghost(unmarshallGhost(th)); + m.set_ghost(unmarshallGhost(th, _tag_minor_version)); m.check_speed(); } @@ -2446,7 +2446,7 @@ static void marshallGhost(writer &th, const ghost_demon &ghost) marshallSpells(th, ghost.spells); } -static ghost_demon unmarshallGhost(reader &th) +static ghost_demon unmarshallGhost(reader &th, char minorVersion) { ghost_demon ghost; @@ -2454,7 +2454,10 @@ 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) ); + + if (minorVersion >= TAG_MINOR_RELIGION) + 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); @@ -2494,5 +2497,5 @@ static void tag_read_ghost(reader &th, char minorVersion) return; for (int i = 0; i < nghosts; ++i) - ghosts.push_back(unmarshallGhost(th)); + ghosts.push_back(unmarshallGhost(th, minorVersion)); } diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h index b9ca330b2a..3ee92cc930 100644 --- a/crawl-ref/source/tags.h +++ b/crawl-ref/source/tags.h @@ -62,7 +62,8 @@ enum tag_minor_version // Bump version past 12. TAG_MINOR_SVNREV = 13, // Added SVN revision TAG_MINOR_PORTEXT = 14, // Keep track of portal vault extensions. - TAG_MINOR_VERSION = 14 // Current version. (Keep equal to max.) + TAG_MINOR_RELIGION = 15, // Keep track of ghosts' religions. + TAG_MINOR_VERSION = 15 // Current version. (Keep equal to max.) }; |