MCPcopy Create free account
hub / github.com/NetHack/NetHack / l_selection_flood

Function l_selection_flood

src/nhlsel.c:725–754  ·  view source on GitHub ↗

local s = selection.floodfill(x,y); */ local s = selection.floodfill(x,y, diagonals); */

Source from the content-addressed store, hash-verified

723/* local s = selection.floodfill(x,y); */
724/* local s = selection.floodfill(x,y, diagonals); */
725staticfn int
726l_selection_flood(lua_State *L)
727{
728 int argc = lua_gettop(L);
729 struct selectionvar *sel = (struct selectionvar *) 0;
730 coordxy x = 0, y = 0;
731 boolean diagonals = FALSE;
732
733 if (argc == 2 || argc == 3) {
734 x = (coordxy) luaL_checkinteger(L, 1);
735 y = (coordxy) luaL_checkinteger(L, 2);
736 if (argc == 3)
737 diagonals = lua_toboolean(L, 3);
738 lua_pop(L, argc);
739 (void) l_selection_new(L);
740 sel = l_selection_check(L, 1);
741 } else {
742 nhl_error(L, "wrong parameters");
743 /*NOTREACHED*/
744 }
745
746 get_location_coord(&x, &y, ANY_LOC, gc.coder ? gc.coder->croom : NULL,
747 SP_COORD_PACK(x, y));
748
749 if (isok(x, y)) {
750 set_floodfillchk_match_under(levl[x][y].typ);
751 selection_floodfill(sel, x, y, diagonals);
752 }
753 return 1;
754}
755
756
757/* local s = selection.circle(x,y, radius); */

Callers

nothing calls this directly

Calls 7

l_selection_newFunction · 0.85
l_selection_checkFunction · 0.85
nhl_errorFunction · 0.85
get_location_coordFunction · 0.85
isokFunction · 0.85
selection_floodfillFunction · 0.85

Tested by

no test coverage detected