Skip to content

Commit

Permalink
Better workaround for zero weight rubies
Browse files Browse the repository at this point in the history
  • Loading branch information
ragesoss committed Mar 31, 2019
1 parent 38e11e7 commit ea30c81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actions/market_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def self.buy good, market, max = false
def self.max_buyable good, market, price
affordable = $adventurer.money / price
available = market.quantity good
carryable = $adventurer.carrying_capacity / market.weight(good)
carryable = $adventurer.carrying_capacity / [market.weight(good), 0.001].max
[affordable, available, carryable].min
end

Expand Down

0 comments on commit ea30c81

Please sign in to comment.