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:
@@ -441,6 +441,10 @@ extern struct nomakedefs_s nomakedefs;
|
|||||||
#define MAXMONNO 120 /* extinct monst after this number created */
|
#define MAXMONNO 120 /* extinct monst after this number created */
|
||||||
#define MHPMAX 500 /* maximum monster hp */
|
#define MHPMAX 500 /* maximum monster hp */
|
||||||
|
|
||||||
|
#ifndef MAX_MSG_HISTORY
|
||||||
|
#define MAX_MSG_HISTORY 128 /* max # of lines in msg_history */
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct color_and_attr {
|
typedef struct color_and_attr {
|
||||||
int color, attr;
|
int color, attr;
|
||||||
} color_attr;
|
} color_attr;
|
||||||
|
|||||||
@@ -267,7 +267,6 @@ struct xwindow {
|
|||||||
/* event into a character(s) */
|
/* event into a character(s) */
|
||||||
|
|
||||||
#define DEFAULT_LINES_DISPLAYED 12 /* # of lines displayed message window */
|
#define DEFAULT_LINES_DISPLAYED 12 /* # of lines displayed message window */
|
||||||
#define MAX_HISTORY 60 /* max history saved on message window */
|
|
||||||
|
|
||||||
/* flags for X11_yn_function_core() */
|
/* flags for X11_yn_function_core() */
|
||||||
#define YN_NORMAL 0U /* no flags */
|
#define YN_NORMAL 0U /* no flags */
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ extern WINDOW *activemenu; /* curses window for menu requesting a
|
|||||||
#define MAP_WIN 3
|
#define MAP_WIN 3
|
||||||
#define INV_WIN 4
|
#define INV_WIN 4
|
||||||
#define NHWIN_MAX 5
|
#define NHWIN_MAX 5
|
||||||
#define MESG_HISTORY_MAX 200
|
|
||||||
#if !defined(__APPLE__) || !defined(NCURSES_VERSION)
|
#if !defined(__APPLE__) || !defined(NCURSES_VERSION)
|
||||||
# define USE_DARKGRAY /* Allow "bright" black; delete if not visible */
|
# define USE_DARKGRAY /* Allow "bright" black; delete if not visible */
|
||||||
#endif /* !__APPLE__ && !PDCURSES */
|
#endif /* !__APPLE__ && !PDCURSES */
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ create_message_window(struct xwindow *wp, /* window pointer */
|
|||||||
|
|
||||||
if (iflags.msg_history < (unsigned) appResources.message_lines)
|
if (iflags.msg_history < (unsigned) appResources.message_lines)
|
||||||
iflags.msg_history = (unsigned) appResources.message_lines;
|
iflags.msg_history = (unsigned) appResources.message_lines;
|
||||||
if (iflags.msg_history > MAX_HISTORY) /* a sanity check */
|
if (iflags.msg_history > MAX_MSG_HISTORY) /* a sanity check */
|
||||||
iflags.msg_history = MAX_HISTORY;
|
iflags.msg_history = MAX_MSG_HISTORY;
|
||||||
|
|
||||||
set_circle_buf(mesg_info, (int) iflags.msg_history);
|
set_circle_buf(mesg_info, (int) iflags.msg_history);
|
||||||
|
|
||||||
|
|||||||
@@ -453,8 +453,8 @@ curses_init_mesg_history(void)
|
|||||||
max_messages = 1;
|
max_messages = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_messages > MESG_HISTORY_MAX) {
|
if (max_messages > MAX_MSG_HISTORY) {
|
||||||
max_messages = MESG_HISTORY_MAX;
|
max_messages = MAX_MSG_HISTORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -886,8 +886,8 @@ tty_create_nhwindow(int type)
|
|||||||
/* sanity check */
|
/* sanity check */
|
||||||
if (iflags.msg_history < 20)
|
if (iflags.msg_history < 20)
|
||||||
iflags.msg_history = 20;
|
iflags.msg_history = 20;
|
||||||
else if (iflags.msg_history > 60)
|
else if (iflags.msg_history > MAX_MSG_HISTORY)
|
||||||
iflags.msg_history = 60;
|
iflags.msg_history = MAX_MSG_HISTORY;
|
||||||
newwin->maxrow = newwin->rows = iflags.msg_history;
|
newwin->maxrow = newwin->rows = iflags.msg_history;
|
||||||
newwin->maxcol = newwin->cols = 0;
|
newwin->maxcol = newwin->cols = 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define MSG_WRAP_TEXT
|
#define MSG_WRAP_TEXT
|
||||||
|
|
||||||
#define MSG_VISIBLE_LINES max(iflags.wc_vary_msgcount, 1)
|
#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_HISTORY)
|
||||||
#define MSG_LINES (int) min(iflags.msg_history, MAX_MSG_LINES)
|
|
||||||
#define MAXWINDOWTEXT TBUFSZ
|
#define MAXWINDOWTEXT TBUFSZ
|
||||||
|
|
||||||
#define DEFAULT_COLOR_BG_MSG COLOR_WINDOW
|
#define DEFAULT_COLOR_BG_MSG COLOR_WINDOW
|
||||||
@@ -26,7 +25,7 @@ struct window_line {
|
|||||||
|
|
||||||
typedef struct mswin_nethack_message_window {
|
typedef struct mswin_nethack_message_window {
|
||||||
size_t max_text;
|
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_last_turn; /* lines added during the last turn */
|
||||||
int lines_not_seen; /* lines not yet seen by user after last turn or
|
int lines_not_seen; /* lines not yet seen by user after last turn or
|
||||||
--More-- */
|
--More-- */
|
||||||
|
|||||||
Reference in New Issue
Block a user