Page MenuHomeWildfire Games

Cleanup Resource Supply
Needs ReviewPublic

Authored by Stan on Thu, Jan 31, 3:57 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary
  • Early returns
  • Doxygen
  • If/else removal
  • This.isInfinite is no longer serialized
Test Plan

Make sure all the tests pass ask for other tests.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 6871
Build 11279: Vulcan BuildJenkins

Event Timeline

Stan created this revision.Thu, Jan 31, 3:57 PM
Vulcan added a subscriber: Vulcan.Thu, Jan 31, 3:58 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
|  34|  34| 
|  35|  35| 	// List of IDs for each player
|  36|  36| 	this.gatherers = [];
|  37|    |-	let numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers()
|    |  37|+	let numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers();
|  38|  38| 	for (let i = 0; i < numPlayers; ++i)
|  39|  39| 		this.gatherers.push([]);
|  40|  40| 
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
|  99|  99| {
| 100| 100| 	if (!this.template.DiminishingReturns)
| 101| 101| 		return null;
| 102|    |-	
|    | 102|+
| 103| 103| 	let diminishingReturns = ApplyValueModificationsToEntity("ResourceSupply/DiminishingReturns", +this.template.DiminishingReturns, this.entity);
| 104| 104| 	if (!diminishingReturns)	
| 105| 105| 		return null;
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
| 101| 101| 		return null;
| 102| 102| 	
| 103| 103| 	let diminishingReturns = ApplyValueModificationsToEntity("ResourceSupply/DiminishingReturns", +this.template.DiminishingReturns, this.entity);
| 104|    |-	if (!diminishingReturns)	
|    | 104|+	if (!diminishingReturns)
| 105| 105| 		return null;
| 106| 106| 
| 107| 107| 	let numGatherers = this.GetNumGatherers();
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ResourceSupply.js
| 164| 164| ResourceSupply.prototype.RemoveGatherer = function(gathererID, player)
| 165| 165| {
| 166| 166| 	if (player != undefined && player != INVALID_PLAYER)
| 167|    |-	{		
|    | 167|+	{
| 168| 168| 		let index = this.gatherers[player].indexOf(gathererID);
| 169| 169| 		if (index == -1)
| 170| 170| 			return;

binaries/data/mods/public/simulation/components/ResourceSupply.js
|  37| »   let·numPlayers·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_PlayerManager).GetNumPlayers()
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/ResourceSupply.js
| 109| »   »   return·diminishingReturns·==·1·?·1·:·(1.·-·Math.pow(diminishingReturns,·numGatherers))·/·(1.·-·diminishingReturns)·/·numGatherers;
|    | [NORMAL] JSHintBear:
|    | A trailing decimal point can be confused with a dot: '1.'.

binaries/data/mods/public/simulation/components/ResourceSupply.js
| 109| »   »   return·diminishingReturns·==·1·?·1·:·(1.·-·Math.pow(diminishingReturns,·numGatherers))·/·(1.·-·diminishingReturns)·/·numGatherers;
|    | [NORMAL] JSHintBear:
|    | A trailing decimal point can be confused with a dot: '1.'.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1022/

Stan updated this revision to Diff 7432.Fri, Feb 1, 1:19 AM

Try to fix Vulkan's comments.

Vulcan added a comment.Fri, Feb 1, 1:21 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/1023/