diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2010-12-25 18:49:30 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2010-12-25 18:56:28 +1000 |
commit | 65265646d4a0aaf96896d210a10994fe4b036b78 (patch) | |
tree | fa9d506c5ad5f4cf58b3fca2e2204de1944b1337 /crawl-ref/source/mapmark.cc | |
parent | 51c31aabb8d36db0f3ad69a4b982aeed88806e87 (diff) | |
download | crawl-ref-65265646d4a0aaf96896d210a10994fe4b036b78.tar.gz crawl-ref-65265646d4a0aaf96896d210a10994fe4b036b78.zip |
Fix #2975: crash on loading save after monster cast Malign Gateway.
This dumps the storage of the caster as part of the map marker, and
instead uses, temporarily and for monster-cast MG, the monster's full
name as a non-actor summoner.
Cons: the blame prefix won't work fully for monsters that are summoned
themselves casting Malign Gateway.
Future fix: replace passing of actor into mgen_data with a new struct,
ie "summon_chain", that contains relevant information (caster's name,
serial number, behaviour and own blame vector, for instance).
Increments minor version to 21. Finally, should fix loading of games
currently broken due to this bug.
Diffstat (limited to 'crawl-ref/source/mapmark.cc')
-rw-r--r-- | crawl-ref/source/mapmark.cc | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc index 950a49a541..5336802992 100644 --- a/crawl-ref/source/mapmark.cc +++ b/crawl-ref/source/mapmark.cc @@ -613,10 +613,10 @@ std::string map_tomb_marker::debug_describe() const // map_malign_gateway_marker map_malign_gateway_marker::map_malign_gateway_marker(const coord_def &p, - int dur, bool ip, monster* mon, god_type gd, - int pow) + int dur, bool ip, std::string sum, beh_type b, + god_type gd, int pow) : map_marker(MAT_MALIGN, p), duration(dur), is_player(ip), monster_summoned(false), - caster(mon), god(gd), power(pow) + summoner_string(sum), behaviour(b), god(gd), power(pow) { } @@ -626,30 +626,49 @@ void map_malign_gateway_marker::write(writer &out) const marshallShort(out, duration); marshallBoolean(out, is_player); marshallBoolean(out, monster_summoned); - if (!is_player) - marshallMonster(out, *caster); - marshallByte(out, god); + marshallString(out, summoner_string); + marshallUByte(out, behaviour); + marshallUByte(out, god); marshallShort(out, power); } void map_malign_gateway_marker::read(reader &in) { + int minorVersion = in.getMinorVersion(); + map_marker::read(in); duration = unmarshallShort(in); is_player = unmarshallBoolean(in); #if TAG_MAJOR_VERSION == 31 - int minorVersion = in.getMinorVersion(); if (minorVersion < TAG_MINOR_MALIGN) monster_summoned = true; else #endif monster_summoned = unmarshallBoolean(in); - - if (!is_player) - unmarshallMonster(in, *caster); +#if TAG_MAJOR_VERSION == 31 + if (minorVersion < TAG_MINOR_FIX_MG) + { + summoner_string = ""; + behaviour = BEH_HOSTILE; + } else - caster = NULL; + { +#endif + summoner_string = unmarshallString(in); + behaviour = static_cast<beh_type>(unmarshallUByte(in)); +#if TAG_MAJOR_VERSION == 31 + } +#endif + +#if TAG_MAJOR_VERSION == 31 + if (!is_player && minorVersion < TAG_MINOR_FIX_MG) + { + monster caster; + unmarshallMonster(in, caster); + } +#endif + god = static_cast<god_type>(unmarshallByte(in)); power = unmarshallShort(in); } @@ -663,7 +682,7 @@ map_marker *map_malign_gateway_marker::read(reader &in, map_marker_type) map_marker *map_malign_gateway_marker::clone() const { - map_malign_gateway_marker *mark = new map_malign_gateway_marker(pos, duration, is_player, caster, god, power); + map_malign_gateway_marker *mark = new map_malign_gateway_marker(pos, duration, is_player, summoner_string, behaviour, god, power); return (mark); } |