MCPcopy Index your code
hub / github.com/NetHack/NetHack / lspo_level_init

Function lspo_level_init

src/sp_lev.c:3836–3875  ·  view source on GitHub ↗

level_init({ style = "solidfill", fg = " " }); */ level_init({ style = "mines", fg = ".", bg = "}", smoothed=true, joined=true, lit=0 }) */

Source from the content-addressed store, hash-verified

3834/* level_init({ style = "mines", fg = ".", bg = "}",
3835 smoothed=true, joined=true, lit=0 }) */
3836int
3837lspo_level_init(lua_State *L)
3838{
3839 static const char *const initstyles[] = {
3840 "solidfill", "mazegrid", "maze", "rogue", "mines", "swamp", NULL
3841 };
3842 static const int initstyles2i[] = {
3843 LVLINIT_SOLIDFILL, LVLINIT_MAZEGRID, LVLINIT_MAZE, LVLINIT_ROGUE,
3844 LVLINIT_MINES, LVLINIT_SWAMP, 0
3845 };
3846 lev_init init_lev;
3847
3848 create_des_coder();
3849
3850 lcheck_param_table(L);
3851
3852 splev_init_present = TRUE;
3853
3854 init_lev.init_style
3855 = initstyles2i[get_table_option(L, "style", "solidfill", initstyles)];
3856 init_lev.fg = get_table_mapchr_opt(L, "fg", ROOM);
3857 init_lev.bg = get_table_mapchr_opt(L, "bg", INVALID_TYPE);
3858 init_lev.smoothed = get_table_boolean_opt(L, "smoothed", FALSE);
3859 init_lev.joined = get_table_boolean_opt(L, "joined", FALSE);
3860 init_lev.lit = get_table_boolean_opt(L, "lit", BOOL_RANDOM);
3861 init_lev.walled = get_table_boolean_opt(L, "walled", FALSE);
3862 init_lev.filling = get_table_mapchr_opt(L, "filling", init_lev.fg);
3863 init_lev.corrwid = get_table_int_opt(L, "corrwid", -1);
3864 init_lev.wallthick = get_table_int_opt(L, "wallthick", -1);
3865 init_lev.rm_deadends = !get_table_boolean_opt(L, "deadends", TRUE);
3866
3867 gc.coder->lvl_is_joined = init_lev.joined;
3868
3869 if (init_lev.bg == INVALID_TYPE)
3870 init_lev.bg = (init_lev.init_style == LVLINIT_SWAMP) ? MOAT : STONE;
3871
3872 splev_initlev(&init_lev);
3873
3874 return 0;
3875}
3876
3877/* engraving({ x = 1, y = 1, type="burn", text="Foo" }); */
3878/* engraving({ coord={1, 1}, type="burn", text="Foo" }); */

Callers

nothing calls this directly

Calls 7

create_des_coderFunction · 0.85
lcheck_param_tableFunction · 0.85
get_table_optionFunction · 0.85
get_table_mapchr_optFunction · 0.85
get_table_boolean_optFunction · 0.85
get_table_int_optFunction · 0.85
splev_initlevFunction · 0.85

Tested by

no test coverage detected