| 771 | } |
| 772 | |
| 773 | void |
| 774 | curses_update_inventory(int arg) |
| 775 | { |
| 776 | /* Don't do anything if perm_invent is off unless it was on and |
| 777 | player just changed the option. */ |
| 778 | if (!iflags.perm_invent) { |
| 779 | if (curses_get_nhwin(INV_WIN)) { |
| 780 | curs_reset_windows(TRUE, FALSE); |
| 781 | curs_purge_perminv_data(FALSE); |
| 782 | } |
| 783 | return; |
| 784 | } |
| 785 | |
| 786 | /* skip inventory updating during character initialization */ |
| 787 | if (!program_state.in_moveloop && !program_state.gameover) |
| 788 | return; |
| 789 | |
| 790 | if (!arg) { |
| 791 | /* if perm_invent is just being toggled on, we need to run the |
| 792 | update twice; the first time creates the window and organizes |
| 793 | the screen to fit it in, the second time populates it; |
| 794 | needed if we're called from docrt() because the "organizes |
| 795 | the screen" part calls docrt() and that skips recursive calls */ |
| 796 | boolean no_inv_win_yet = !curses_get_nhwin(INV_WIN); |
| 797 | |
| 798 | /* Update inventory sidebar. NetHack uses normal menu functions |
| 799 | when gathering the inventory, and we don't want to change the |
| 800 | underlying code. So instead, track if an inventory update is |
| 801 | being performed with a static variable. */ |
| 802 | inv_update = 1; |
| 803 | curs_update_invt(0); |
| 804 | if (no_inv_win_yet) |
| 805 | curs_update_invt(0); |
| 806 | inv_update = 0; |
| 807 | } else { |
| 808 | /* perform scrolling operations on persistent inventory window */ |
| 809 | curs_update_invt(arg); |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | win_request_info * |
| 814 | curses_ctrl_nhwindow( |
nothing calls this directly
no test coverage detected