move lua context out of dungeons[]

and out of save files so restore doesn't need to clear stale data.
Behavior should be the same as before, except that when entering
the endgame branch and discarding the main dungeon and its other
branches, lua theme context is now discarded for those too.
This commit is contained in:
PatR
2020-05-05 18:06:00 -07:00
parent 19529ffb2f
commit a51e44e532
9 changed files with 57 additions and 44 deletions

View File

@@ -949,6 +949,7 @@ struct instance_globals {
int mhitu_dieroll;
/* mklev.c */
genericptr_t luathemes[MAXDUNGEON];
xchar vault_x;
xchar vault_y;
boolean made_branch; /* used only during level creation */

View File

@@ -67,7 +67,6 @@ typedef struct dungeon { /* basic dungeon identifier */
xchar dunlev_ureached; /* how deep you have been in this dungeon */
int ledger_start, /* the starting depth in "real" terms */
depth_start; /* the starting depth in "logical" terms */
lua_State *themelua; /* themerms compiled lua */
} dungeon;
/*

View File

@@ -1325,6 +1325,7 @@ E void NDECL(sort_rooms);
E void FDECL(add_room, (int, int, int, int, BOOLEAN_P, SCHAR_P, BOOLEAN_P));
E void FDECL(add_subroom, (struct mkroom *, int, int, int, int, BOOLEAN_P,
SCHAR_P, BOOLEAN_P));
E void FDECL(free_luathemes, (BOOLEAN_P));
E void NDECL(makecorridors);
E void FDECL(add_door, (int, int, struct mkroom *));
E void NDECL(clear_level_structures);

View File

@@ -14,7 +14,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 19
#define EDITLEVEL 20
#define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2020"
#define COPYRIGHT_BANNER_B \