From ddf5aced482b2a5520836fec751d2004db828c32 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Mon, 19 Sep 2011 03:10:01 +0000 Subject: [PATCH] fix W343-7 - strange topten output on Windows Move the toptenwin option from flags to iflags to keep it out of save files, thus preventing odd behavior from win32 (nethackW.exe) when restoring and finishing games started and saved with tty (nethack.exe). [See cvs log entry for flag.h for more complete explanation.] --- src/end.c | 2 +- src/options.c | 2 +- src/topten.c | 8 ++++---- sys/wince/mswproc.c | 2 +- win/gem/wingem.c | 3 +-- win/win32/mswproc.c | 3 +-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/end.c b/src/end.c index 856af8afd..080353ab4 100644 --- a/src/end.c +++ b/src/end.c @@ -1220,7 +1220,7 @@ die: /* "So when I die, the first thing I will see in Heaven is a * score list?" */ - if (flags.toptenwin) { + if (iflags.toptenwin) { topten(how); if (have_windows) exit_nhwindows((char *)0); diff --git a/src/options.c b/src/options.c index 49911f0f4..ba3f67113 100644 --- a/src/options.c +++ b/src/options.c @@ -207,7 +207,7 @@ static struct Bool_Opt {"timed_delay", (boolean *)0, FALSE, SET_IN_GAME}, #endif {"tombstone",&flags.tombstone, TRUE, SET_IN_GAME}, - {"toptenwin",&flags.toptenwin, FALSE, SET_IN_GAME}, + {"toptenwin",&iflags.toptenwin, FALSE, SET_IN_GAME}, {"travel", &flags.travelcmd, TRUE, SET_IN_GAME}, #ifdef UNICODE_SUPPORT {"unicode", &iflags.unicodedisp, FALSE, SET_IN_GAME}, diff --git a/src/topten.c b/src/topten.c index f78d341c1..8acb06404 100644 --- a/src/topten.c +++ b/src/topten.c @@ -1,5 +1,4 @@ /* NetHack 3.5 topten.c $Date$ $Revision$ */ -/* SCCS Id: @(#)topten.c 3.5 2007/03/05 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -302,7 +301,7 @@ int how; if (program_state.panicking) return; - if (flags.toptenwin) { + if (iflags.toptenwin) { toptenwin = create_nhwindow(NHW_TEXT); } @@ -551,10 +550,11 @@ int how; free_ttlist(tt_head); showwin: - if (flags.toptenwin && !done_stopprint) display_nhwindow(toptenwin, 1); + if (iflags.toptenwin && !done_stopprint) + display_nhwindow(toptenwin, 1); destroywin: if (!t0_used) dealloc_ttentry(t0); - if (flags.toptenwin) { + if (iflags.toptenwin) { destroy_nhwindow(toptenwin); toptenwin=WIN_ERR; } diff --git a/sys/wince/mswproc.c b/sys/wince/mswproc.c index 64ebb0c4b..eb9256183 100644 --- a/sys/wince/mswproc.c +++ b/sys/wince/mswproc.c @@ -180,7 +180,7 @@ void mswin_init_nhwindows(int* argc, char** argv) * write output to a window or stdout. stdout doesn't make sense on Windows * non-console applications */ - flags.toptenwin = 1; + iflags.toptenwin = 1; set_option_mod_status("toptenwin", SET_IN_FILE); /* initialize map tiles bitmap */ diff --git a/win/gem/wingem.c b/win/gem/wingem.c index 69b079030..a1635b5f0 100644 --- a/win/gem/wingem.c +++ b/win/gem/wingem.c @@ -1,5 +1,4 @@ /* NetHack 3.5 wingem.c $Date$ $Revision$ */ -/* SCCS Id: @(#)wingem.c 3.5 1999/12/10 */ /* Copyright (c) Christian Bressler, 1999 */ /* NetHack may be freely redistributed. See license for details. */ @@ -573,7 +572,7 @@ Gem_exit_nhwindows(str) { if(str) Gem_raw_print(str); mar_exit_nhwindows(); - if(flags.toptenwin) + if(iflags.toptenwin) run_from_desktop=FALSE; iflags.window_inited = 0; } diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index de2d6df5c..d88d34015 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1,5 +1,4 @@ /* NetHack 3.5 mswproc.c $Date$ $Revision$ */ -/* SCCS Id: @(#)mswproc.c 3.5 2005/01/23 */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -218,7 +217,7 @@ void mswin_init_nhwindows(int* argc, char** argv) * write output to a window or stdout. stdout doesn't make sense on Windows * non-console applications */ - flags.toptenwin = 1; + iflags.toptenwin = 1; set_option_mod_status("toptenwin", SET_IN_FILE); set_option_mod_status("perm_invent", SET_IN_FILE); -- 2.40.0