Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-02-08 19:58:58 -05:00
5 changed files with 75 additions and 130 deletions

View File

@@ -266,6 +266,21 @@ curses_init_mesg_history()
}
}
/* Delete message history at game end. */
void
curses_teardown_messages(void)
{
nhprev_mesg *current_mesg;
while ((current_mesg = first_mesg) != 0) {
first_mesg = current_mesg->next_mesg;
free(current_mesg->str);
free(current_mesg);
}
last_mesg = (nhprev_mesg *) 0;
num_messages = 0;
}
/* Display previous message window messages in reverse chron order */

View File

@@ -270,8 +270,8 @@ curses_break_str(const char *str, int width, int line_num)
int last_space, count;
char *retstr;
int curline = 0;
int strsize = strlen(str) + 1;
#if __STDC_VERSION__ >= 199901L
int strsize = (int) strlen(str) + 1;
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
char substr[strsize];
char curstr[strsize];
char tmpstr[strsize];
@@ -317,7 +317,7 @@ curses_break_str(const char *str, int width, int line_num)
if (substr[count] == '\0') {
break;
}
for (count = (last_space + 1); (size_t) count < strlen(substr); count++) {
for (count = (last_space + 1); count < (int) strlen(substr); count++) {
tmpstr[count - (last_space + 1)] = substr[count];
}
tmpstr[count - (last_space + 1)] = '\0';

View File

@@ -57,6 +57,20 @@ curses_status_init()
genl_status_init();
}
void
curses_teardown_status()
{
#ifdef STATUS_HILITES
int i;
for (i = 0; i < MAXBLSTATS; ++i) {
free(status_vals_long[i]);
status_vals_long[i] = (char *) 0;
}
#endif /* STATUS_HILITES */
return;
}
/*
* *_status_update()
* -- update the value of a status field.

View File

@@ -312,7 +312,11 @@ curses_del_nhwin(winid wid)
wid);
return;
}
if (wid == MESSAGE_WIN) {
curses_teardown_messages();
} else if (wid == STATUS_WIN) {
curses_teardown_status();
}
nhwins[wid].curwin = NULL;
nhwins[wid].nhwin = -1;
}
@@ -562,11 +566,11 @@ curses_alert_main_borders(boolean onoff)
static boolean
is_main_window(winid wid)
{
if ((wid == MESSAGE_WIN) || (wid == MAP_WIN) || (wid == STATUS_WIN) || wid == INV_WIN) {
if (wid == MESSAGE_WIN || wid == MAP_WIN
|| wid == STATUS_WIN || wid == INV_WIN)
return TRUE;
} else {
return FALSE;
}
return FALSE;
}