keep perm_invent option
Make it apparent why tty perm_invent can't be set in-game if the terminal cannot support it.
This commit is contained in:
@@ -636,7 +636,7 @@ display_gamewindows(void)
|
||||
start_menu(WIN_INVEN, 0U), end_menu(WIN_INVEN, (char *) 0);
|
||||
|
||||
#ifdef TTY_PERM_INVENT
|
||||
if (WINDOWPORT("tty")) {
|
||||
if (WINDOWPORT("tty") && iflags.perm_invent) {
|
||||
g.tty_invent_win = create_nhwindow(NHW_TTYINVENT);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -306,6 +306,7 @@ static int handle_add_list_remove(const char *, int);
|
||||
static void remove_autopickup_exception(struct autopickup_exception *);
|
||||
static int count_apes(void);
|
||||
static int count_cond(void);
|
||||
static void enhance_menu_text(char *, size_t, int, boolean *, struct allopt_t *);
|
||||
|
||||
static int handler_align_misc(int);
|
||||
static int handler_autounlock(int);
|
||||
@@ -7759,10 +7760,11 @@ doset(void) /* changing options via menu by Per Liboriussen */
|
||||
else
|
||||
Sprintf(buf, fmtstr_doset_tab,
|
||||
name, *bool_p ? "true" : "false");
|
||||
if (pass == 0)
|
||||
enhance_menu_text(buf, sizeof buf, pass, bool_p, &allopt[i]);
|
||||
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
|
||||
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
|
||||
any = cg.zeroany;
|
||||
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
|
||||
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
@@ -8895,6 +8897,30 @@ set_playmode(void)
|
||||
}
|
||||
/* don't need to do anything special for explore mode or normal play */
|
||||
}
|
||||
void
|
||||
enhance_menu_text(
|
||||
char *buf,
|
||||
size_t sz,
|
||||
int whichpass,
|
||||
boolean *bool_p,
|
||||
struct allopt_t *thisopt)
|
||||
{
|
||||
size_t nowsz, availsz;
|
||||
|
||||
if (!buf)
|
||||
return;
|
||||
nowsz = strlen(buf) + 1;
|
||||
availsz = sz - nowsz;
|
||||
|
||||
#ifdef TTY_PERM_INVENT
|
||||
if (bool_p == &iflags.perm_invent && WINDOWPORT("tty")) {
|
||||
if (thisopt->setwhere == set_gameview)
|
||||
Snprintf(eos(buf), availsz, " *terminal size is too small");
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#endif /* OPTION_LISTS_ONLY */
|
||||
|
||||
|
||||
@@ -1623,31 +1623,27 @@ tty_create_nhwindow(int type)
|
||||
newwin->datlen = (short *) 0;
|
||||
newwin->cells = (struct tty_perminvent_cell **) 0;
|
||||
|
||||
if ((newwin->rows < tty_pi_minrow) || (newwin->cols < tty_pi_mincol)) {
|
||||
if (newwin->rows < tty_pi_minrow) {
|
||||
tty_destroy_nhwindow(newid);
|
||||
if (iflags.perm_invent) {
|
||||
raw_printf("tty perm_invent has been disabled.");
|
||||
raw_printf(
|
||||
"tty perm_invent requires %d rows, your terminal has %d.",
|
||||
(iflags.wc2_statuslines > 2) ? 54 : 53, ttyDisplay->rows);
|
||||
iflags.perm_invent = FALSE;
|
||||
}
|
||||
return WIN_ERR;
|
||||
} else if (newwin->cols < tty_pi_mincol) {
|
||||
tty_destroy_nhwindow(newid);
|
||||
if (iflags.perm_invent) {
|
||||
raw_printf("tty perm_invent has been disabled.");
|
||||
raw_printf(
|
||||
"tty perm_invent requires %d columns, your terminal has %d.",
|
||||
tty_pi_mincol, ttyDisplay->cols);
|
||||
iflags.perm_invent = FALSE;
|
||||
if (!g.program_state.beyond_savefile_load)
|
||||
raw_printf("tty perm_invent could not be enabled.");
|
||||
if (newwin->rows < tty_pi_minrow)
|
||||
raw_printf(
|
||||
"tty perm_invent requires %d rows, your terminal has %d.",
|
||||
(iflags.wc2_statuslines > 2) ? 54 : 53,
|
||||
ttyDisplay->rows);
|
||||
else
|
||||
raw_printf(
|
||||
"tty perm_invent requires %d columns, your terminal has %d.",
|
||||
tty_pi_mincol, ttyDisplay->cols);
|
||||
}
|
||||
set_option_mod_status("perm_invent", set_gameview);
|
||||
iflags.perm_invent = FALSE;
|
||||
return WIN_ERR;
|
||||
} else {
|
||||
int r, c;
|
||||
|
||||
iflags.perm_invent = TRUE;
|
||||
|
||||
newwin->maxrow = tty_pi_minrow;
|
||||
newwin->maxcol = newwin->cols;
|
||||
/* establish the borders */
|
||||
|
||||
Reference in New Issue
Block a user