void inventory_selector::prepare_paging() { if (items.size() == 0) { in_inventory = false; } prepare_paging(items); prepare_paging(worn); }
void selection_column::on_change( const inventory_entry &entry ) { inventory_entry my_entry( entry ); my_entry.category = &selected_cat; const auto iter = std::find( entries.begin(), entries.end(), my_entry ); if( my_entry.chosen_count != 0 ) { if( iter == entries.end() ) { add_entry( my_entry ); } else { iter->chosen_count = my_entry.chosen_count; } } else { entries.erase( iter ); } prepare_paging(); // Now let's update selection const auto select_iter = std::find( entries.begin(), entries.end(), my_entry ); if( select_iter != entries.end() ) { select( std::distance( entries.begin(), select_iter ) ); } else { select( entries.empty() ? 0 : entries.size() - 1 ); // Just select the last one } }
void inventory_selector::prepare_paging() { prepare_paging(items); prepare_paging(worn); }