diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2011-11-11 12:57:49 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2011-11-11 12:59:23 +1000 |
commit | 2a03c9ca873bc47629f44a991bc1411ff9009c4c (patch) | |
tree | 0dfee2080cffe09f4791dcb2746939a30bdae6cf /crawl-ref/source/mapmark.cc | |
parent | dc09296bda552fd809aa1b71ac7376096718ac2f (diff) | |
download | crawl-ref-2a03c9ca873bc47629f44a991bc1411ff9009c4c.tar.gz crawl-ref-2a03c9ca873bc47629f44a991bc1411ff9009c4c.zip |
Fix Phoenix attitude, marker removal (#4881).
This should retain the correct attitude across rebirth, and resolve any
issues with accessing the freed marker for information. It doesn't
resolve cross-level changes, though.
Diffstat (limited to 'crawl-ref/source/mapmark.cc')
-rw-r--r-- | crawl-ref/source/mapmark.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc index 5227554820..4c48c95621 100644 --- a/crawl-ref/source/mapmark.cc +++ b/crawl-ref/source/mapmark.cc @@ -664,10 +664,10 @@ std::string map_malign_gateway_marker::debug_describe() const // map_phoenix_marker map_phoenix_marker::map_phoenix_marker(const coord_def& p, - int dur, int mnum, beh_type bh, god_type gd, coord_def cp - ) + int dur, int mnum, beh_type bh, mon_attitude_type at, + god_type gd, coord_def cp) : map_marker(MAT_PHOENIX, p), duration(dur), mon_num(mnum), - behaviour(bh), god(gd), corpse_pos(cp) + behaviour(bh), attitude(at), god(gd), corpse_pos(cp) { } @@ -677,6 +677,7 @@ void map_phoenix_marker::write(writer &out) const marshallShort(out, duration); marshallShort(out, mon_num); marshallUByte(out, behaviour); + marshallUByte(out, attitude); marshallUByte(out, god); marshallCoord(out, corpse_pos); } @@ -688,6 +689,12 @@ void map_phoenix_marker::read(reader &in) duration = unmarshallShort(in); mon_num = unmarshallShort(in); behaviour = static_cast<beh_type>(unmarshallUByte(in)); +#if TAG_MAJOR_VERSION == 32 + if (in.getMinorVersion() < TAG_MINOR_PHOENIX_ATTITUDE) + attitude = ATT_HOSTILE; + else +#endif + attitude = static_cast<mon_attitude_type>(unmarshallUByte(in)); god = static_cast<god_type>(unmarshallByte(in)); corpse_pos = unmarshallCoord(in); } @@ -701,7 +708,8 @@ map_marker *map_phoenix_marker::read(reader &in, map_marker_type) map_marker *map_phoenix_marker::clone() const { - map_phoenix_marker *mark = new map_phoenix_marker(pos, duration, mon_num, behaviour, god, corpse_pos); + map_phoenix_marker *mark = new map_phoenix_marker(pos, duration, mon_num, + behaviour, attitude, god, corpse_pos); return (mark); } |