Skip to content

Commit

Permalink
Merge pull request CleverRaven#75849 from l29ah/fixed-trading-clamping
Browse files Browse the repository at this point in the history
Fixed clamping order count in trading inventory
  • Loading branch information
Maleclypse authored Aug 28, 2024
2 parents facba24 + b1dfa05 commit 9d00e37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/inventory_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3943,9 +3943,9 @@ void inventory_multiselector::on_input( const inventory_input &input )
if( entry.is_selectable() ) {
size_t const count = entry.chosen_count;
size_t const max = entry.get_available_count();
size_t const newcount = std::clamp<size_t>( 0,
count + ( input.action == "INCREASE_COUNT" ? +1 : -1 ),
max );
size_t const newcount = input.action == "INCREASE_COUNT"
? count < max ? count + 1 : max
: count > 1 ? count - 1 : 0;
toggle_entry( entry, newcount );
}
} else if( input.action == "VIEW_CATEGORY_MODE" ) {
Expand Down

0 comments on commit 9d00e37

Please sign in to comment.