diff options
Diffstat (limited to 'crawl-ref/source/exclude.cc')
-rw-r--r-- | crawl-ref/source/exclude.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc index 077487b1b1..4aae129c68 100644 --- a/crawl-ref/source/exclude.cc +++ b/crawl-ref/source/exclude.cc @@ -10,6 +10,7 @@ #include "mon-util.h" #include "overmap.h" #include "stuff.h" +#include "tags.h" #include "terrain.h" #include "travel.h" #include "tutorial.h" @@ -363,3 +364,42 @@ std::string get_exclusion_desc() ", and ", ", ")); } + +void marshallExcludes(writer& outf, const exclvec& excludes) +{ + marshallShort(outf, excludes.size()); + if (excludes.size()) + { + for (int i = 0, count = excludes.size(); i < count; ++i) + { + marshallCoord(outf, excludes[i].pos); + marshallShort(outf, excludes[i].radius); + marshallBoolean(outf, excludes[i].autoex); + marshallShort(outf, excludes[i].mon); + // XXX: marshall travel_exclude::vault? + } + } +} + +void unmarshallExcludes(reader& inf, char minorVersion, exclvec &excludes) +{ + excludes.clear(); + int nexcludes = unmarshallShort(inf); + if (nexcludes) + { + for (int i = 0; i < nexcludes; ++i) + { + coord_def c; + unmarshallCoord(inf, c); + const int radius = unmarshallShort(inf); + bool autoexcl = false; + monster_type mon = MONS_NO_MONSTER; + if (minorVersion >= TAG_ANNOTATE_EXCL) + { + autoexcl = unmarshallBoolean(inf); + mon = static_cast<monster_type>(unmarshallShort(inf)); + } + excludes.push_back(travel_exclude(c, radius, autoexcl, mon)); + } + } +} |