diff options
author | Neil Moore <neil@s-z.org> | 2013-09-05 18:09:29 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2013-09-05 19:08:19 -0400 |
commit | f94d332ad4a3ed19015f73155400ed316d1044b5 (patch) | |
tree | 0ef036f06eff665e697349c491b85ed8689dd0d4 /crawl-ref/source/maps.cc | |
parent | 2e0ee8d010926510cd55647d40ee58d93cb863fb (diff) | |
download | crawl-ref-f94d332ad4a3ed19015f73155400ed316d1044b5.tar.gz crawl-ref-f94d332ad4a3ed19015f73155400ed316d1044b5.zip |
Add a new "ORDER:" map header for sorting game-mode maps.
The first step towards fixing #7383. Defaults to INT_MAX, so things
that do not set it explicitly will be last. If two maps have the
same ORDER:, they will be sorted by description/name as before.
Also change the des cache index format to store ORDER (necessitating a
minor version bump). Rather than leaving ORDER at its default value
when loading an des cache index from earlier versions, we throw out
the entire index so that it can be regenerated.
Diffstat (limited to 'crawl-ref/source/maps.cc')
-rw-r--r-- | crawl-ref/source/maps.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 0eebfd02ea..b2bc9f4fce 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -1262,6 +1262,12 @@ static bool _load_map_index(const string& cache, const string &base, return false; } +#if TAG_MAJOR_VERSION == 34 + // Throw out pre-ORDER: indices entirely. + if (minor < TAG_MINOR_MAP_ORDER) + return false; +#endif + const int nmaps = unmarshallShort(inf); const int nexist = vdefs.size(); vdefs.resize(nexist + nmaps, map_def()); @@ -1270,6 +1276,7 @@ static bool _load_map_index(const string& cache, const string &base, map_def &vdef(vdefs[nexist + i]); vdef.read_index(inf); vdef.description = unmarshallString(inf); + vdef.order = unmarshallInt(inf); vdef.set_file(cache); lc_loaded_maps[vdef.name] = vdef.place_loaded_from; @@ -1356,6 +1363,7 @@ static void _write_map_index(const string &filebase, size_t vs, size_t ve, { vdefs[i].write_index(outf); marshallString(outf, vdefs[i].description); + marshallInt(outf, vdefs[i].order); vdefs[i].place_loaded_from.clear(); vdefs[i].strip(); } |