diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-07 10:08:34 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-07 10:09:28 +0530 |
commit | 9dc168e1b56f681ecb8d806048fa649129207c9b (patch) | |
tree | 012d0838e7bb93e21ca2c7d51da1a5947ccb1778 /crawl-ref/source/dat | |
parent | 4019ecbcd1b8bd2f74c3a21de1978e05e03b1413 (diff) | |
download | crawl-ref-9dc168e1b56f681ecb8d806048fa649129207c9b.tar.gz crawl-ref-9dc168e1b56f681ecb8d806048fa649129207c9b.zip |
Add test case to generate branch ends and verify that runes and orb exist.
Diffstat (limited to 'crawl-ref/source/dat')
-rw-r--r-- | crawl-ref/source/dat/clua/iter.lua | 4 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/test.lua | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/crawl-ref/source/dat/clua/iter.lua b/crawl-ref/source/dat/clua/iter.lua index e4d1409781..8adf548a15 100644 --- a/crawl-ref/source/dat/clua/iter.lua +++ b/crawl-ref/source/dat/clua/iter.lua @@ -338,7 +338,7 @@ function iter.stack_search (coord, term, extra) local stack = dgn.items_at(_x, _y) if #stack == 0 then - error("no stack at " .. _x .. "/" .. _y) + return nil end for _, item in ipairs(stack) do @@ -347,7 +347,7 @@ function iter.stack_search (coord, term, extra) end end - return false + return nil end function iter.stack_destroy(coord, extra) diff --git a/crawl-ref/source/dat/clua/test.lua b/crawl-ref/source/dat/clua/test.lua index 404b2e1d1f..22a4005d20 100644 --- a/crawl-ref/source/dat/clua/test.lua +++ b/crawl-ref/source/dat/clua/test.lua @@ -20,4 +20,15 @@ function test.regenerate_level(place) debug.flush_map_memory() dgn.reset_level() debug.generate_level() +end + +function test.level_contains_item(item) + for y = 1, dgn.GYM - 2 do + for x = 1, dgn.GXM - 2 do + if iter.stack_search(x, y, item) then + return true + end + end + end + return false end
\ No newline at end of file |