Begin gathering saveable game state into a structure. Not yet complete.

No logic changes.  A bunch of globals turn into fields (with the same names
except for lowercasing) in struct game_t.

Eventually this will allow drastic simplification of the save/load logic.
This commit is contained in:
Eric S. Raymond 2017-05-23 18:47:04 -04:00
parent dc9d9e467b
commit 42189d79d7
11 changed files with 260 additions and 231 deletions

31
main.h
View file

@ -2,9 +2,38 @@
#define LINESIZE 100
extern long ABB[], ATAB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
extern long ABB[], ATAB[], ATLOC[], DLOC[], FIXED[],
KTAB[], *LINES, LINK[], LNLENG, LNPOSN,
PARMS[], PLACE[], PTEXT[], RTEXT[], TABSIZ;
extern signed char INLINE[LINESIZE+1], MAP1[], MAP2[];
extern FILE *logfp;
extern bool oldstyle;
struct game_t {
/* These members are in the save order of the individual variables
* in the 2.5 code. */
long abbnum;
long blklin;
long bonus;
long clock1;
long clock2;
long closed;
long closng;
long detail;
long dflag;
long dkill;
long dtotal;
long foobar;
long holdng;
long iwest;
long knfloc;
long limit;
/* LL may go here */
long lmwarn;
/* LOC will go here */
long newloc;
long numdie;
/* more state will go here */
long wzdark;
};
extern struct game_t game;