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

Function lspo_wall_property

src/sp_lev.c:5871–5908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5869}
5870
5871RESTORE_WARNING_UNREACHABLE_CODE
5872
5873/* wall_property({ x1=0, y1=0, x2=78, y2=20, property="nondiggable" }); */
5874/* wall_property({ region = {1,0, 78,20}, property="nonpasswall" }); */
5875int
5876lspo_wall_property(lua_State *L)
5877{
5878 static const char *const wprops[] = {
5879 "nondiggable", "nonpasswall", NULL
5880 };
5881 static const int wprop2i[] = { W_NONDIGGABLE, W_NONPASSWALL, -1 };
5882 coordxy dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1;
5883 int wprop;
5884
5885 create_des_coder();
5886
5887 lcheck_param_table(L);
5888
5889 get_table_coords_or_region(L, &dx1, &dy1, &dx2, &dy2);
5890
5891 wprop = wprop2i[get_table_option(L, "property", "nondiggable", wprops)];
5892
5893 if (dx1 == -1)
5894 dx1 = gx.xstart - 1;
5895 if (dy1 == -1)
5896 dy1 = gy.ystart - 1;
5897 if (dx2 == -1)
5898 dx2 = gx.xstart + gx.xsize + 1;
5899 if (dy2 == -1)
5900 dy2 = gy.ystart + gy.ysize + 1;
5901
5902 get_location(&dx1, &dy1, ANY_LOC, (struct mkroom *) 0);
5903 get_location(&dx2, &dy2, ANY_LOC, (struct mkroom *) 0);
5904
5905 set_wall_property(dx1, dy1, dx2, dy2, wprop);
5906
5907 return 0;
5908}
5909
5910staticfn void
5911set_wallprop_in_selection(lua_State *L, int prop)

Callers

nothing calls this directly

Calls 6

create_des_coderFunction · 0.85
lcheck_param_tableFunction · 0.85
get_table_optionFunction · 0.85
get_locationFunction · 0.85
set_wall_propertyFunction · 0.85

Tested by

no test coverage detected