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

Function units_set_add_remove

plugins/burrow.cpp:649–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649static void units_set_add_remove(lua_State *L, bool do_set, bool enable) {
650 df::burrow *target = get_burrow(L, 1);
651 if (!target) {
652 luaL_argerror(L, 1, "invalid burrow specifier or burrow not found");
653 return;
654 }
655
656 if (do_set)
657 Burrows::clearUnits(target);
658
659 lua_pushnil(L); // first key
660 while (lua_next(L, 2)) {
661 if (auto burrow = get_burrow(L, -1))
662 copyUnits(target, burrow, enable);
663 lua_pop(L, 1); // remove value, leave key
664 }
665}
666
667static int burrow_units_set(lua_State *L) {
668 color_ostream *out = Lua::GetOutput(L);

Callers 3

burrow_units_setFunction · 0.85
burrow_units_addFunction · 0.85
burrow_units_removeFunction · 0.85

Calls 5

get_burrowFunction · 0.85
luaL_argerrorFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
copyUnitsFunction · 0.85

Tested by

no test coverage detected