invent fixes, take II
Make sure that inventory listing when carrying only gold works when build without TTY_PERM_INVENT as well as with that.
This commit is contained in:
+11
-5
@@ -3226,7 +3226,6 @@ display_pickinv(
|
|||||||
if (g.cached_pickinv_win == WIN_ERR)
|
if (g.cached_pickinv_win == WIN_ERR)
|
||||||
g.cached_pickinv_win = create_nhwindow(NHW_MENU);
|
g.cached_pickinv_win = create_nhwindow(NHW_MENU);
|
||||||
win = g.cached_pickinv_win;
|
win = g.cached_pickinv_win;
|
||||||
show_gold = TRUE;
|
|
||||||
} else {
|
} else {
|
||||||
win = WIN_INVEN;
|
win = WIN_INVEN;
|
||||||
menu_behavior = MENU_BEHAVE_PERMINV;
|
menu_behavior = MENU_BEHAVE_PERMINV;
|
||||||
@@ -5412,15 +5411,22 @@ display_binventory(coordxy x, coordxy y, boolean as_if_seen)
|
|||||||
void
|
void
|
||||||
prepare_perminvent(winid window)
|
prepare_perminvent(winid window)
|
||||||
{
|
{
|
||||||
win_request_info *wri UNUSED;
|
win_request_info *wri;
|
||||||
|
|
||||||
if (!done_setting_perminv_flags) {
|
if (!done_setting_perminv_flags) {
|
||||||
wri_info = zerowri;
|
wri_info = zerowri;
|
||||||
/*TEMPORARY*/
|
#if defined(TTY_PERM_INVENT)
|
||||||
char *envtmp = nh_getenv("TTYINV");
|
if (WINDOWPORT(tty)) {
|
||||||
wri_info.fromcore.invmode = envtmp ? atoi(envtmp) : InvNormal;
|
/*TEMPORARY*/
|
||||||
|
char *envtmp = nh_getenv("TTYINV");
|
||||||
|
|
||||||
|
wri_info.fromcore.invmode = envtmp ? atoi(envtmp) : InvNormal;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
wri_info.fromcore.invmode = InvShowGold;
|
||||||
/* relay the mode settings to the window port */
|
/* relay the mode settings to the window port */
|
||||||
wri = ctrl_nhwindow(window, set_mode, &wri_info);
|
wri = ctrl_nhwindow(window, set_mode, &wri_info);
|
||||||
|
nhUse(wri);
|
||||||
done_setting_perminv_flags = 1;
|
done_setting_perminv_flags = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -754,14 +754,14 @@ curses_display_nhmenu(
|
|||||||
if (current_menu == NULL) {
|
if (current_menu == NULL) {
|
||||||
impossible(
|
impossible(
|
||||||
"curses_display_nhmenu: attempt to display nonexistent menu");
|
"curses_display_nhmenu: attempt to display nonexistent menu");
|
||||||
return '\033';
|
return -1; /* not ESC which falsely claims 27 items were selected */
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_item_ptr = current_menu->entries;
|
menu_item_ptr = current_menu->entries;
|
||||||
|
|
||||||
if (menu_item_ptr == NULL) {
|
if (menu_item_ptr == NULL) {
|
||||||
impossible("curses_display_nhmenu: attempt to display empty menu");
|
impossible("curses_display_nhmenu: attempt to display empty menu");
|
||||||
return '\033';
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset items to unselected to clear out selections from previous
|
/* Reset items to unselected to clear out selections from previous
|
||||||
@@ -790,15 +790,14 @@ curses_display_nhmenu(
|
|||||||
selected = (MENU_ITEM_P *) alloc((unsigned)
|
selected = (MENU_ITEM_P *) alloc((unsigned)
|
||||||
(num_chosen * sizeof (MENU_ITEM_P)));
|
(num_chosen * sizeof (MENU_ITEM_P)));
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
menu_item_ptr = current_menu->entries;
|
menu_item_ptr = current_menu->entries;
|
||||||
|
|
||||||
while (menu_item_ptr != NULL) {
|
while (menu_item_ptr != NULL) {
|
||||||
if (menu_item_ptr->selected) {
|
if (menu_item_ptr->selected) {
|
||||||
if (count == num_chosen) {
|
if (count == num_chosen) {
|
||||||
impossible("curses_display_nhmenu: Selected items "
|
impossible("curses_display_nhmenu: Selected items "
|
||||||
"exceeds expected number");
|
"exceeds expected number");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
selected[count].item = menu_item_ptr->identifier;
|
selected[count].item = menu_item_ptr->identifier;
|
||||||
selected[count].count = menu_item_ptr->count;
|
selected[count].count = menu_item_ptr->count;
|
||||||
@@ -810,6 +809,7 @@ curses_display_nhmenu(
|
|||||||
if (count != num_chosen) {
|
if (count != num_chosen) {
|
||||||
impossible(
|
impossible(
|
||||||
"curses_display_nhmenu: Selected items less than expected number");
|
"curses_display_nhmenu: Selected items less than expected number");
|
||||||
|
num_chosen = min(count, num_chosen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ curses_display_nhwindow(winid wid, boolean block)
|
|||||||
|
|
||||||
if (curses_is_menu(wid) || curses_is_text(wid)) {
|
if (curses_is_menu(wid) || curses_is_text(wid)) {
|
||||||
curses_end_menu(wid, "");
|
curses_end_menu(wid, "");
|
||||||
curses_select_menu(wid, PICK_NONE, &selected);
|
(void) curses_select_menu(wid, PICK_NONE, &selected);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user