diff options
Diffstat (limited to 'crawl-ref/source/luadgn.cc')
-rw-r--r-- | crawl-ref/source/luadgn.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index 152368bb6a..0e81370fbe 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -340,6 +340,11 @@ static dungeon_feature_type _check_lua_feature(lua_State *ls, int idx) return (f); } +static inline bool _lua_boolean(lua_State *ls, int ndx, bool defval) +{ + return lua_isnone(ls, ndx)? defval : lua_toboolean(ls, ndx); +} + #define GETCOORD(c, p1, p2, boundfn) \ coord_def c; \ c.x = luaL_checkint(ls, p1); \ @@ -1136,8 +1141,11 @@ static int _lua_colour(lua_State *ls, int ndx, static int dgn_change_floor_colour(lua_State *ls) { const int colour = _lua_colour(ls, 1, BLACK); + const bool update_now = _lua_boolean(ls, 2, true); + env.floor_colour = (unsigned char) colour; - if (crawl_state.need_save) + + if (crawl_state.need_save && update_now) viewwindow(true, false); return (0); } @@ -1145,8 +1153,11 @@ static int dgn_change_floor_colour(lua_State *ls) static int dgn_change_rock_colour(lua_State *ls) { const int colour = _lua_colour(ls, 1, BLACK); + const bool update_now = _lua_boolean(ls, 2, true); + env.rock_colour = (unsigned char) colour; - if (crawl_state.need_save) + + if (crawl_state.need_save && update_now) viewwindow(true, false); return (0); } @@ -2233,11 +2244,6 @@ LUAFN(dgn_set_level_type_origin) return(0); } -static inline bool _lua_boolean(lua_State *ls, int ndx, bool defval) -{ - return lua_isnone(ls, ndx)? defval : lua_toboolean(ls, ndx); -} - static int _lua_push_map(lua_State *ls, const map_def *map) { if (map) |