Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Trader.js
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | Trader.prototype.CalculateGain = function(currentMarket, nextMarket) | ||||
if (gain.market1Gain) | if (gain.market1Gain) | ||||
gain.market1Gain = Math.round(garrisonMultiplier * gain.market1Gain); | gain.market1Gain = Math.round(garrisonMultiplier * gain.market1Gain); | ||||
if (gain.market2Gain) | if (gain.market2Gain) | ||||
gain.market2Gain = Math.round(garrisonMultiplier * gain.market2Gain); | gain.market2Gain = Math.round(garrisonMultiplier * gain.market2Gain); | ||||
return gain; | return gain; | ||||
}; | }; | ||||
/** | |||||
* Remove market from trade route if only one market is in trade route setup. | |||||
* @param {number} id of market to be removed | |||||
* @return {boolean} true iff removal was successful | |||||
Freagarach: Captitals, `.` and `iff` -> `if`. | |||||
SilierAuthorUnsubmitted Done Inline Actionsno, iff is correct https://en.wikipedia.org/wiki/If_and_only_if Silier: no, `iff` is correct https://en.wikipedia.org/wiki/If_and_only_if
`@param` and `@return` are… | |||||
FreagarachUnsubmitted Done Inline Actions/me learned a new word :) But why use that above a normal if here, if I may ask? Freagarach: /me learned a new word :) But why use that above a normal if here, if I may ask?
(Dots are… | |||||
SilierAuthorUnsubmitted Done Inline Actions+1 for dots (tired eyes) Silier: +1 for dots (tired eyes)
I should probably reformulate that one. Its falsy right now. | |||||
*/ | |||||
Trader.prototype.RemoveTargetMarket = function(target) | |||||
Done Inline Actionsmove it before query Silier: move it before query | |||||
{ | |||||
if (this.markets.length != 1 || this.markets[0] != target) | |||||
return false; | |||||
let cmpTargetMarket = QueryMiragedInterface(target, IID_Market); | |||||
if (!cmpTargetMarket) | |||||
return false; | |||||
cmpTargetMarket.RemoveTrader(this.entity); | |||||
this.index = -1; | |||||
this.markets = []; | |||||
return true; | |||||
} | |||||
// Set target as target market. | // Set target as target market. | ||||
// Return true if at least one of markets was changed. | // Return true if at least one of markets was changed. | ||||
Trader.prototype.SetTargetMarket = function(target, source) | Trader.prototype.SetTargetMarket = function(target, source) | ||||
{ | { | ||||
let cmpTargetMarket = QueryMiragedInterface(target, IID_Market); | let cmpTargetMarket = QueryMiragedInterface(target, IID_Market); | ||||
if (!cmpTargetMarket) | if (!cmpTargetMarket) | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 218 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Captitals, . and iff -> if.