}
}
break;
+ case opt_perm_invent:
+#ifdef TTY_PERM_INVENT
+ /* if attempting to enable perm_invent fails, say so and return
+ before "'perm_invent' option toggled on" would be given below;
+ tty_perm_invent_toggled() and routines it calls don't check
+ iflags.perm_invent so it doesn't matter that 'SET IT HERE'
+ hasn't been executed yet */
+ if (WINDOWPORT("tty") && !negated) {
+ tty_perm_invent_toggled(!negated);
+
+ if (g.tty_invent_win == WIN_ERR) {
+ /* FIXME: there is some confusion between this and
+ tty_create_nhwindow(NHW_TTYINVENT) over when this
+ should be done */
+ set_option_mod_status("perm_invent", set_gameview);
+ if (!g.opt_initial)
+ config_error_add("Enabling perm_invent failed");
+ return optn_silenterr;
+ }
+ }
+#endif
}
/* this dates from when 'O' prompted for a line of options text
rather than use a menu to control access to which options can
case opt_use_inverse:
case opt_hilite_pile:
case opt_perm_invent:
-#ifdef TTY_PERM_INVENT
- if (WINDOWPORT("tty"))
- tty_perm_invent_toggled(negated);
-#endif
case opt_ascii_map:
case opt_tiled_map:
g.opt_need_redraw = TRUE;
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.",
+ "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 perm_invent requires %d columns, your terminal has %d.",
tty_pi_mincol, ttyDisplay->cols);
}
set_option_mod_status("perm_invent", set_gameview);
return;
if (cw->type != NHW_MESSAGE
#ifdef TTY_PERM_INVENT
-&& window != g.tty_invent_win
+ && window != g.tty_invent_win
#endif
)
str = compress_str(str);
}
for (pass = 0; pass < 2; ++pass) {
for (row = 1; row < (cw->maxrow - 1); ++row) { /* row below top border */
- for (col = (pass
- ? bordercol[border_middle] + 1
- : bordercol[border_left] + 1);
- col < (pass
- ? bordercol[border_right]
- : bordercol[border_middle]); ++col) {
+ for (col = (pass ? bordercol[border_middle] + 1
+ : bordercol[border_left] + 1);
+ col < (pass ? bordercol[border_right]
+ : bordercol[border_middle]);
+ ++col) {
cell = &cw->cells[row][col];
if (obj && *text && ccnt < (bordercol[border_middle] - 1)) {
if (cell->content.ttychar != *text)
if (row == 0) {
if (col == bordercol[border_left])
glyph = cmap_to_glyph(S_tlcorn);
- else if ((col > bordercol[border_left] && col < bordercol[border_middle])
+ else if ((col > bordercol[border_left]
+ && col < bordercol[border_middle])
|| (col > bordercol[border_middle]
&& col < bordercol[border_right]))
glyph = cmap_to_glyph(S_hwall);
} else if (row == (cw->maxrow - 1)) {
if (col == bordercol[border_left])
glyph = cmap_to_glyph(S_blcorn);
- else if ((col > bordercol[border_left] && col < bordercol[border_middle])
+ else if ((col > bordercol[border_left]
+ && col < bordercol[border_middle])
|| (col > bordercol[border_middle]
&& col < bordercol[border_right]))
glyph = cmap_to_glyph(S_hwall);
tty_perm_invent_toggled(boolean negated)
{
if (negated) {
- destroy_nhwindow(g.tty_invent_win), g.tty_invent_win = WIN_ERR;
+ if (g.tty_invent_win != WIN_ERR)
+ destroy_nhwindow(g.tty_invent_win), g.tty_invent_win = WIN_ERR;
done_box_init = FALSE;
} else {
- if (WINDOWPORT("tty")) {
- g.tty_invent_win = create_nhwindow(NHW_TTYINVENT);
- if (g.tty_invent_win != WIN_ERR)
- display_nhwindow(g.tty_invent_win, FALSE);
- }
+ g.tty_invent_win = create_nhwindow(NHW_TTYINVENT);
+ if (g.tty_invent_win != WIN_ERR)
+ display_nhwindow(g.tty_invent_win, FALSE);
}
}
#endif