Use single define for max message history

... instead of having every windowport define their own variant.
Affects tty, curses, X11, and Windows GUI.
This commit is contained in:
Pasi Kallinen
2024-03-03 11:31:33 +02:00
parent 9a866688c5
commit 53778ee507
7 changed files with 12 additions and 11 deletions

View File

@@ -92,8 +92,8 @@ create_message_window(struct xwindow *wp, /* window pointer */
if (iflags.msg_history < (unsigned) appResources.message_lines)
iflags.msg_history = (unsigned) appResources.message_lines;
if (iflags.msg_history > MAX_HISTORY) /* a sanity check */
iflags.msg_history = MAX_HISTORY;
if (iflags.msg_history > MAX_MSG_HISTORY) /* a sanity check */
iflags.msg_history = MAX_MSG_HISTORY;
set_circle_buf(mesg_info, (int) iflags.msg_history);

View File

@@ -453,8 +453,8 @@ curses_init_mesg_history(void)
max_messages = 1;
}
if (max_messages > MESG_HISTORY_MAX) {
max_messages = MESG_HISTORY_MAX;
if (max_messages > MAX_MSG_HISTORY) {
max_messages = MAX_MSG_HISTORY;
}
}

View File

@@ -886,8 +886,8 @@ tty_create_nhwindow(int type)
/* sanity check */
if (iflags.msg_history < 20)
iflags.msg_history = 20;
else if (iflags.msg_history > 60)
iflags.msg_history = 60;
else if (iflags.msg_history > MAX_MSG_HISTORY)
iflags.msg_history = MAX_MSG_HISTORY;
newwin->maxrow = newwin->rows = iflags.msg_history;
newwin->maxcol = newwin->cols = 0;
break;

View File

@@ -10,8 +10,7 @@
#define MSG_WRAP_TEXT
#define MSG_VISIBLE_LINES max(iflags.wc_vary_msgcount, 1)
#define MAX_MSG_LINES 128
#define MSG_LINES (int) min(iflags.msg_history, MAX_MSG_LINES)
#define MSG_LINES (int) min(iflags.msg_history, MAX_MSG_HISTORY)
#define MAXWINDOWTEXT TBUFSZ
#define DEFAULT_COLOR_BG_MSG COLOR_WINDOW
@@ -26,7 +25,7 @@ struct window_line {
typedef struct mswin_nethack_message_window {
size_t max_text;
struct window_line window_text[MAX_MSG_LINES];
struct window_line window_text[MAX_MSG_HISTORY];
int lines_last_turn; /* lines added during the last turn */
int lines_not_seen; /* lines not yet seen by user after last turn or
--More-- */