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

Function lspo_wallify

src/sp_lev.c:5964–5989  ·  view source on GitHub ↗

TODO: wallify(selection) */ wallify({ x1=NN,y1=NN, x2=NN,y2=NN }); */ wallify(); */

Source from the content-addressed store, hash-verified

5962/* wallify({ x1=NN,y1=NN, x2=NN,y2=NN }); */
5963/* wallify(); */
5964int
5965lspo_wallify(lua_State *L)
5966{
5967 int dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1;
5968
5969 /* TODO: clamp coord values */
5970 /* TODO: maybe allow wallify({x1,y1}, {x2,y2}) */
5971 /* TODO: is_table_coord(), is_table_area(),
5972 get_table_coord(), get_table_area() */
5973
5974 create_des_coder();
5975
5976 if (lua_gettop(L) == 1) {
5977 dx1 = get_table_int(L, "x1");
5978 dy1 = get_table_int(L, "y1");
5979 dx2 = get_table_int(L, "x2");
5980 dy2 = get_table_int(L, "y2");
5981 }
5982
5983 wallify_map(dx1 < 0 ? (gx.xstart - 1) : dx1,
5984 dy1 < 0 ? (gy.ystart - 1) : dy1,
5985 dx2 < 0 ? (gx.xstart + gx.xsize + 1) : dx2,
5986 dy2 < 0 ? (gy.ystart + gy.ysize + 1) : dy2);
5987
5988 return 0;
5989}
5990
5991/* reset_level is only needed for testing purposes */
5992int

Callers

nothing calls this directly

Calls 3

create_des_coderFunction · 0.85
get_table_intFunction · 0.85
wallify_mapFunction · 0.85

Tested by

no test coverage detected