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

Function lspo_exclusion

src/sp_lev.c:5497–5532  ·  view source on GitHub ↗

exclusion({ type = "teleport", region = { x1,y1, x2,y2 } }); */

Source from the content-addressed store, hash-verified

5495
5496/* exclusion({ type = "teleport", region = { x1,y1, x2,y2 } }); */
5497int
5498lspo_exclusion(lua_State *L)
5499{
5500 static const char *const ez_types[] = {
5501 "teleport", "teleport-up", "teleport-down", "monster-generation", NULL
5502 };
5503 static const int ez_types2i[] = {
5504 LR_TELE, LR_UPTELE, LR_DOWNTELE, LR_MONGEN, 0
5505 };
5506 struct exclusion_zone *ez = (struct exclusion_zone *) alloc(sizeof *ez);
5507 lua_Integer x1,y1,x2,y2;
5508 coordxy a1,b1,a2,b2;
5509
5510 create_des_coder();
5511 lcheck_param_table(L);
5512 ez->zonetype = ez_types2i[get_table_option(L, "type", "teleport",
5513 ez_types)];
5514 get_table_region(L, "region", &x1, &y1, &x2, &y2, FALSE);
5515
5516 a1 = x1, b1 = y1;
5517 a2 = x2, b2 = y2;
5518
5519 get_location_coord(&a1, &b1, ANY_LOC|NO_LOC_WARN, gc.coder->croom,
5520 SP_COORD_PACK(a1, b1));
5521 get_location_coord(&a2, &b2, ANY_LOC|NO_LOC_WARN, gc.coder->croom,
5522 SP_COORD_PACK(a2, b2));
5523
5524 ez->lx = a1;
5525 ez->ly = b1;
5526 ez->hx = a2;
5527 ez->hy = b2;
5528
5529 ez->next = sve.exclusion_zones;
5530 sve.exclusion_zones = ez;
5531 return 0;
5532}
5533
5534staticfn void
5535sel_set_lit(coordxy x, coordxy y, genericptr_t arg)

Callers

nothing calls this directly

Calls 6

create_des_coderFunction · 0.85
lcheck_param_tableFunction · 0.85
get_table_optionFunction · 0.85
get_table_regionFunction · 0.85
get_location_coordFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected