diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-07 11:14:16 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-07 11:14:16 +0530 |
commit | 278d5e8a894b48f0773b7546e7b4be45048264b1 (patch) | |
tree | d73ed29b201c0d2c9d6b7d50dfca435da750bdd7 /crawl-ref/source | |
parent | f8419c6ec131cedd6b2bcb7ffb3ba95c9448d6ac (diff) | |
download | crawl-ref-278d5e8a894b48f0773b7546e7b4be45048264b1.tar.gz crawl-ref-278d5e8a894b48f0773b7546e7b4be45048264b1.zip |
Crawl now checks for the availability of branch ending vaults before starting up.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/dat/clua/sanity.lua | 17 | ||||
-rw-r--r-- | crawl-ref/source/main.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/maps.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/maps.h | 1 |
4 files changed, 25 insertions, 0 deletions
diff --git a/crawl-ref/source/dat/clua/sanity.lua b/crawl-ref/source/dat/clua/sanity.lua new file mode 100644 index 0000000000..aea29a5b96 --- /dev/null +++ b/crawl-ref/source/dat/clua/sanity.lua @@ -0,0 +1,17 @@ +-- Sanity checks that should be run just before the game starts. + +local function assert_place_has_map(place) + assert(dgn.map_by_place(place), "No map found for " .. place) +end + +local function sanity_checks() + local places = { + "Zot:$", "Snake:$", "Swamp:$", "Slime:$", "Vault:$", + "Tomb:$", "Coc:$", "Tar:$", "Dis:$", "Geh:$" + } + for _, place in ipairs(places) do + assert_place_has_map(place) + end +end + +sanity_checks()
\ No newline at end of file diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index 4f22615c92..d714d64d12 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -3765,6 +3765,8 @@ static bool _initialise(void) if (crawl_state.build_db) end(0); + sanity_check_maps(); + cio_init(); // System initialisation stuff. diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 1325ad63a3..32f722d5f1 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -1163,6 +1163,11 @@ const map_def *map_by_index(int index) return (&vdefs[index]); } +void sanity_check_maps() +{ + dlua.execfile("clua/sanity.lua", true, true); +} + /////////////////////////////////////////////////////////////////////////// // Debugging code diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h index ffcd6f2333..610a248534 100644 --- a/crawl-ref/source/maps.h +++ b/crawl-ref/source/maps.h @@ -52,6 +52,7 @@ std::vector<map_def> find_maps_for_tag (const std::string tag, int weight_map_vector (std::vector<map_def> maps); void read_maps(); +void sanity_check_maps(); void read_map(const std::string &file); void run_map_preludes(); void reset_map_parser(); |