diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-08-29 13:05:49 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-08-29 13:05:49 +0200 |
commit | d634ad8574598057aeece0f443549da9f2cff0f0 (patch) | |
tree | f2628a70bdefe96b662983ee7222433fd9a6551a /crawl-ref/source/l_dgnbld.cc | |
parent | de2d8d3d7e7350952d0b027605bd3a59f74456ed (diff) | |
download | crawl-ref-d634ad8574598057aeece0f443549da9f2cff0f0.tar.gz crawl-ref-d634ad8574598057aeece0f443549da9f2cff0f0.zip |
Fix lua wrapper to delve() passing arguments in a cumbersome way.
We're not going to set connchance or top without setting ngb_min/max.
Diffstat (limited to 'crawl-ref/source/l_dgnbld.cc')
-rw-r--r-- | crawl-ref/source/l_dgnbld.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc index 0858d013e2..74095b4196 100644 --- a/crawl-ref/source/l_dgnbld.cc +++ b/crawl-ref/source/l_dgnbld.cc @@ -104,6 +104,9 @@ static bool _table_bool(lua_State *ls, int idx, const char *name, bool defval) #define TABLE_STR(ls, val, def) const char *val = _table_str(ls, -1, #val, def); #define TABLE_BOOL(ls, val, def) bool val = _table_bool(ls, -1, #val, def); +#define ARG_INT(ls, num, val, def) int val = lua_isnone(ls, num) ? \ + def : lua_tointeger(ls, num) + // Read a set of box coords (x1, y1, x2, y2) from the table. // Return true if coords are valid. static bool _coords(lua_State *ls, map_lines &lines, @@ -901,11 +904,11 @@ LUAFN(dgn_delve) { LINES(ls, 1, lines); - TABLE_INT(ls, ngb_min, 2); - TABLE_INT(ls, ngb_max, 3); - TABLE_INT(ls, connchance, 0); - TABLE_INT(ls, cellnum, -1); - TABLE_INT(ls, top, 125); + ARG_INT(ls, 2, ngb_min, 2); + ARG_INT(ls, 3, ngb_max, 3); + ARG_INT(ls, 4, connchance, 0); + ARG_INT(ls, 5, cellnum, -1); + ARG_INT(ls, 6, top, 125); delve(&lines, ngb_min, ngb_max, connchance, cellnum, top); return (0); |