distinguish global variables that get written to savefile
The g? structs had a mix of variables that were written to
the savefile, and those that were not.
For better clarity and to distinguish those that end up in
the savefile, relocate some g? variables that get written
directly to the savefile into different structs.
This updates EDITLEVEL, although technically it probably
didn't need to, since savefile contents are not changing.
Details:
gb.bases -> svb.bases
gb.bbubbles -> svb.bbubbles
gb.branches -> svb.branches
gc.context -> svc.context
gd.disco -> svd.disco
gd.dndest -> svd.dndest
gd.doors -> svd.doors
gd.doors_alloc -> svd.doors_alloc
gd.dungeon_topology -> svd.dungeon_topology
gd.dungeons -> svd.dungeons
ge.exclusion_zones -> sve.exclusion_zones
gh.hackpid -> svh.hackpid
gi.inv_pos -> svi.inv_pos
gk.killer -> svk.killer
gl.lastseentyp -> svl.lastseentyp
gl.level -> svl.level
gl.level_info -> svl.level_info
gm.mapseenchn -> svm.mapseenchn
gm.moves -> svm.moves
gm.mvitals -> svm.mvitals
gn.n_dgns -> svn.n_dgns
gn.n_regions -> svn.n_regions
gn.nroom -> svn.nroom
go.oracle_cnt -> svo.oracle_cnt
gp.pl_character -> svp.pl_character
gp.pl_fruit -> svp.pl_fruit
gp.plname -> svp.plname
gp.program_state -> svp.program_state
gq.quest_status -> svq.quest_status
gr.rooms -> svr.rooms
gs.sp_levchn -> svs.sp_levchn
gs.spl_book -> svs.spl_book
gt.timer_id -> svt.timer_id
gt.tune -> svt.tune
gu.updest -> svu.updest
gx.xmax -> svx.xmax
gx.xmin -> svx.xmin
gy.ymax -> svy.ymax
gy.ymin -> svy.ymin
Related note:
There are some pointer variables that are heads of chains that were not
moved from 'g?' to 'sv?', because they are not actually written to the
savefile directly, but the objects/monst/trap/lightsource/timer in the
chains they point to are. That can be changed, if desired.
Examples: gi.invent, gm.migrating_objs, gb.billobjs, gm.migrating_mons,
gf.ftrap, gl.light_base, gt.timer_base
This commit is contained in:
@@ -648,7 +648,7 @@ plselInitDialog(struct plsel_data * data)
|
||||
|
||||
/* set player name */
|
||||
control_t * name_box = &data->controls[psc_name_box];
|
||||
SetDlgItemText(data->dialog, name_box->id, NH_A2W(gp.plname, wbuf, sizeof(wbuf)));
|
||||
SetDlgItemText(data->dialog, name_box->id, NH_A2W(svp.plname, wbuf, sizeof(wbuf)));
|
||||
|
||||
plselRandomize(data);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ mswin_have_input(void)
|
||||
return
|
||||
#ifdef SAFERHANGUP
|
||||
/* we always have input (ESC) if hangup was requested */
|
||||
gp.program_state.done_hup ||
|
||||
svp.program_state.done_hup ||
|
||||
#endif
|
||||
(nhi_read_pos != nhi_write_pos);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ mswin_input_pop(void)
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
/* always return ESC when hangup was requested */
|
||||
if (gp.program_state.done_hup) {
|
||||
if (svp.program_state.done_hup) {
|
||||
static MSNHEvent hangup_event;
|
||||
hangup_event.type = NHEVENT_CHAR;
|
||||
hangup_event.ei.kbd.ch = '\033';
|
||||
@@ -98,7 +98,7 @@ mswin_input_peek(void)
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
/* always return ESC when hangup was requested */
|
||||
if (gp.program_state.done_hup) {
|
||||
if (svp.program_state.done_hup) {
|
||||
static MSNHEvent hangup_event;
|
||||
hangup_event.type = NHEVENT_CHAR;
|
||||
hangup_event.ei.kbd.ch = '\033';
|
||||
|
||||
@@ -457,16 +457,16 @@ MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_CLOSE: {
|
||||
/* exit gracefully */
|
||||
if (gp.program_state.gameover) {
|
||||
if (svp.program_state.gameover) {
|
||||
/* assume the user really meant this, as the game is already
|
||||
* over... */
|
||||
/* to make sure we still save bones, just set stop printing flag
|
||||
*/
|
||||
gp.program_state.stopprint++;
|
||||
svp.program_state.stopprint++;
|
||||
NHEVENT_KBD(
|
||||
'\033'); /* and send keyboard input as if user pressed ESC */
|
||||
/* additional code for this is done in menu and rip windows */
|
||||
} else if (!gp.program_state.something_worth_saving) {
|
||||
} else if (!svp.program_state.something_worth_saving) {
|
||||
/* User exited before the game started, e.g. during splash display
|
||||
*/
|
||||
/* Just get out. */
|
||||
@@ -842,7 +842,7 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_SAVE:
|
||||
if (iflags.debug_fuzzer)
|
||||
break;
|
||||
if (!gp.program_state.gameover && !gp.program_state.done_hup)
|
||||
if (!svp.program_state.gameover && !svp.program_state.done_hup)
|
||||
dosave();
|
||||
else
|
||||
MessageBeep(0);
|
||||
|
||||
@@ -351,10 +351,10 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
|
||||
case WM_CLOSE:
|
||||
if (gp.program_state.gameover) {
|
||||
if (svp.program_state.gameover) {
|
||||
data->result = -1;
|
||||
data->done = 1;
|
||||
gp.program_state.stopprint++;
|
||||
svp.program_state.stopprint++;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
|
||||
@@ -227,7 +227,7 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
GetNHApp()->hMainWnd = NULL;
|
||||
DestroyWindow(hWnd);
|
||||
SetFocus(GetNHApp()->hMainWnd);
|
||||
gp.program_state.stopprint++;
|
||||
svp.program_state.stopprint++;
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
||||
@@ -696,7 +696,7 @@ mswin_askname(void)
|
||||
{
|
||||
logDebug("mswin_askname()\n");
|
||||
|
||||
if (mswin_getlin_window("Who are you?", gp.plname, PL_NSIZ) == IDCANCEL) {
|
||||
if (mswin_getlin_window("Who are you?", svp.plname, PL_NSIZ) == IDCANCEL) {
|
||||
bail("bye-bye");
|
||||
/* not reached */
|
||||
}
|
||||
@@ -1251,7 +1251,7 @@ void
|
||||
mswin_update_inventory(int arg)
|
||||
{
|
||||
logDebug("mswin_update_inventory(%d)\n", arg);
|
||||
if (iflags.perm_invent && gp.program_state.something_worth_saving
|
||||
if (iflags.perm_invent && svp.program_state.something_worth_saving
|
||||
&& iflags.window_inited && WIN_INVEN != WIN_ERR)
|
||||
display_inventory(NULL, FALSE);
|
||||
}
|
||||
@@ -1963,7 +1963,7 @@ mswin_outrip(winid wid, int how, time_t when)
|
||||
}
|
||||
|
||||
/* Put name on stone */
|
||||
Sprintf(buf, "%s", gp.plname);
|
||||
Sprintf(buf, "%s", svp.plname);
|
||||
buf[STONE_LINE_LEN] = 0;
|
||||
putstr(wid, 0, buf);
|
||||
|
||||
@@ -2862,7 +2862,7 @@ int
|
||||
NHMessageBox(HWND hWnd, LPCTSTR text, UINT type)
|
||||
{
|
||||
TCHAR title[MAX_LOADSTRING];
|
||||
if (gp.program_state.exiting && !strcmp(text, "\n"))
|
||||
if (svp.program_state.exiting && !strcmp(text, "\n"))
|
||||
text = "Press Enter to exit";
|
||||
|
||||
LoadString(GetNHApp()->hApp, IDS_APP_TITLE_SHORT, title, MAX_LOADSTRING);
|
||||
|
||||
Reference in New Issue
Block a user