diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-03 10:47:44 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-03 10:47:44 +0000 |
commit | fb869dee39e5953d9240ac1344d029c3ff62d624 (patch) | |
tree | ee2a92547a332d91ff0cfafb6e7927868cf5b84c /crawl-ref/source/luadgn.cc | |
parent | df23c385f390c4a7beb7c24826085c35e6145b95 (diff) | |
download | crawl-ref-fb869dee39e5953d9240ac1344d029c3ff62d624.tar.gz crawl-ref-fb869dee39e5953d9240ac1344d029c3ff62d624.zip |
[2468791] Reduce distinction between minivaults and floating vaults. All vaults are now handled by _build_vaults.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8169 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/luadgn.cc')
-rw-r--r-- | crawl-ref/source/luadgn.cc | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index b85a67d5f7..1f5ac68b53 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -2378,10 +2378,11 @@ static int dgn_create_monster(lua_State *ls) for (int i = 0, size = mlist.size(); i < size; ++i) { mons_spec mspec = mlist.get_monster(i); - if (dgn_place_monster(mspec, you.your_level, c, - false, false, false)) + const int mid = dgn_place_monster(mspec, you.your_level, c, + false, false, false); + if (mid != -1) { - push_monster(ls, &menv[mgrd(c)]); + push_monster(ls, &menv[mid]); return (1); } } @@ -2418,23 +2419,23 @@ static int dgn_create_item(lua_State *ls) return (0); } -static std::auto_ptr<lua_datum> _dgn_map_bad_bounds_fn; +static std::auto_ptr<lua_datum> _dgn_map_safe_bounds_fn; -static bool _lua_map_place_invalid(const map_def &map, - const coord_def &c, - const coord_def &size) +static bool _lua_map_place_valid(const map_def &map, + const coord_def &c, + const coord_def &size) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "lua_map_place_invalid: (%d,%d) (%d,%d)", c.x, c.y, size.x, size.y); #endif - lua_stack_cleaner clean(_dgn_map_bad_bounds_fn->lua); + lua_stack_cleaner clean(_dgn_map_safe_bounds_fn->lua); // Push the Lua function onto the stack. - _dgn_map_bad_bounds_fn->push(); + _dgn_map_safe_bounds_fn->push(); - lua_State *ls = _dgn_map_bad_bounds_fn->lua; + lua_State *ls = _dgn_map_safe_bounds_fn->lua; // Push map, pos.x, pos.y, size.x, size.y clua_push_map(ls, const_cast<map_def*>(&map)); @@ -2459,12 +2460,12 @@ LUAFN(dgn_with_map_bounds_fn) if (lua_gettop(ls) != 2 || !lua_isfunction(ls, 1) || !lua_isfunction(ls, 2)) luaL_error(ls, "Expected map-bounds check fn and action fn."); - _dgn_map_bad_bounds_fn.reset(new lua_datum(vm, 1, false)); + _dgn_map_safe_bounds_fn.reset(new lua_datum(vm, 1, false)); int err = 0; { - unwind_var<map_place_check_t> mpc(map_place_invalid, - _lua_map_place_invalid); + unwind_var<map_place_check_t> mpc(map_place_valid, + _lua_map_place_valid); // All set, call our friend, the second function. ASSERT(lua_isfunction(ls, -1)); @@ -2476,7 +2477,7 @@ LUAFN(dgn_with_map_bounds_fn) // happen when lua_call does its longjmp. err = lua_pcall(ls, 0, 1, 0); - _dgn_map_bad_bounds_fn.reset(NULL); + _dgn_map_safe_bounds_fn.reset(NULL); } if (err) @@ -2670,9 +2671,8 @@ LUAFN(dgn_map_by_tag) { if (const char *tag = luaL_checkstring(ls, 1)) { - const bool mini = _lua_boolean(ls, 2, true); const bool check_depth = _lua_boolean(ls, 3, true); - return _lua_push_map(ls, random_map_for_tag(tag, mini, check_depth)); + return _lua_push_map(ls, random_map_for_tag(tag, check_depth)); } return (0); } @@ -2687,8 +2687,7 @@ LUAFN(dgn_map_in_depth) LUAFN(dgn_map_by_place) { const level_id lid = _lua_level_id(ls, 1); - const bool mini = _lua_boolean(ls, 2, true); - return _lua_push_map(ls, random_map_for_place(lid, mini)); + return _lua_push_map(ls, random_map_for_place(lid)); } LUAFN(_dgn_place_map) |