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:
+1
-1
@@ -636,7 +636,7 @@ display_gamewindows(void)
|
|||||||
start_menu(WIN_INVEN, 0U), end_menu(WIN_INVEN, (char *) 0);
|
start_menu(WIN_INVEN, 0U), end_menu(WIN_INVEN, (char *) 0);
|
||||||
|
|
||||||
#ifdef TTY_PERM_INVENT
|
#ifdef TTY_PERM_INVENT
|
||||||
if (WINDOWPORT("tty")) {
|
if (WINDOWPORT("tty") && iflags.perm_invent) {
|
||||||
g.tty_invent_win = create_nhwindow(NHW_TTYINVENT);
|
g.tty_invent_win = create_nhwindow(NHW_TTYINVENT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+27
-1
@@ -306,6 +306,7 @@ static int handle_add_list_remove(const char *, int);
|
|||||||
static void remove_autopickup_exception(struct autopickup_exception *);
|
static void remove_autopickup_exception(struct autopickup_exception *);
|
||||||
static int count_apes(void);
|
static int count_apes(void);
|
||||||
static int count_cond(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_align_misc(int);
|
||||||
static int handler_autounlock(int);
|
static int handler_autounlock(int);
|
||||||
@@ -7759,10 +7760,11 @@ doset(void) /* changing options via menu by Per Liboriussen */
|
|||||||
else
|
else
|
||||||
Sprintf(buf, fmtstr_doset_tab,
|
Sprintf(buf, fmtstr_doset_tab,
|
||||||
name, *bool_p ? "true" : "false");
|
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,
|
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
|
||||||
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
|
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
any = cg.zeroany;
|
any = cg.zeroany;
|
||||||
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
|
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
|
||||||
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
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 */
|
/* 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 */
|
#endif /* OPTION_LISTS_ONLY */
|
||||||
|
|
||||||
|
|||||||
+14
-18
@@ -1623,31 +1623,27 @@ tty_create_nhwindow(int type)
|
|||||||
newwin->datlen = (short *) 0;
|
newwin->datlen = (short *) 0;
|
||||||
newwin->cells = (struct tty_perminvent_cell **) 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) {
|
if (newwin->rows < tty_pi_minrow) {
|
||||||
tty_destroy_nhwindow(newid);
|
tty_destroy_nhwindow(newid);
|
||||||
if (iflags.perm_invent) {
|
if (!g.program_state.beyond_savefile_load)
|
||||||
raw_printf("tty perm_invent has been disabled.");
|
raw_printf("tty perm_invent could not be enabled.");
|
||||||
raw_printf(
|
if (newwin->rows < tty_pi_minrow)
|
||||||
"tty perm_invent requires %d rows, your terminal has %d.",
|
raw_printf(
|
||||||
(iflags.wc2_statuslines > 2) ? 54 : 53, ttyDisplay->rows);
|
"tty perm_invent requires %d rows, your terminal has %d.",
|
||||||
iflags.perm_invent = FALSE;
|
(iflags.wc2_statuslines > 2) ? 54 : 53,
|
||||||
}
|
ttyDisplay->rows);
|
||||||
return WIN_ERR;
|
else
|
||||||
} else if (newwin->cols < tty_pi_mincol) {
|
raw_printf(
|
||||||
tty_destroy_nhwindow(newid);
|
"tty perm_invent requires %d columns, your terminal has %d.",
|
||||||
if (iflags.perm_invent) {
|
tty_pi_mincol, ttyDisplay->cols);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
set_option_mod_status("perm_invent", set_gameview);
|
||||||
|
iflags.perm_invent = FALSE;
|
||||||
return WIN_ERR;
|
return WIN_ERR;
|
||||||
} else {
|
} else {
|
||||||
int r, c;
|
int r, c;
|
||||||
|
|
||||||
iflags.perm_invent = TRUE;
|
|
||||||
|
|
||||||
newwin->maxrow = tty_pi_minrow;
|
newwin->maxrow = tty_pi_minrow;
|
||||||
newwin->maxcol = newwin->cols;
|
newwin->maxcol = newwin->cols;
|
||||||
/* establish the borders */
|
/* establish the borders */
|
||||||
|
|||||||
Reference in New Issue
Block a user