fix #H7156 - perm_invent
Bug report #H7156 listed three items, all relating to perm_invent: 1) it shouldn't persist across save/restore since restore might be on a system which doesn't have enough room to display it (report actually complained that config file setting was ignored when restoring old games, which is an expected side-effect for options that persist across save/restore); 2) permanent inventory wasn't updated when using scroll of charging; 3) attempts to update permanent inventory during restore could lead to crash if it tries to access shop cost for unpaid items. Items (2) and (3) have already been fixed. This fixes (1). Replace 'flags.perm_invent' with a dummy flag, preserving save files while removing it from flags. Add 'iflags.perm_invent' to hold the value of the perm_invent option. The win32 files that are updated here haven't been tested. Whichever branch contains the curses interface needs to be updated; ditto for any other pending/potential interfaces which support perm_invent.
This commit is contained in:
@@ -826,7 +826,7 @@ menu_item **menu_list;
|
||||
* each time.
|
||||
*/
|
||||
if (menu_info->valid_widgets
|
||||
&& (window != WIN_INVEN || !flags.perm_invent)) {
|
||||
&& (window != WIN_INVEN || !iflags.perm_invent)) {
|
||||
XtDestroyWidget(wp->popup);
|
||||
menu_info->valid_widgets = FALSE;
|
||||
menu_info->is_up = FALSE;
|
||||
|
||||
@@ -700,7 +700,7 @@ mswin_layout_main_window(HWND changed_child)
|
||||
GetNHApp()->rtInvenWindow.bottom = GetNHApp()->rtMenuWindow.bottom;
|
||||
|
||||
/* adjust map window size only if perm_invent is set */
|
||||
if (flags.perm_invent)
|
||||
if (iflags.perm_invent)
|
||||
GetNHApp()->rtMapWindow.right = GetNHApp()->rtMenuWindow.left;
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ mswin_layout_main_window(HWND changed_child)
|
||||
/* kludge - inventory window should have its own type (same as
|
||||
menu-text
|
||||
as a matter of fact) */
|
||||
if (flags.perm_invent && i == WIN_INVEN) {
|
||||
if (iflags.perm_invent && i == WIN_INVEN) {
|
||||
mswin_get_window_placement(NHW_INVEN, &rt);
|
||||
} else {
|
||||
mswin_get_window_placement(GetNHApp()->windowlist[i].type,
|
||||
|
||||
@@ -251,7 +251,7 @@ mswin_menu_window_select_menu(HWND hWnd, int how, MENU_ITEM_P **_selected,
|
||||
/* If we just used the permanent inventory window to pick something,
|
||||
* set the menu back to its display inventory state.
|
||||
*/
|
||||
if (flags.perm_invent && mswin_winid_from_handle(hWnd) == WIN_INVEN
|
||||
if (iflags.perm_invent && mswin_winid_from_handle(hWnd) == WIN_INVEN
|
||||
&& how != PICK_NONE) {
|
||||
data->menu.prompt[0] = '\0';
|
||||
SetMenuListType(hWnd, PICK_NONE);
|
||||
@@ -322,7 +322,7 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
GetWindowRect(hWnd, &rt);
|
||||
ScreenToClient(GetNHApp()->hMainWnd, (LPPOINT) &rt);
|
||||
ScreenToClient(GetNHApp()->hMainWnd, ((LPPOINT) &rt) + 1);
|
||||
if (flags.perm_invent && mswin_winid_from_handle(hWnd) == WIN_INVEN)
|
||||
if (iflags.perm_invent && mswin_winid_from_handle(hWnd) == WIN_INVEN)
|
||||
mswin_update_window_placement(NHW_INVEN, &rt);
|
||||
else
|
||||
mswin_update_window_placement(NHW_MENU, &rt);
|
||||
@@ -334,7 +334,7 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
GetWindowRect(hWnd, &rt);
|
||||
ScreenToClient(GetNHApp()->hMainWnd, (LPPOINT) &rt);
|
||||
ScreenToClient(GetNHApp()->hMainWnd, ((LPPOINT) &rt) + 1);
|
||||
if (flags.perm_invent && mswin_winid_from_handle(hWnd) == WIN_INVEN)
|
||||
if (iflags.perm_invent && mswin_winid_from_handle(hWnd) == WIN_INVEN)
|
||||
mswin_update_window_placement(NHW_INVEN, &rt);
|
||||
else
|
||||
mswin_update_window_placement(NHW_MENU, &rt);
|
||||
|
||||
@@ -1194,7 +1194,7 @@ mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected)
|
||||
ShowWindow(GetNHApp()->windowlist[wid].win, SW_SHOW);
|
||||
nReturned = mswin_menu_window_select_menu(
|
||||
GetNHApp()->windowlist[wid].win, how, selected,
|
||||
!(flags.perm_invent && wid == WIN_INVEN
|
||||
!(iflags.perm_invent && wid == WIN_INVEN
|
||||
&& how == PICK_NONE) /* don't activate inventory window if
|
||||
perm_invent is on */
|
||||
);
|
||||
@@ -1211,7 +1211,7 @@ void
|
||||
mswin_update_inventory()
|
||||
{
|
||||
logDebug("mswin_update_inventory()\n");
|
||||
if (flags.perm_invent && program_state.something_worth_saving
|
||||
if (iflags.perm_invent && program_state.something_worth_saving
|
||||
&& iflags.window_inited && WIN_INVEN != WIN_ERR)
|
||||
display_inventory(NULL, FALSE);
|
||||
}
|
||||
@@ -2243,7 +2243,7 @@ mswin_popup_destroy(HWND hWnd)
|
||||
DrawMenuBar(GetNHApp()->hMainWnd);
|
||||
|
||||
/* Don't hide the permanent inventory window ... leave it showing */
|
||||
if (!flags.perm_invent || mswin_winid_from_handle(hWnd) != WIN_INVEN)
|
||||
if (!iflags.perm_invent || mswin_winid_from_handle(hWnd) != WIN_INVEN)
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
|
||||
GetNHApp()->hPopupWnd = NULL;
|
||||
|
||||
Reference in New Issue
Block a user