summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgn.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2013-09-05 18:09:29 -0400
committerNeil Moore <neil@s-z.org>2013-09-05 19:08:19 -0400
commitf94d332ad4a3ed19015f73155400ed316d1044b5 (patch)
tree0ef036f06eff665e697349c491b85ed8689dd0d4 /crawl-ref/source/l_dgn.cc
parent2e0ee8d010926510cd55647d40ee58d93cb863fb (diff)
downloadcrawl-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/l_dgn.cc')
-rw-r--r--crawl-ref/source/l_dgn.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc
index d7c9374ee0..9acc0191ee 100644
--- a/crawl-ref/source/l_dgn.cc
+++ b/crawl-ref/source/l_dgn.cc
@@ -134,6 +134,13 @@ static int dgn_desc(lua_State *ls)
PLUARET(string, map->description.c_str());
}
+static int dgn_order(lua_State *ls)
+{
+ MAP(ls, 1, map);
+ map->order = luaL_checkint(ls, 2);
+ PLUARET(number, map->order);
+}
+
static int dgn_tags(lua_State *ls)
{
MAP(ls, 1, map);
@@ -1849,6 +1856,7 @@ const struct luaL_reg dgn_dlib[] =
{ "depth", dgn_depth },
{ "place", dgn_place },
{ "desc", dgn_desc },
+{ "order", dgn_order },
{ "tags", dgn_tags },
{ "has_tag", dgn_has_tag },
{ "tags_remove", dgn_tags_remove },