MCPcopy Create free account
hub / github.com/DFHack/dfhack / burrow_units_clear

Function burrow_units_clear

plugins/burrow.cpp:628–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628static 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
649static void units_set_add_remove(lua_State *L, bool do_set, bool enable) {
650 df::burrow *target = get_burrow(L, 1);

Callers

nothing calls this directly

Calls 6

lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
get_burrowFunction · 0.85
PushFunction · 0.85
printMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected