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

Function l_selection_rect

src/nhlsel.c:530–552  ·  view source on GitHub ↗

local s = selection.rect(sel, x1,y1, x2,y2); */

Source from the content-addressed store, hash-verified

528
529/* local s = selection.rect(sel, x1,y1, x2,y2); */
530staticfn int
531l_selection_rect(lua_State *L)
532{
533 struct selectionvar *sel = NULL;
534 coordxy x1, y1, x2, y2;
535
536 if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) {
537 nhl_error(L, "selection.rect: illegal arguments");
538 }
539
540 get_location_coord(&x1, &y1, ANY_LOC, gc.coder ? gc.coder->croom : NULL,
541 SP_COORD_PACK(x1, y1));
542 get_location_coord(&x2, &y2, ANY_LOC, gc.coder ? gc.coder->croom : NULL,
543 SP_COORD_PACK(x2, y2));
544
545 (void) l_selection_clone(L);
546 sel = l_selection_check(L, 2);
547 selection_do_line(x1, y1, x2, y1, sel);
548 selection_do_line(x1, y1, x1, y2, sel);
549 selection_do_line(x2, y1, x2, y2, sel);
550 selection_do_line(x1, y2, x2, y2, sel);
551 return 1;
552}
553
554/* local s = selection.fillrect(sel, x1,y1, x2,y2); */
555/* local s = selection.fillrect(x1,y1, x2,y2); */

Callers

nothing calls this directly

Calls 6

params_sel_2coordsFunction · 0.85
nhl_errorFunction · 0.85
get_location_coordFunction · 0.85
l_selection_cloneFunction · 0.85
l_selection_checkFunction · 0.85
selection_do_lineFunction · 0.85

Tested by

no test coverage detected