TTY_PERM_INVENT tweaks
This commit is contained in:
+10
-5
@@ -5349,6 +5349,7 @@ static char Empty[1] = { '\0' };
|
|||||||
static int done_environment_var = 0;
|
static int done_environment_var = 0;
|
||||||
#ifdef TTY_PERM_INVENT
|
#ifdef TTY_PERM_INVENT
|
||||||
extern void tty_perm_invent_toggled(boolean negated);
|
extern void tty_perm_invent_toggled(boolean negated);
|
||||||
|
extern boolean in_tty_perm_invent_toggled;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -5376,7 +5377,8 @@ core_update_invent_slot()
|
|||||||
|| (pi_info.tocore.tocore_flags & prohibited))
|
|| (pi_info.tocore.tocore_flags & prohibited))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!iflags.perm_invent && g.core_invent_state) {
|
if ((!iflags.perm_invent && g.core_invent_state)
|
||||||
|
&& !in_tty_perm_invent_toggled) {
|
||||||
/* Odd - but this could be end-of-game disclosure
|
/* Odd - but this could be end-of-game disclosure
|
||||||
* which just sets boolean iflag.perm_invent to
|
* which just sets boolean iflag.perm_invent to
|
||||||
* FALSE without actually doing anything else.
|
* FALSE without actually doing anything else.
|
||||||
@@ -5388,7 +5390,8 @@ core_update_invent_slot()
|
|||||||
(void) doredraw();
|
(void) doredraw();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!iflags.perm_invent && !in_tty_perm_invent_toggled)
|
||||||
|
return;
|
||||||
/*
|
/*
|
||||||
* The core looks after what content goes into the
|
* The core looks after what content goes into the
|
||||||
* inventory slots, and deals with things like obj
|
* inventory slots, and deals with things like obj
|
||||||
@@ -5419,7 +5422,7 @@ core_update_invent_slot()
|
|||||||
wport_id = "perm_invent";
|
wport_id = "perm_invent";
|
||||||
|
|
||||||
pi_info.fromcore.core_request = 0;
|
pi_info.fromcore.core_request = 0;
|
||||||
if (!g.core_invent_state) {
|
if ((iflags.perm_invent && !g.core_invent_state) || in_tty_perm_invent_toggled) {
|
||||||
/* Send the wport a request to get the related settings. */
|
/* Send the wport a request to get the related settings. */
|
||||||
pi_info.fromcore.core_request = request_settings;
|
pi_info.fromcore.core_request = request_settings;
|
||||||
if ((pi = update_invent_slot(g.perm_invent_win, (slot = 0), &pi_info))) {
|
if ((pi = update_invent_slot(g.perm_invent_win, (slot = 0), &pi_info))) {
|
||||||
@@ -5427,7 +5430,7 @@ core_update_invent_slot()
|
|||||||
/* sizes aren't good enough */
|
/* sizes aren't good enough */
|
||||||
set_option_mod_status("perm_invent", set_gameview);
|
set_option_mod_status("perm_invent", set_gameview);
|
||||||
iflags.perm_invent = FALSE;
|
iflags.perm_invent = FALSE;
|
||||||
pline("%s could not be enabled.", wport_id);
|
pline("%s could not be enabled.", wport_id);
|
||||||
pline("%s needs a terminal that is at least %dx%d, yours is %dx%d.",
|
pline("%s needs a terminal that is at least %dx%d, yours is %dx%d.",
|
||||||
wport_id,
|
wport_id,
|
||||||
pi->tocore.needrows, pi->tocore.needcols,
|
pi->tocore.needrows, pi->tocore.needcols,
|
||||||
@@ -5442,8 +5445,10 @@ core_update_invent_slot()
|
|||||||
display_nhwindow(g.perm_invent_win, FALSE);
|
display_nhwindow(g.perm_invent_win, FALSE);
|
||||||
g.core_invent_state++;
|
g.core_invent_state++;
|
||||||
}
|
}
|
||||||
text = Empty; /* lint suppression */
|
if (!pi || pi->tocore.maxslot == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
text = Empty; /* lint suppression */
|
||||||
pi_info.fromcore.core_request = update_slot;
|
pi_info.fromcore.core_request = update_slot;
|
||||||
obj = g.invent;
|
obj = g.invent;
|
||||||
for (slot = 0; slot < pi->tocore.maxslot; ++slot) {
|
for (slot = 0; slot < pi->tocore.maxslot; ++slot) {
|
||||||
|
|||||||
+4
-2
@@ -162,12 +162,14 @@ synch_cursor(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef TTY_PERM_INVENT
|
#ifdef TTY_PERM_INVENT
|
||||||
|
boolean in_tty_perm_invent_toggled = FALSE;
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_perm_invent_toggled(boolean negated)
|
tty_perm_invent_toggled(boolean negated)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* TTY_PERM_INVENT */
|
||||||
#endif
|
#endif /* TTY_GRAPHICS */
|
||||||
|
|
||||||
void
|
void
|
||||||
more(void)
|
more(void)
|
||||||
|
|||||||
+10
-3
@@ -267,6 +267,8 @@ static boolean done_tty_perm_invent_init = FALSE;
|
|||||||
#ifndef NOINVSYM /* invent.c */
|
#ifndef NOINVSYM /* invent.c */
|
||||||
#define NOINVSYM '#'
|
#define NOINVSYM '#'
|
||||||
#endif
|
#endif
|
||||||
|
/* not static, core_update_invent_slot() needs to see it from invent.c */
|
||||||
|
boolean in_tty_perm_invent_toggled = FALSE;
|
||||||
static int ttyinv_create_window(int, struct WinDesc *);
|
static int ttyinv_create_window(int, struct WinDesc *);
|
||||||
|
|
||||||
static void tty_invent_box_glyph_init(struct WinDesc *cw);
|
static void tty_invent_box_glyph_init(struct WinDesc *cw);
|
||||||
@@ -3926,15 +3928,20 @@ tty_invent_box_glyph_init(struct WinDesc *cw)
|
|||||||
void
|
void
|
||||||
tty_perm_invent_toggled(boolean negated)
|
tty_perm_invent_toggled(boolean negated)
|
||||||
{
|
{
|
||||||
|
in_tty_perm_invent_toggled = TRUE;
|
||||||
if (negated) {
|
if (negated) {
|
||||||
if (g.perm_invent_win != WIN_ERR)
|
if (g.perm_invent_win != WIN_ERR)
|
||||||
destroy_nhwindow(g.perm_invent_win), g.perm_invent_win = WIN_ERR;
|
destroy_nhwindow(g.perm_invent_win), g.perm_invent_win = WIN_ERR;
|
||||||
done_tty_perm_invent_init = FALSE;
|
done_tty_perm_invent_init = FALSE;
|
||||||
|
g.core_invent_state = 0;
|
||||||
} else {
|
} else {
|
||||||
g.perm_invent_win = create_nhwindow(NHW_PERMINVENT);
|
core_update_invent_slot();
|
||||||
if (g.perm_invent_win != WIN_ERR)
|
/* Doing this here was a problem */
|
||||||
display_nhwindow(g.perm_invent_win, FALSE);
|
// g.perm_invent_win = create_nhwindow(NHW_PERMINVENT);
|
||||||
|
// if (g.perm_invent_win != WIN_ERR)
|
||||||
|
// display_nhwindow(g.perm_invent_win, FALSE);
|
||||||
}
|
}
|
||||||
|
in_tty_perm_invent_toggled = FALSE;
|
||||||
}
|
}
|
||||||
#endif /* TTY_PERM_INVENT */
|
#endif /* TTY_PERM_INVENT */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user