This makes it easier to change who gets the resources (refs #4314).
Details
- Reviewers
mimo - Group Reviewers
Restricted Owners Package (Owns No Changed Paths) - Commits
- rP20119: Factor out resource generation in cmpTrader.
Check that this doesn't break anything, makes the overall code nicer to read, and easier to extend (unless you manage to typo the function name in a few places like I did, but in that case everything is slightly harder).
(Unrelated, but that two market owners get resources when the trader arrives at one market seems a little bit strange. Even stranger that the two that get are the current, and next market owners (not the current and previous (previous == current in the code, so we'd need previous-1 mod numMarkets)) once you try to have trade routes with more than 2 markets (eg silk road), where you might have something like A---TB---C (where A,B,C are markets, T being the trader arriving at B) which will result in the owner of B and C getting resources.)
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Executing section Default... Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/Trader.js | |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/Trader.js | 98| 98| // set the target as second one | 99| 99| if (target == this.markets[0]) | 100| 100| return false; | 101| |- else | 102| |- { | | 101|+ | 103| 102| this.index = 0; | 104| 103| this.markets.push(target); | 105| 104| cmpTargetMarket.AddTrader(this.entity); | 106| 105| this.goods.amount = this.CalculateGain(this.markets[0], this.markets[1]); | 107| |- } | | 106|+ | 108| 107| } | 109| 108| else | 110| 109| { Executing section XML GUI... Executing section Python... Executing section Perl...
http://jenkins-master:8080/job/phabricator_lint/486/ for more details.
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Checking XML files...
http://jenkins-master:8080/job/phabricator/1971/ for more details.