Merge branch 'NetHack-3.6'
This commit is contained in:
@@ -392,6 +392,7 @@ curses_ext_cmd()
|
||||
extwin = newwin(1, w - 2, y0 + 1, x0 + 1);
|
||||
if (w - 4 < maxlen)
|
||||
maxlen = w - 4;
|
||||
nhUse(h); /* needed only to give getmaxyx three arguments */
|
||||
} else {
|
||||
curses_get_window_xy(MESSAGE_WIN, &winx, &winy);
|
||||
curses_get_window_size(MESSAGE_WIN, &messageh, &messagew);
|
||||
|
||||
@@ -462,7 +462,7 @@ curses_choose_character()
|
||||
tmpchoice[count] = toupper(tmpchoice[count]);
|
||||
}
|
||||
|
||||
sprintf(choice, "%s%s", choice, tmpchoice);
|
||||
strcat(choice, tmpchoice);
|
||||
|
||||
/* prevent an unnecessary prompt */
|
||||
rigid_role_checks();
|
||||
|
||||
@@ -202,7 +202,7 @@ curses_block(boolean noscroll) /* noscroll - blocking because of msgtype
|
||||
prev_x = mx, prev_y = my;
|
||||
blink = 0;
|
||||
}
|
||||
moreattr = !iflags.wc2_guicolor ? A_REVERSE : NONE;
|
||||
moreattr = !iflags.wc2_guicolor ? (int) A_REVERSE : NONE;
|
||||
curses_toggle_color_attr(win, MORECOLOR, moreattr, ON);
|
||||
if (blink) {
|
||||
wattron(win, A_BLINK);
|
||||
|
||||
@@ -40,13 +40,18 @@ static int parse_escape_sequence(void);
|
||||
int
|
||||
curses_read_char()
|
||||
{
|
||||
int ch, tmpch;
|
||||
int ch;
|
||||
#if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z)
|
||||
int tmpch;
|
||||
#endif
|
||||
|
||||
/* cancel message suppression; all messages have had a chance to be read */
|
||||
curses_got_input();
|
||||
|
||||
ch = getch();
|
||||
#if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z)
|
||||
tmpch = ch;
|
||||
#endif
|
||||
ch = curses_convert_keys(ch);
|
||||
|
||||
if (ch == 0) {
|
||||
@@ -372,7 +377,6 @@ curses_str_remainder(const char *str, int width, int line_num)
|
||||
int strsize = strlen(str) + 1;
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
char substr[strsize];
|
||||
char curstr[strsize];
|
||||
char tmpstr[strsize];
|
||||
|
||||
strcpy(substr, str);
|
||||
@@ -381,7 +385,6 @@ curses_str_remainder(const char *str, int width, int line_num)
|
||||
#define BUFSZ 256
|
||||
#endif
|
||||
char substr[BUFSZ * 2];
|
||||
char curstr[BUFSZ * 2];
|
||||
char tmpstr[BUFSZ * 2];
|
||||
|
||||
if (strsize > (BUFSZ * 2) - 1) {
|
||||
@@ -409,10 +412,6 @@ curses_str_remainder(const char *str, int width, int line_num)
|
||||
if (last_space == 0) { /* No spaces found */
|
||||
last_space = count - 1;
|
||||
}
|
||||
for (count = 0; count < last_space; count++) {
|
||||
curstr[count] = substr[count];
|
||||
}
|
||||
curstr[count] = '\0';
|
||||
if (substr[count] == '\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -228,6 +228,7 @@ draw_status()
|
||||
curs_reset_windows(TRUE, TRUE);
|
||||
win = curses_get_nhwin(STATUS_WIN);
|
||||
}
|
||||
nhUse(ax); /* getmaxyx macro isn't sufficient */
|
||||
}
|
||||
|
||||
werase(win);
|
||||
@@ -513,6 +514,7 @@ boolean border;
|
||||
conditions would go if they were on this line */
|
||||
condstart += (cap_and_hunger == 2) ? spacing[BL_CAP]
|
||||
: (cap_and_hunger == 0) ? 1 : 0;
|
||||
nhUse(conddummy); /* getyx needed 3 args */
|
||||
}
|
||||
if (!(cap_and_hunger & 1))
|
||||
continue;
|
||||
@@ -533,6 +535,7 @@ boolean border;
|
||||
t = (width - (border ? 0 : 1)) - (ex - 1);
|
||||
ebuf[max(t, 2)] = '\0'; /* might still wrap... */
|
||||
}
|
||||
nhUse(ey); /* getyx needed 3 args */
|
||||
}
|
||||
break;
|
||||
case BL_SCORE:
|
||||
|
||||
@@ -495,12 +495,10 @@ tty_end_screen()
|
||||
/* Cursor movements */
|
||||
|
||||
/* Note to overlay tinkerers. The placement of this overlay controls the
|
||||
location
|
||||
of the function xputc(). This function is not currently in trampoli.[ch]
|
||||
files for what is deemed to be performance reasons. If this define is
|
||||
moved
|
||||
and or xputc() is taken out of the ROOT overlay, then action must be taken
|
||||
in trampoli.[ch]. */
|
||||
location of the function xputc(). This function is not currently in
|
||||
trampoli.[ch] files for what is deemed to be performance reasons. If
|
||||
this define is moved and or xputc() is taken out of the ROOT overlay,
|
||||
then action must be taken in trampoli.[ch]. */
|
||||
|
||||
void
|
||||
nocmov(x, y)
|
||||
@@ -528,7 +526,7 @@ int x, y;
|
||||
cmov(x, y);
|
||||
} else {
|
||||
while ((int) ttyDisplay->cury < y) {
|
||||
xputc('\n');
|
||||
(void) xputc('\n');
|
||||
ttyDisplay->curx = 0;
|
||||
ttyDisplay->cury++;
|
||||
}
|
||||
@@ -561,16 +559,27 @@ register int x, y;
|
||||
ttyDisplay->curx = x;
|
||||
}
|
||||
|
||||
/* See note above. xputc() is a special function. */
|
||||
void
|
||||
/* See note above. xputc() is a special function for overlays. */
|
||||
int
|
||||
xputc(c)
|
||||
#if defined(apollo)
|
||||
int c;
|
||||
#else
|
||||
char c;
|
||||
#endif
|
||||
int c; /* actually char, but explicitly specify its widened type */
|
||||
{
|
||||
(void) putchar(c);
|
||||
/*
|
||||
* Note: xputc() as a direct all to putchar() doesn't make any
|
||||
* sense _if_ putchar() is a function. But if it is a macro, an
|
||||
* overlay configuration would want to avoid hidden code bloat
|
||||
* from multiple putchar() expansions. And it gets passed as an
|
||||
* argument to tputs() so we have to guarantee an actual function
|
||||
* (while possibly lacking ANSI's (func) syntax to override macro).
|
||||
*
|
||||
* xputc() used to be declared as 'void xputc(c) char c; {}' but
|
||||
* avoiding the proper type 'int' just to avoid (void) casts when
|
||||
* ignoring the result can't have been sufficent reason to add it.
|
||||
* It also had '#if apollo' conditional to have the arg be int.
|
||||
* Matching putchar()'s declaration and using explicit casts where
|
||||
* warranted is more robust, so we're just a jacket around that.
|
||||
*/
|
||||
return putchar(c);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -579,13 +588,9 @@ const char *s;
|
||||
{
|
||||
#ifndef TERMLIB
|
||||
(void) fputs(s, stdout);
|
||||
#else
|
||||
#if defined(NHSTDC) || defined(ULTRIX_PROTO)
|
||||
tputs(s, 1, (int (*) ()) xputc);
|
||||
#else
|
||||
tputs(s, 1, xputc);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -599,7 +604,7 @@ cl_end()
|
||||
/* this looks terrible, especially on a slow terminal
|
||||
but is better than nothing */
|
||||
while (cx < CO) {
|
||||
xputc(' ');
|
||||
(void) xputc(' ');
|
||||
cx++;
|
||||
}
|
||||
tty_curs(BASE_WINDOW, (int) ttyDisplay->curx + 1,
|
||||
@@ -754,25 +759,18 @@ tty_delay_output()
|
||||
/* BUG: if the padding character is visible, as it is on the 5620
|
||||
then this looks terrible. */
|
||||
if (flags.null) {
|
||||
tputs(
|
||||
#ifdef TERMINFO
|
||||
/* cbosgd!cbcephus!pds for SYS V R2 */
|
||||
#ifdef NHSTDC
|
||||
tputs("$<50>", 1, (int (*) ()) xputc);
|
||||
"$<50>",
|
||||
#else
|
||||
tputs("$<50>", 1, xputc);
|
||||
#endif
|
||||
#else
|
||||
#if defined(NHSTDC) || defined(ULTRIX_PROTO)
|
||||
tputs("50", 1, (int (*) ()) xputc);
|
||||
#else
|
||||
tputs("50", 1, xputc);
|
||||
#endif
|
||||
"50",
|
||||
#endif
|
||||
1, xputc);
|
||||
|
||||
} else if (ospeed > 0 && ospeed < SIZE(tmspc10) && nh_CM) {
|
||||
/* delay by sending cm(here) an appropriate number of times */
|
||||
register int cmlen =
|
||||
strlen(tgoto(nh_CM, ttyDisplay->curx, ttyDisplay->cury));
|
||||
(int) strlen(tgoto(nh_CM, ttyDisplay->curx, ttyDisplay->cury));
|
||||
register int i = 500 + tmspc10[ospeed] / 2;
|
||||
|
||||
while (i > 0) {
|
||||
@@ -794,7 +792,7 @@ cl_eos() /* free after Robert Viduya */
|
||||
|
||||
while (cy <= LI - 2) {
|
||||
cl_end();
|
||||
xputc('\n');
|
||||
(void) xputc('\n');
|
||||
cy++;
|
||||
}
|
||||
cl_end();
|
||||
|
||||
@@ -204,7 +204,7 @@ static boolean FDECL(check_fields, (BOOLEAN_P, int *));
|
||||
static void NDECL(render_status);
|
||||
static void FDECL(tty_putstatusfield, (const char *, int, int));
|
||||
static boolean NDECL(check_windowdata);
|
||||
static int NDECL(condition_size);
|
||||
static void NDECL(set_condition_length);
|
||||
static int FDECL(make_things_fit, (BOOLEAN_P));
|
||||
static void FDECL(shrink_enc, (int));
|
||||
static void FDECL(shrink_dlvl, (int));
|
||||
@@ -3613,7 +3613,7 @@ char *posbar;
|
||||
* and tries a few different ways to squish a representation
|
||||
* of the status window values onto the 80 column tty display.
|
||||
* ->check_fields()
|
||||
* ->condition_size() - get the width of all conditions
|
||||
* ->set_condition_length() - update the width of conditions
|
||||
* ->shrink_enc() - shrink encumbrance message word
|
||||
* ->shrink_dlvl() - reduce the width of Dlvl:42
|
||||
*
|
||||
@@ -3967,7 +3967,7 @@ static int
|
||||
make_things_fit(force_update)
|
||||
boolean force_update;
|
||||
{
|
||||
int trycnt, fitting = 0, condsz, requirement;
|
||||
int trycnt, fitting = 0, requirement;
|
||||
int rowsz[3], num_rows, condrow, otheroptions = 0;
|
||||
|
||||
num_rows = (iflags.wc2_statuslines < 3) ? 2 : 3;
|
||||
@@ -3977,7 +3977,7 @@ boolean force_update;
|
||||
shrink_enc(0);
|
||||
if (dlvl_shrinklvl > 0)
|
||||
shrink_dlvl(0);
|
||||
condsz = condition_size();
|
||||
set_condition_length();
|
||||
for (trycnt = 0; trycnt < 6 && !fitting; ++trycnt) {
|
||||
/* FIXME: this remeasures each line every time even though it
|
||||
is only attempting to shrink one of them and the other one
|
||||
@@ -3995,7 +3995,7 @@ boolean force_update;
|
||||
if (trycnt < 2) {
|
||||
if (cond_shrinklvl < trycnt + 1) {
|
||||
cond_shrinklvl = trycnt + 1;
|
||||
condsz = condition_size();
|
||||
set_condition_length();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -4217,13 +4217,12 @@ int x, y;
|
||||
}
|
||||
|
||||
/* caller must set cond_shrinklvl (0..2) before calling us */
|
||||
static int
|
||||
condition_size()
|
||||
static void
|
||||
set_condition_length()
|
||||
{
|
||||
long mask;
|
||||
int c, lth;
|
||||
int c, lth = 0;
|
||||
|
||||
lth = 0;
|
||||
if (tty_condition_bits) {
|
||||
for (c = 0; c < SIZE(conditions); ++c) {
|
||||
mask = conditions[c].mask;
|
||||
@@ -4232,7 +4231,6 @@ condition_size()
|
||||
}
|
||||
}
|
||||
tty_status[NOW][BL_CONDITION].lth = lth;
|
||||
return lth;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user