putmsghistory() (trunk only)
[Third of three message history patches.]
Add another argument to putmsghistory() so that it can tell whether
it's processing multiple messages for restore (which should be treated as
being older than any current messages) or a single message to stuff into
history (which should be treated as the most recent message even though
it hasn't been displayed in the message window).
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user