Skip to content

Commit

Permalink
Merge pull request #78475 from kightlygeorge/price-density-stack-fix
Browse files Browse the repository at this point in the history
Make barter / volume sorting account for stack size
  • Loading branch information
Night-Pryanik authored Dec 11, 2024
2 parents 8ab48fe + 6a09575 commit a9d20af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/advanced_inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ struct advanced_inv_sorter {
break;
case SORTBY_PRICEPERVOLUME: {
const double price_density1 = static_cast<double>( d1.items.front()->price( true ) ) /
static_cast<double>( std::max( 1, d1.volume.value() ) );
static_cast<double>( std::max( 1, d1.items.front()->volume().value() ) );
const double price_density2 = static_cast<double>( d2.items.front()->price( true ) ) /
static_cast<double>( std::max( 1, d2.volume.value() ) );
static_cast<double>( std::max( 1, d2.items.front()->volume().value() ) );
if( price_density1 != price_density2 ) {
return price_density1 > price_density2;
}
Expand Down

0 comments on commit a9d20af

Please sign in to comment.