Page MenuHomeWildfire Games

Fix missing slash in common-api
ClosedPublic

Authored by Silier on Jun 17 2019, 3:34 PM.

Details

Reviewers
vladislavbelov
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22401: Fix missing slash in common-api of entity. The mistype was introduced in…
Summary

getCounteredClasses returns NaN as multiplier for counter because of missing slash when building string

Test Plan

:)

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

Silier created this revision.Jun 17 2019, 3:34 PM
Owners added a subscriber: Restricted Owners Package.Jun 17 2019, 3:34 PM
Stan awarded a token.Jun 17 2019, 3:37 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 308| 308| 			return undefined;
| 309| 309| 
| 310| 310| 		if (this.get("Attack/" + type + "/Bonuses"))
| 311|    |-		{
|    | 311|+		
| 312| 312| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 313| 313| 			{
| 314| 314| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 318| 318| 					if (bcl == againstClass)
| 319| 319| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 320| 320| 			}
| 321|    |-		}
|    | 321|+		
| 322| 322| 		return 1;
| 323| 323| 	},
| 324| 324| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 798| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 815| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 945| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1758/display/redirect

Forward-slash? Or just "slash"?

Silier retitled this revision from Fix missing backslash in common-api to Fix missing slash in common-api.Jun 17 2019, 5:28 PM
Silier edited the summary of this revision. (Show Details)
Silier added a reviewer: Restricted Owners Package.Jun 18 2019, 9:11 AM

Could you attach steps to reproduce the bug?

@vladislavbelov no steps to reproduce needed it is look and see situation

Without patch it is:
this.get("Attack/Ranged/BonusesClass1/Multiplier")
what is wrong just by looking at it
instead
this.get("Attack/Ranged/Bonuses/Class1/Multiplier")

vladislavbelov accepted this revision.EditedJun 26 2019, 7:57 PM
In D1994#84008, @Angen wrote:

@vladislavbelov no steps to reproduce needed it is look and see situation

I figured out. It's not used at all. It was added in rP12343, and its usage was removed in rP13687.

Thank you for the patch!

UPD. The mistype was introduced in rP14588.

This revision is now accepted and ready to land.Jun 26 2019, 7:57 PM
This revision was automatically updated to reflect the committed changes.