From 4758caffda6ea00f6d4f83e58a2ae98d2d0f35a7 Mon Sep 17 00:00:00 2001 From: dolorous Date: Fri, 17 Apr 2009 20:18:41 +0000 Subject: Since making player ghosts retain their religions breaks binary compatibility with previous bones files, increase the minor version number of bones files. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9614 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/tags.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/tags.cc') 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( 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( unmarshallShort(th) ); ghost.job = static_cast( unmarshallShort(th) ); - ghost.religion = static_cast( unmarshallByte(th) ); + + if (minorVersion >= TAG_MINOR_RELIGION) + ghost.religion = static_cast( unmarshallByte(th) ); + ghost.best_skill = static_cast( 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)); } -- cgit v1.2.3-54-g00ecf