alternative to display_inventory for window-port
Several window ports that support perm_invent were using a call back to the core display_inventory() function. While calling from the window port back to core functions is arguably not ideal in the first place, it was recently brought to light that code NetHack-3.7 code changes to display_inventory() actually caused it to stop repopulating the perm_invent window as intended under certain circumstances. For now, provide an alternative function, repopulate_perminvent(), that hopefullshould still work the way it did previously. There will likely be some additional changes after this to further improve things, at some point. For now though, this Resolves #1454
This commit is contained in:
@@ -502,7 +502,7 @@ void NetHackQtBind::qt_update_inventory(int arg UNUSED)
|
||||
|
||||
/* doesn't work yet
|
||||
if (program_state.something_worth_saving && iflags.perm_invent)
|
||||
display_inventory(NULL, false);
|
||||
repopulate_perminvent();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -1295,7 +1295,7 @@ X11_update_inventory(int arg)
|
||||
if (program_state.in_moveloop || program_state.gameover) {
|
||||
updated_inventory = 1; /* hack to avoid mapping&raising window */
|
||||
if (!arg) {
|
||||
(void) display_inventory((char *) 0, FALSE);
|
||||
repopulate_perminvent();
|
||||
} else {
|
||||
x11_scroll_perminv(arg);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ curs_update_invt(int arg)
|
||||
/* ask core to display full inventory in a PICK_NONE menu;
|
||||
instead of setting up an ordinary menu, it will indirectly
|
||||
call curs_add_invt() for each line (including class headers) */
|
||||
display_inventory(NULL, FALSE);
|
||||
repopulate_perminvent();
|
||||
curs_invt_updated(win);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -172,11 +172,11 @@ VDECLCB(shim_status_update,
|
||||
"vipiiip",
|
||||
A2P fldidx, P2V ptr, A2P chg, A2P percent, A2P color, P2V colormasks)
|
||||
#ifdef __EMSCRIPTEN__
|
||||
/* XXX: calling display_inventory() from shim_update_inventory() causes reentrancy that breaks emscripten Asyncify */
|
||||
/* this should be fine since according to windows.doc, the only purpose of shim_update_inventory() is to call display_inventory() */
|
||||
/* XXX: calling repopulate_perminvent() from shim_update_inventory() causes reentrancy that breaks emscripten Asyncify */
|
||||
/* this should be fine since according to windows.doc, the only purpose of shim_update_inventory() is to call repopulate_perminvent() */
|
||||
void shim_update_inventory(int a1 UNUSED) {
|
||||
if(iflags.perm_invent) {
|
||||
display_inventory(NULL, FALSE);
|
||||
repopulate_perminvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1248,7 +1248,7 @@ mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected)
|
||||
|
||||
/*
|
||||
-- Indicate to the window port that the inventory has been changed.
|
||||
-- Merely calls display_inventory() for window-ports that leave the
|
||||
-- Merely calls repopulate_perminvent() for window-ports that leave the
|
||||
window up, otherwise empty.
|
||||
*/
|
||||
void
|
||||
@@ -1257,7 +1257,7 @@ mswin_update_inventory(int arg)
|
||||
logDebug("mswin_update_inventory(%d)\n", arg);
|
||||
if (iflags.perm_invent && program_state.something_worth_saving
|
||||
&& iflags.window_inited && WIN_INVEN != WIN_ERR)
|
||||
display_inventory(NULL, FALSE);
|
||||
repopulate_perminvent();
|
||||
}
|
||||
|
||||
win_request_info *
|
||||
|
||||
Reference in New Issue
Block a user