diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2011-03-06 20:10:14 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2011-03-06 20:10:14 +1000 |
commit | 7fb953b0ac69efd79bc04088cf69430a767a1b03 (patch) | |
tree | 7e766daa0fe3f07d3de3aa5db26eeb410fef0d8b /crawl-ref/source/mapmark.cc | |
parent | 8333f4560c760a8bbe7eb5d06b0b854466010365 (diff) | |
download | crawl-ref-7fb953b0ac69efd79bc04088cf69430a767a1b03.tar.gz crawl-ref-7fb953b0ac69efd79bc04088cf69430a767a1b03.zip |
Begin work on phoenix resurrection: phoenix map marker.
Currently, resurrection will be per-level, but support can later be
added for moving or recreating markers on the next level you go to if
you happen to be carrying a phoenix corpse with you.
It will also resurrect if the phoenix marker times out while you were
off level and the corpse was not otherwise destroyed. The mechanism will
track the location of the corpse, storing coord(-1, -1) when the corpse
is in your inventory, or the location otherwise.
Finally, none of this is actually coded, but the capacity now exists to
start using the new marker. That's really the hardest bit and the
longest to recompile, as it touches enum.h and mapmark.h.
More to come!
Diffstat (limited to 'crawl-ref/source/mapmark.cc')
-rw-r--r-- | crawl-ref/source/mapmark.cc | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc index 7537f2c56a..f8607fc0dc 100644 --- a/crawl-ref/source/mapmark.cc +++ b/crawl-ref/source/mapmark.cc @@ -32,7 +32,8 @@ map_marker::marker_reader map_marker::readers[NUM_MAP_MARKER_TYPES] = &map_corruption_marker::read, &map_wiz_props_marker::read, &map_tomb_marker::read, - &map_malign_gateway_marker::read + &map_malign_gateway_marker::read, + &map_phoenix_marker::read }; map_marker::marker_parser map_marker::parsers[NUM_MAP_MARKER_TYPES] = @@ -660,6 +661,56 @@ std::string map_malign_gateway_marker::debug_describe() const } ////////////////////////////////////////////////////////////////////////// +// map_phoenix_marker + +map_phoenix_marker::map_phoenix_marker(const coord_def& p, + int tst, int tso, beh_type bh, god_type gd, coord_def cp + ) + : map_marker(MAT_PHOENIX, p), turn_start(tst), turn_stop(tso), + behaviour(bh), god(gd), corpse_pos(cp) +{ +} + +void map_phoenix_marker::write(writer &out) const +{ + map_marker::write(out); + marshallShort(out, turn_start); + marshallShort(out, turn_stop); + marshallUByte(out, behaviour); + marshallUByte(out, god); + marshallCoord(out, corpse_pos); +} + +void map_phoenix_marker::read(reader &in) +{ + map_marker::read(in); + + turn_start = unmarshallShort(in); + turn_stop = unmarshallShort(in); + behaviour = static_cast<beh_type>(unmarshallUByte(in)); + god = static_cast<god_type>(unmarshallByte(in)); + corpse_pos = unmarshallCoord(in); +} + +map_marker *map_phoenix_marker::read(reader &in, map_marker_type) +{ + map_phoenix_marker *mc = new map_phoenix_marker(); + mc->read(in); + return (mc); +} + +map_marker *map_phoenix_marker::clone() const +{ + map_phoenix_marker *mark = new map_phoenix_marker(pos, turn_start, turn_stop, behaviour, god, corpse_pos); + return (mark); +} + +std::string map_phoenix_marker::debug_describe() const +{ + return make_stringf("Phoenix marker (%d, %d)", turn_start, turn_stop); +} + +////////////////////////////////////////////////////////////////////////// // Map markers in env. map_markers::map_markers() : markers(), have_inactive_markers(false) |