| 626 | } |
| 627 | |
| 628 | static int burrow_units_clear(lua_State *L) { |
| 629 | color_ostream *out = Lua::GetOutput(L); |
| 630 | if (!out) |
| 631 | out = &Core::getInstance().getConsole(); |
| 632 | DEBUG(status,*out).print("entering burrow_units_clear\n"); |
| 633 | |
| 634 | int32_t count = 0; |
| 635 | lua_pushnil(L); // first key |
| 636 | while (lua_next(L, 1)) { |
| 637 | df::burrow * burrow = get_burrow(L, -1); |
| 638 | if (burrow) { |
| 639 | count += burrow->units.size(); |
| 640 | Burrows::clearUnits(burrow); |
| 641 | } |
| 642 | lua_pop(L, 1); // remove value, leave key |
| 643 | } |
| 644 | |
| 645 | Lua::Push(L, count); |
| 646 | return 1; |
| 647 | } |
| 648 | |
| 649 | static void units_set_add_remove(lua_State *L, bool do_set, bool enable) { |
| 650 | df::burrow *target = get_burrow(L, 1); |
nothing calls this directly
no test coverage detected