follow-up, program_state

This commit is contained in:
nhmall
2024-07-13 16:31:35 -04:00
parent 72d2b0414c
commit 0eb7f109e0
67 changed files with 255 additions and 252 deletions

View File

@@ -39,7 +39,7 @@ mswin_have_input(void)
return
#ifdef SAFERHANGUP
/* we always have input (ESC) if hangup was requested */
svp.program_state.done_hup ||
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 (svp.program_state.done_hup) {
if (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 (svp.program_state.done_hup) {
if (program_state.done_hup) {
static MSNHEvent hangup_event;
hangup_event.type = NHEVENT_CHAR;
hangup_event.ei.kbd.ch = '\033';

View File

@@ -457,16 +457,16 @@ MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_CLOSE: {
/* exit gracefully */
if (svp.program_state.gameover) {
if (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
*/
svp.program_state.stopprint++;
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 (!svp.program_state.something_worth_saving) {
} else if (!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 (!svp.program_state.gameover && !svp.program_state.done_hup)
if (!program_state.gameover && !program_state.done_hup)
dosave();
else
MessageBeep(0);

View File

@@ -351,10 +351,10 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return FALSE;
case WM_CLOSE:
if (svp.program_state.gameover) {
if (program_state.gameover) {
data->result = -1;
data->done = 1;
svp.program_state.stopprint++;
program_state.stopprint++;
return TRUE;
} else
return FALSE;

View File

@@ -227,7 +227,7 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
GetNHApp()->hMainWnd = NULL;
DestroyWindow(hWnd);
SetFocus(GetNHApp()->hMainWnd);
svp.program_state.stopprint++;
program_state.stopprint++;
return TRUE;
case WM_DESTROY:

View File

@@ -1251,7 +1251,7 @@ void
mswin_update_inventory(int arg)
{
logDebug("mswin_update_inventory(%d)\n", arg);
if (iflags.perm_invent && svp.program_state.something_worth_saving
if (iflags.perm_invent && program_state.something_worth_saving
&& iflags.window_inited && WIN_INVEN != WIN_ERR)
display_inventory(NULL, FALSE);
}
@@ -2862,7 +2862,7 @@ int
NHMessageBox(HWND hWnd, LPCTSTR text, UINT type)
{
TCHAR title[MAX_LOADSTRING];
if (svp.program_state.exiting && !strcmp(text, "\n"))
if (program_state.exiting && !strcmp(text, "\n"))
text = "Press Enter to exit";
LoadString(GetNHApp()->hApp, IDS_APP_TITLE_SHORT, title, MAX_LOADSTRING);