diff --git a/include/extern.h b/include/extern.h index ce93bc144..089d1efae 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2572,7 +2572,7 @@ E void FDECL(choose_windows, (const char *)); E char FDECL(genl_message_menu, (CHAR_P,int,const char *)); E void FDECL(genl_preference_update, (const char *)); E char *FDECL(genl_getmsghistory, (BOOLEAN_P)); -E void FDECL(genl_putmsghistory, (const char *)); +E void FDECL(genl_putmsghistory, (const char *,BOOLEAN_P)); #ifdef HANGUPHANDLING E void NDECL(nhwindows_hangup); #endif diff --git a/include/winprocs.h b/include/winprocs.h index 2623abaa7..612daa588 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -69,7 +69,7 @@ struct window_procs { void FDECL((*win_outrip), (winid,int)); void FDECL((*win_preference_update), (const char *)); char * FDECL((*win_getmsghistory), (BOOLEAN_P)); - void FDECL((*win_putmsghistory), (const char *)); + void FDECL((*win_putmsghistory), (const char *,BOOLEAN_P)); #ifdef STATUS_VIA_WINDOWPORT void NDECL((*win_status_init)); void NDECL((*win_status_finish)); diff --git a/include/wintty.h b/include/wintty.h index 34cd1050c..cd83e3aa7 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -229,7 +229,7 @@ E void NDECL(tty_end_screen); E void FDECL(genl_outrip, (winid,int)); E char *FDECL(tty_getmsghistory, (BOOLEAN_P)); -E void FDECL(tty_putmsghistory, (const char *)); +E void FDECL(tty_putmsghistory, (const char *,BOOLEAN_P)); #ifdef NO_TERMS diff --git a/src/restore.c b/src/restore.c index b4153924e..8b823ccbc 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1152,10 +1152,10 @@ register int fd; panic("restore_msghistory: msg too big (%d)", msgsize); mread(fd, (genericptr_t)msg, msgsize); msg[msgsize] = '\0'; - putmsghistory(msg); + putmsghistory(msg, TRUE); ++msgcount; } - if (msgcount) putmsghistory((char *)0); + if (msgcount) putmsghistory((char *)0, TRUE); #ifdef DEBUG_MSGCOUNT pline("Read %d messages from savefile.", msgcount); #endif diff --git a/src/windows.c b/src/windows.c index 4b490d22d..1bc872fe9 100644 --- a/src/windows.c +++ b/src/windows.c @@ -177,8 +177,9 @@ boolean init; /*ARGSUSED*/ void -genl_putmsghistory(msg) +genl_putmsghistory(msg, restoring) const char *msg; +boolean restoring; { /* window ports can provide their own putmsghistory() routine to @@ -197,6 +198,9 @@ const char *msg; so it should keep all pointers/indexes intact at the end of each call. */ +#if 0 /* maybe... */ + if (!restoring) pline("%s", msg); +#endif return; } @@ -387,7 +391,7 @@ char *outbuf; Strcpy(outbuf, "\033"); } -/*ARGUSED*/ +/*ARGSUSED*/ static void hup_init_nhwindows(argc_p, argv) int *argc_p; @@ -396,7 +400,7 @@ char **argv; iflags.window_inited = 1; } -/*ARGSUSED*/ +/*ARGUSED*/ static winid hup_create_nhwindow(type) int type; diff --git a/win/tty/topl.c b/win/tty/topl.c index 35d9f79ba..ff53200df 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -704,13 +704,14 @@ boolean init; * Called with a null pointer to finish up. */ void -tty_putmsghistory(msg) +tty_putmsghistory(msg, restoring) const char *msg; +boolean restoring; { static boolean initd = FALSE; int idx; - if (!initd) { + if (restoring && !initd) { /* we're restoring history from the previous session, but new messages have already been issued this session ("Restoring...", for instance); collect current history (ie, those new messages), diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index dc2c5c35b..328dc0be6 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1980,9 +1980,12 @@ char *mswin_getmsghistory(BOOLEAN_P init) } } -void mswin_putmsghistory(const char * msg) +void mswin_putmsghistory(const char * msg, BOOLEAN_P restoring) { - BOOL save_sound_opt = GetNHApp()->bNoSounds; + BOOL save_sound_opt; + + if (!msg) return; /* end of message history restore */ + save_sound_opt = GetNHApp()->bNoSounds; GetNHApp()->bNoSounds = TRUE; /* disable sounds while restoring message history */ mswin_putstr_ex(WIN_MESSAGE, ATR_NONE, msg, 0); clear_nhwindow(WIN_MESSAGE); /* it is in fact end-of-turn indication so each message will print on the new line */ diff --git a/win/win32/winMS.h b/win/win32/winMS.h index 04b42beb5..6fa9af430 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -160,7 +160,7 @@ void mswin_end_screen(void); void mswin_outrip(winid wid, int how); void mswin_preference_update(const char *pref); char *mswin_getmsghistory(BOOLEAN_P init); -void mswin_putmsghistory(const char * msg); +void mswin_putmsghistory(const char * msg,BOOLEAN_P); /* helper function */ HWND mswin_hwnd_from_winid(winid wid);