Lua: improve level testing

Add des.finalize_level() used for testing in conjunction with
des.reset_level().
Add nhc.DLB to return 0 or 1 if DLB was defined at compile-time.
Change the test_lev.lua to give more informative messages instead of
just lua error when required file doesn't exist.
Add bigrm-11 to the level tests.
This commit is contained in:
Pasi Kallinen
2021-07-24 10:28:35 +03:00
parent 93b66ff8da
commit 7f39d53ad3
9 changed files with 120 additions and 66 deletions

View File

@@ -505,27 +505,6 @@ savelev(NHFILE* nhfp, xchar lev)
saveobjchn(nhfp, &fobj);
saveobjchn(nhfp, &g.level.buriedobjlist);
saveobjchn(nhfp, &g.billobjs);
if (release_data(nhfp)) {
int x,y;
/* TODO: maybe use clear_level_structures() */
for (y = 0; y < ROWNO; y++)
for (x = 0; x < COLNO; x++) {
g.level.monsters[x][y] = 0;
g.level.objects[x][y] = 0;
levl[x][y].seenv = 0;
levl[x][y].glyph = GLYPH_UNEXPLORED;
}
fmon = 0;
g.ftrap = 0;
fobj = 0;
g.level.buriedobjlist = 0;
g.billobjs = 0;
stairway_free_all();
(void) memset(g.rooms, 0, sizeof(g.rooms));
g.nroom = g.nsubroom = 0;
g.rooms[0].hx = g.subrooms[0].hx = -1;
/* level.bonesinfo = 0; -- handled by savecemetery() */
}
save_engravings(nhfp);
savedamage(nhfp); /* pending shop wall and/or floor repair */
save_regions(nhfp);
@@ -534,6 +513,12 @@ savelev(NHFILE* nhfp, xchar lev)
bflush(nhfp->fd);
}
g.program_state.saving--;
if (release_data(nhfp)) {
clear_level_structures();
g.ftrap = 0;
g.billobjs = 0;
(void) memset(g.rooms, 0, sizeof(g.rooms));
}
return;
}