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

Function get_table_coords_or_region

src/sp_lev.c:5560–5577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5558
5559/* inside a lua table, get fields x1,y1,x2,y2 or region table */
5560staticfn void
5561get_table_coords_or_region(lua_State *L,
5562 coordxy *dx1, coordxy *dy1,
5563 coordxy *dx2, coordxy *dy2)
5564{
5565 *dx1 = get_table_int_opt(L, "x1", -1);
5566 *dy1 = get_table_int_opt(L, "y1", -1);
5567 *dx2 = get_table_int_opt(L, "x2", -1);
5568 *dy2 = get_table_int_opt(L, "y2", -1);
5569
5570 if (*dx1 == -1 && *dy1 == -1 && *dx2 == -1 && *dy2 == -1) {
5571 lua_Integer rx1, ry1, rx2, ry2;
5572
5573 get_table_region(L, "region", &rx1, &ry1, &rx2, &ry2, FALSE);
5574 *dx1 = rx1; *dy1 = ry1;
5575 *dx2 = rx2; *dy2 = ry2;
5576 }
5577}
5578
5579/* region(selection, lit); */
5580/* region({ x1=NN, y1=NN, x2=NN, y2=NN, lit=BOOL, type=ROOMTYPE, joined=BOOL,

Callers 2

lspo_regionFunction · 0.85
lspo_wall_propertyFunction · 0.85

Calls 2

get_table_int_optFunction · 0.85
get_table_regionFunction · 0.85

Tested by

no test coverage detected