| 390 | } |
| 391 | |
| 392 | static void tiles_set_add_remove(lua_State *L, bool do_set, bool enable) { |
| 393 | df::burrow *target = get_burrow(L, 1); |
| 394 | if (!target) { |
| 395 | luaL_argerror(L, 1, "invalid burrow specifier or burrow not found"); |
| 396 | return; |
| 397 | } |
| 398 | |
| 399 | if (do_set) |
| 400 | Burrows::clearTiles(target); |
| 401 | |
| 402 | lua_pushnil(L); // first key |
| 403 | while (lua_next(L, 2)) { |
| 404 | if (!lua_isstring(L, -1) || !setTilesByKeyword(target, luaL_checkstring(L, -1), enable)) { |
| 405 | if (auto burrow = get_burrow(L, -1)) |
| 406 | copyTiles(target, burrow, enable); |
| 407 | } |
| 408 | lua_pop(L, 1); // remove value, leave key |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | static int burrow_tiles_set(lua_State *L) { |
| 413 | color_ostream *out = Lua::GetOutput(L); |
no test coverage detected