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

Function tiles_set_add_remove

plugins/burrow.cpp:392–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390}
391
392static 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
412static int burrow_tiles_set(lua_State *L) {
413 color_ostream *out = Lua::GetOutput(L);

Callers 3

burrow_tiles_setFunction · 0.85
burrow_tiles_addFunction · 0.85
burrow_tiles_removeFunction · 0.85

Calls 7

get_burrowFunction · 0.85
luaL_argerrorFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_isstringFunction · 0.85
setTilesByKeywordFunction · 0.85
copyTilesFunction · 0.85

Tested by

no test coverage detected