diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2014-05-28 11:40:51 -0600 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-05-28 11:41:50 -0600 |
commit | 12a312a68c4aae7d6e8dc669c6b782327fbb9be9 (patch) | |
tree | 1889eb5b31cace10a5ace5d9c0f38e871ec81434 /crawl-ref/source/l_view.cc | |
parent | 51f68aa8d130bf0736e63bcd1503c11107368e27 (diff) | |
download | crawl-ref-12a312a68c4aae7d6e8dc669c6b782327fbb9be9.tar.gz crawl-ref-12a312a68c4aae7d6e8dc669c6b782327fbb9be9.zip |
Have clua view. funcs give return vals with out-of-bounds coords (gw).
They didn't have anything specified to return then, leading to undefined
and odd behaviour.
Diffstat (limited to 'crawl-ref/source/l_view.cc')
-rw-r--r-- | crawl-ref/source/l_view.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crawl-ref/source/l_view.cc b/crawl-ref/source/l_view.cc index e93bc3784d..6f70c4b440 100644 --- a/crawl-ref/source/l_view.cc +++ b/crawl-ref/source/l_view.cc @@ -23,7 +23,10 @@ LUAFN(view_feature_at) COORDSHOW(s, 1, 2) const coord_def p = player2grid(s); if (!map_bounds(p)) + { + lua_pushnil(ls); return 1; + } dungeon_feature_type f = env.map_knowledge(p).feat(); lua_pushstring(ls, dungeon_feature_name(f)); return 1; @@ -34,7 +37,10 @@ LUAFN(view_is_safe_square) COORDSHOW(s, 1, 2) const coord_def p = player2grid(s); if (!map_bounds(p)) + { + PLUARET(boolean, false); return 1; + } cloud_type c = env.map_knowledge(p).cloud(); if (c != CLOUD_NONE && is_damaging_cloud(c, true) @@ -97,7 +103,10 @@ LUAFN(view_withheld) COORDSHOW(s, 1, 2) const coord_def p = player2grid(s); if (!map_bounds(p)) + { + PLUARET(boolean, false); return 1; + } PLUARET(boolean, env.map_knowledge(p).flags & MAP_WITHHELD); return 1; } |