void game::interactive_inv() { static const std::set<int> allowed_selections = { { ' ', '.', 'q', '=', '\n', KEY_LEFT, KEY_ESCAPE } }; u.inv.restack( &u ); u.inv.sort(); inventory_pick_selector inv_s( u ); inv_s.add_character_items( u ); inv_s.set_title( _( "Inventory" ) ); int res; do { inv_s.set_hint( string_format( _( "Item hotkeys assigned: <color_ltgray>%d</color>/<color_ltgray>%d</color>" ), u.allocated_invlets().size(), inv_chars.size() - u.allocated_invlets().size() ) ); const item_location &location = inv_s.execute(); if( location == item_location::nowhere ) { break; } refresh_all(); res = inventory_item_menu( u.get_item_position( location.get_item() ) ); refresh_all(); } while( allowed_selections.count( res ) != 0 ); }
void game::interactive_inv() { static const std::set<int> allowed_selections = { { ' ', '.', 'q', '=', '\n', KEY_LEFT, KEY_ESCAPE } }; u.inv.restack( &u ); u.inv.sort(); inventory_selector inv_s( u ); int res; do { const int pos = inv_s.execute_pick( _( "Inventory:" ) ); if( pos == INT_MIN ) { break; } refresh_all(); res = inventory_item_menu( pos ); } while( allowed_selections.count( res ) != 0 ); }