HomeWildfire Games

Add missing round when calculating trader gain, removed in rP22964

Description

Add missing round when calculating trader gain, removed in rP22964
Fixes loot tooltip and market tooltip.
Reviewed by: @wraitii

Differential Revision: https://code.wildfiregames.com/D2327

Event Timeline

elexis added a subscriber: elexis.Sep 29 2019, 3:36 PM
elexis added inline comments.
/ps/trunk/binaries/data/mods/public/simulation/helpers/TraderGain.js
61

(There is a small behavior change,

The new formula for gain.market1Gain is

Math.round(Math.round(gainMultiplier * TradeGain(distanceSq, mapSize)) * internationalBonus1);

Previously it was:

Math.round(gainMultiplier * TradeGain(distanceSq, mapSize) * internationalBonus1);

The difference of the inner term Math.round(x) and x should be max 0.5 by definition.
So if internationalBonus1 is smaller than 2, the difference should be about 1 resource per trade cart, in which case whatever.

(and 1 resource is negligible since a good trade cart transports a three digit number of resoures))