Page MenuHomeWildfire Games

Update auras when a formation member renames.
Needs ReviewPublic

Authored by Freagarach on Jan 3 2019, 8:29 AM.

Details

Summary

https://wildfiregames.com/forum/index.php?/topic/25196-when-unit-levels-up-he-loses-armor-bonus-from-athens-hero/
When a unit promotes when in a formation with a hero that has a formation aura bonus, the bonus is not applied after the promotion.

Test Plan

Verify that the aura is applied after promotion and no strange side-effects are introduced.

Event Timeline

smiley created this revision.Jan 3 2019, 8:29 AM
Stan added reviewers: elexis, bb.Jan 3 2019, 8:30 AM
Stan added a subscriber: Stan.

Thank you for putting it on Phabricator.

Vulcan added a subscriber: Vulcan.Jan 3 2019, 8:35 AM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 126| 126| 	this.formationMembersWithAura = []; // Members with a formation aura
| 127| 127| 	this.width = 0;
| 128| 128| 	this.depth = 0;
| 129|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 129|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 130| 130| 	this.twinFormations = [];
| 131| 131| 	// distance from which two twin formations will merge into one.
| 132| 132| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 126| 126| 	this.formationMembersWithAura = []; // Members with a formation aura
| 127| 127| 	this.width = 0;
| 128| 128| 	this.depth = 0;
| 129|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 129|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 130| 130| 	this.twinFormations = [];
| 131| 131| 	// distance from which two twin formations will merge into one.
| 132| 132| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 144| 144| 
| 145| 145| Formation.prototype.GetSize = function()
| 146| 146| {
| 147|    |-	return {"width": this.width, "depth": this.depth};
|    | 147|+	return { "width": this.width, "depth": this.depth};
| 148| 148| };
| 149| 149| 
| 150| 150| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 144| 144| 
| 145| 145| Formation.prototype.GetSize = function()
| 146| 146| {
| 147|    |-	return {"width": this.width, "depth": this.depth};
|    | 147|+	return {"width": this.width, "depth": this.depth };
| 148| 148| };
| 149| 149| 
| 150| 150| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return { "width":1, "depth": 1};
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return {"width": 1, "depth": 1};
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return {"width":1, "depth": 1 };
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 565| 565| 	if (!footprints.length)
| 566| 566| 		return {"width":1, "depth": 1};
| 567| 567| 
| 568|    |-	var r = {"width": 0, "depth": 0};
|    | 568|+	var r = { "width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
| 570| 570| 	{
| 571| 571| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 565| 565| 	if (!footprints.length)
| 566| 566| 		return {"width":1, "depth": 1};
| 567| 567| 
| 568|    |-	var r = {"width": 0, "depth": 0};
|    | 568|+	var r = {"width": 0, "depth": 0 };
| 569| 569| 	for (var shape of footprints)
| 570| 570| 	{
| 571| 571| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
| 570|    |-	{
|    | 570|+	
| 571| 571| 		if (shape.type == "circle")
| 572| 572| 		{
| 573| 573| 			r.width += shape.radius * 2;
| 578| 578| 			r.width += shape.width;
| 579| 579| 			r.depth += shape.depth;
| 580| 580| 		}
| 581|    |-	}
|    | 581|+	
| 582| 582| 	r.width /= footprints.length;
| 583| 583| 	r.depth /= footprints.length;
| 584| 584| 	return r;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 591| 591| 	separation.depth *= this.separationMultiplier.depth;
| 592| 592| 
| 593| 593| 	if (this.columnar)
| 594|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 594|+		var sortingClasses = ["Cavalry", "Infantry"];
| 595| 595| 	else
| 596| 596| 		var sortingClasses = this.sortingClasses.slice();
| 597| 597| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 608| 608| 		var classes = cmpIdentity.GetClassesList();
| 609| 609| 		var done = false;
| 610| 610| 		for (var c = 0; c < sortingClasses.length; ++c)
| 611|    |-		{
|    | 611|+		
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614| 614| 				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
| 618|    |-		}
|    | 618|+		
| 619| 619| 		if (!done)
| 620| 620| 			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
| 621| 621| 	}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 		{
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 614|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 		{
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 614|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 635| 635| 	if (this.columnar)
| 636| 636| 	{
| 637| 637| 		shape = "square";
| 638|    |-		cols = Math.min(count,3);
|    | 638|+		cols = Math.min(count, 3);
| 639| 639| 		shiftRows = false;
| 640| 640| 		centerGap = 0;
| 641| 641| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 689| 689| 					n -= r%2;
| 690| 690| 			}
| 691| 691| 			else if (shape == "triangle")
| 692|    |-			{
|    | 692|+			
| 693| 693| 				if (shiftRows)
| 694| 694| 					var n = r + 1;
| 695| 695| 				else
| 696| 696| 					var n = r * 2 + 1;
| 697|    |-			}
|    | 697|+			
| 698| 698| 			if (!shiftRows && n > left)
| 699| 699| 				n = left;
| 700| 700| 			for (var c = 0; c < n && left > 0; ++c)
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 730| 730| 	// calculating offset distances without a zero average makes no sense, as the formation
| 731| 731| 	// will jump to a different position any time
| 732| 732| 	var avgoffset = Vector2D.average(offsets);
| 733|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 733|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 734| 734| 
| 735| 735| 	// sort the available places in certain ways
| 736| 736| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 799| 799| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 800| 800| {
| 801| 801| 	var offsetPositions = [];
| 802|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 802|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 803| 803| 	// calculate the world positions
| 804| 804| 	for (var o of offsets)
| 805| 805| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 799| 799| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 800| 800| {
| 801| 801| 	var offsetPositions = [];
| 802|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 802|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 803| 803| 	// calculate the world positions
| 804| 804| 	for (var o of offsets)
| 805| 805| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 816| 816| Formation.prototype.GetEstimatedOrientation = function(pos)
| 817| 817| {
| 818| 818| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 819|    |-	var r = {"sin": 0, "cos": 1};
|    | 819|+	var r = { "sin": 0, "cos": 1};
| 820| 820| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 821| 821| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 822| 822| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 816| 816| Formation.prototype.GetEstimatedOrientation = function(pos)
| 817| 817| {
| 818| 818| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 819|    |-	var r = {"sin": 0, "cos": 1};
|    | 819|+	var r = {"sin": 0, "cos": 1 };
| 820| 820| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 821| 821| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 822| 822| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 898| 898| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 899| 899| 		this.AddMembers(otherMembers);
| 900| 900| 		Engine.DestroyEntity(this.twinFormations[i]);
| 901|    |-		this.twinFormations.splice(i,1);
|    | 901|+		this.twinFormations.splice(i, 1);
| 902| 902| 	}
| 903| 903| 	// Switch between column and box if necessary
| 904| 904| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 335| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 422| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 468| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 509| »   »   var·cmpUnitAI·=·Engine.QueryInterface(offset.ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 544| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 596| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 605| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 620| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 660| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 694| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 696| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 707| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 710| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 712| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 718| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 698| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 699| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 704| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 714| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 724| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 597| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 602| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 603| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 610| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 612| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 614| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 755| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 860| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
Executing section cli...

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

smiley added inline comments.Jan 3 2019, 9:25 AM
binaries/data/mods/public/simulation/components/Formation.js
950

Do note that in cases where the renamed entity is the caster, this is trying to apply the bonus to the caster.

elexis added a subscriber: temple.Jan 3 2019, 10:51 AM
smiley updated this revision to Diff 7215.Jan 3 2019, 2:10 PM
smiley marked an inline comment as done.
Vulcan added a comment.Jan 3 2019, 2:12 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 126| 126| 	this.formationMembersWithAura = []; // Members with a formation aura
| 127| 127| 	this.width = 0;
| 128| 128| 	this.depth = 0;
| 129|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 129|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 130| 130| 	this.twinFormations = [];
| 131| 131| 	// distance from which two twin formations will merge into one.
| 132| 132| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 126| 126| 	this.formationMembersWithAura = []; // Members with a formation aura
| 127| 127| 	this.width = 0;
| 128| 128| 	this.depth = 0;
| 129|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 129|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 130| 130| 	this.twinFormations = [];
| 131| 131| 	// distance from which two twin formations will merge into one.
| 132| 132| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 144| 144| 
| 145| 145| Formation.prototype.GetSize = function()
| 146| 146| {
| 147|    |-	return {"width": this.width, "depth": this.depth};
|    | 147|+	return { "width": this.width, "depth": this.depth};
| 148| 148| };
| 149| 149| 
| 150| 150| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 144| 144| 
| 145| 145| Formation.prototype.GetSize = function()
| 146| 146| {
| 147|    |-	return {"width": this.width, "depth": this.depth};
|    | 147|+	return {"width": this.width, "depth": this.depth };
| 148| 148| };
| 149| 149| 
| 150| 150| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return { "width":1, "depth": 1};
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return {"width": 1, "depth": 1};
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return {"width":1, "depth": 1 };
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 565| 565| 	if (!footprints.length)
| 566| 566| 		return {"width":1, "depth": 1};
| 567| 567| 
| 568|    |-	var r = {"width": 0, "depth": 0};
|    | 568|+	var r = { "width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
| 570| 570| 	{
| 571| 571| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 565| 565| 	if (!footprints.length)
| 566| 566| 		return {"width":1, "depth": 1};
| 567| 567| 
| 568|    |-	var r = {"width": 0, "depth": 0};
|    | 568|+	var r = {"width": 0, "depth": 0 };
| 569| 569| 	for (var shape of footprints)
| 570| 570| 	{
| 571| 571| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
| 570|    |-	{
|    | 570|+	
| 571| 571| 		if (shape.type == "circle")
| 572| 572| 		{
| 573| 573| 			r.width += shape.radius * 2;
| 578| 578| 			r.width += shape.width;
| 579| 579| 			r.depth += shape.depth;
| 580| 580| 		}
| 581|    |-	}
|    | 581|+	
| 582| 582| 	r.width /= footprints.length;
| 583| 583| 	r.depth /= footprints.length;
| 584| 584| 	return r;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 591| 591| 	separation.depth *= this.separationMultiplier.depth;
| 592| 592| 
| 593| 593| 	if (this.columnar)
| 594|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 594|+		var sortingClasses = ["Cavalry", "Infantry"];
| 595| 595| 	else
| 596| 596| 		var sortingClasses = this.sortingClasses.slice();
| 597| 597| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 608| 608| 		var classes = cmpIdentity.GetClassesList();
| 609| 609| 		var done = false;
| 610| 610| 		for (var c = 0; c < sortingClasses.length; ++c)
| 611|    |-		{
|    | 611|+		
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614| 614| 				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
| 618|    |-		}
|    | 618|+		
| 619| 619| 		if (!done)
| 620| 620| 			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
| 621| 621| 	}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 		{
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 614|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 		{
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 614|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 635| 635| 	if (this.columnar)
| 636| 636| 	{
| 637| 637| 		shape = "square";
| 638|    |-		cols = Math.min(count,3);
|    | 638|+		cols = Math.min(count, 3);
| 639| 639| 		shiftRows = false;
| 640| 640| 		centerGap = 0;
| 641| 641| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 689| 689| 					n -= r%2;
| 690| 690| 			}
| 691| 691| 			else if (shape == "triangle")
| 692|    |-			{
|    | 692|+			
| 693| 693| 				if (shiftRows)
| 694| 694| 					var n = r + 1;
| 695| 695| 				else
| 696| 696| 					var n = r * 2 + 1;
| 697|    |-			}
|    | 697|+			
| 698| 698| 			if (!shiftRows && n > left)
| 699| 699| 				n = left;
| 700| 700| 			for (var c = 0; c < n && left > 0; ++c)
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 730| 730| 	// calculating offset distances without a zero average makes no sense, as the formation
| 731| 731| 	// will jump to a different position any time
| 732| 732| 	var avgoffset = Vector2D.average(offsets);
| 733|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 733|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 734| 734| 
| 735| 735| 	// sort the available places in certain ways
| 736| 736| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 799| 799| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 800| 800| {
| 801| 801| 	var offsetPositions = [];
| 802|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 802|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 803| 803| 	// calculate the world positions
| 804| 804| 	for (var o of offsets)
| 805| 805| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 799| 799| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 800| 800| {
| 801| 801| 	var offsetPositions = [];
| 802|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 802|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 803| 803| 	// calculate the world positions
| 804| 804| 	for (var o of offsets)
| 805| 805| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 816| 816| Formation.prototype.GetEstimatedOrientation = function(pos)
| 817| 817| {
| 818| 818| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 819|    |-	var r = {"sin": 0, "cos": 1};
|    | 819|+	var r = { "sin": 0, "cos": 1};
| 820| 820| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 821| 821| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 822| 822| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 816| 816| Formation.prototype.GetEstimatedOrientation = function(pos)
| 817| 817| {
| 818| 818| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 819|    |-	var r = {"sin": 0, "cos": 1};
|    | 819|+	var r = {"sin": 0, "cos": 1 };
| 820| 820| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 821| 821| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 822| 822| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 898| 898| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 899| 899| 		this.AddMembers(otherMembers);
| 900| 900| 		Engine.DestroyEntity(this.twinFormations[i]);
| 901|    |-		this.twinFormations.splice(i,1);
|    | 901|+		this.twinFormations.splice(i, 1);
| 902| 902| 	}
| 903| 903| 	// Switch between column and box if necessary
| 904| 904| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 945| 945| 			cmpNewUnitAI.SetFormationController(this.entity);
| 946| 946| 
| 947| 947| 		for (let ent of this.formationMembersWithAura)
| 948|    |-		{
|    | 948|+		
| 949| 949| 			// Don't apply the aura to the aura caster
| 950| 950| 			if (ent != msg.newentity)
| 951| 951| 			{
| 952| 952| 				let cmpAuras = Engine.QueryInterface(ent, IID_Auras);
| 953| 953| 				cmpAuras.ApplyFormationBonus(msg.newentity);
| 954| 954| 			}
| 955|    |-		}
|    | 955|+		
| 956| 956| 
| 957| 957| 		// Because the renamed entity might have different characteristics,
| 958| 958| 		// (e.g. packed vs. unpacked siege), we need to recompute motion parameters

binaries/data/mods/public/simulation/components/Formation.js
| 335| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 422| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 468| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 509| »   »   var·cmpUnitAI·=·Engine.QueryInterface(offset.ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 544| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 596| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 605| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 620| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 660| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 694| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 696| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 707| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 710| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 712| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 718| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 698| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 699| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 704| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 714| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 724| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 597| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 602| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 603| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 610| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 612| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 614| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 755| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 860| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
Executing section cli...

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

bb added a comment.Jan 4 2019, 9:46 PM

Don't be fooled by those two extra calls D997 tries to do, 1 of the function got removed by rP21243, and the other seems a phab bug

binaries/data/mods/public/simulation/components/Formation.js
937–938

index being used twice

this will fail if the new entity has a different aura, and that is absolutely allowed since we can change to another template if we want to

948

no need for braces

949

Don't know if we find a bug here, but I don't see a place where the caster is excluded when adding him to a formation (fallowing the code trail of setMembers doesn't give me a place where he is excluded)

953

check for cmpAuras && cmpAuras.HasFormationAura()

953

argument should be an array

smiley marked 5 inline comments as done.Jan 5 2019, 5:56 PM
smiley added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
949

Seems to be the case. Buggy or not, following that for consistency,

953

All these entities are added to formationMembersWithAura after those checks.

smiley updated this revision to Diff 7276.Jan 5 2019, 5:58 PM

Take care of inline comments and use an early return.

Vulcan added a comment.Jan 5 2019, 7:00 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 126| 126| 	this.formationMembersWithAura = []; // Members with a formation aura
| 127| 127| 	this.width = 0;
| 128| 128| 	this.depth = 0;
| 129|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 129|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 130| 130| 	this.twinFormations = [];
| 131| 131| 	// distance from which two twin formations will merge into one.
| 132| 132| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 126| 126| 	this.formationMembersWithAura = []; // Members with a formation aura
| 127| 127| 	this.width = 0;
| 128| 128| 	this.depth = 0;
| 129|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 129|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 130| 130| 	this.twinFormations = [];
| 131| 131| 	// distance from which two twin formations will merge into one.
| 132| 132| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 144| 144| 
| 145| 145| Formation.prototype.GetSize = function()
| 146| 146| {
| 147|    |-	return {"width": this.width, "depth": this.depth};
|    | 147|+	return { "width": this.width, "depth": this.depth};
| 148| 148| };
| 149| 149| 
| 150| 150| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 144| 144| 
| 145| 145| Formation.prototype.GetSize = function()
| 146| 146| {
| 147|    |-	return {"width": this.width, "depth": this.depth};
|    | 147|+	return {"width": this.width, "depth": this.depth };
| 148| 148| };
| 149| 149| 
| 150| 150| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return { "width":1, "depth": 1};
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return {"width": 1, "depth": 1};
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 563| 563| 			footprints.push(cmpFootprint.GetShape());
| 564| 564| 	}
| 565| 565| 	if (!footprints.length)
| 566|    |-		return {"width":1, "depth": 1};
|    | 566|+		return {"width":1, "depth": 1 };
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 565| 565| 	if (!footprints.length)
| 566| 566| 		return {"width":1, "depth": 1};
| 567| 567| 
| 568|    |-	var r = {"width": 0, "depth": 0};
|    | 568|+	var r = { "width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
| 570| 570| 	{
| 571| 571| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 565| 565| 	if (!footprints.length)
| 566| 566| 		return {"width":1, "depth": 1};
| 567| 567| 
| 568|    |-	var r = {"width": 0, "depth": 0};
|    | 568|+	var r = {"width": 0, "depth": 0 };
| 569| 569| 	for (var shape of footprints)
| 570| 570| 	{
| 571| 571| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 567| 567| 
| 568| 568| 	var r = {"width": 0, "depth": 0};
| 569| 569| 	for (var shape of footprints)
| 570|    |-	{
|    | 570|+	
| 571| 571| 		if (shape.type == "circle")
| 572| 572| 		{
| 573| 573| 			r.width += shape.radius * 2;
| 578| 578| 			r.width += shape.width;
| 579| 579| 			r.depth += shape.depth;
| 580| 580| 		}
| 581|    |-	}
|    | 581|+	
| 582| 582| 	r.width /= footprints.length;
| 583| 583| 	r.depth /= footprints.length;
| 584| 584| 	return r;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 591| 591| 	separation.depth *= this.separationMultiplier.depth;
| 592| 592| 
| 593| 593| 	if (this.columnar)
| 594|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 594|+		var sortingClasses = ["Cavalry", "Infantry"];
| 595| 595| 	else
| 596| 596| 		var sortingClasses = this.sortingClasses.slice();
| 597| 597| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 608| 608| 		var classes = cmpIdentity.GetClassesList();
| 609| 609| 		var done = false;
| 610| 610| 		for (var c = 0; c < sortingClasses.length; ++c)
| 611|    |-		{
|    | 611|+		
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614| 614| 				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
| 618|    |-		}
|    | 618|+		
| 619| 619| 		if (!done)
| 620| 620| 			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
| 621| 621| 	}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 		{
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 614|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 		{
| 612| 612| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 613| 613| 			{
| 614|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 614|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 615| 615| 				done = true;
| 616| 616| 				break;
| 617| 617| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 617| 617| 			}
| 618| 618| 		}
| 619| 619| 		if (!done)
| 620|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 620|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 621| 621| 	}
| 622| 622| 
| 623| 623| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 635| 635| 	if (this.columnar)
| 636| 636| 	{
| 637| 637| 		shape = "square";
| 638|    |-		cols = Math.min(count,3);
|    | 638|+		cols = Math.min(count, 3);
| 639| 639| 		shiftRows = false;
| 640| 640| 		centerGap = 0;
| 641| 641| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 689| 689| 					n -= r%2;
| 690| 690| 			}
| 691| 691| 			else if (shape == "triangle")
| 692|    |-			{
|    | 692|+			
| 693| 693| 				if (shiftRows)
| 694| 694| 					var n = r + 1;
| 695| 695| 				else
| 696| 696| 					var n = r * 2 + 1;
| 697|    |-			}
|    | 697|+			
| 698| 698| 			if (!shiftRows && n > left)
| 699| 699| 				n = left;
| 700| 700| 			for (var c = 0; c < n && left > 0; ++c)
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 730| 730| 	// calculating offset distances without a zero average makes no sense, as the formation
| 731| 731| 	// will jump to a different position any time
| 732| 732| 	var avgoffset = Vector2D.average(offsets);
| 733|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 733|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 734| 734| 
| 735| 735| 	// sort the available places in certain ways
| 736| 736| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 789| 789| 			closestOffsetId = i;
| 790| 790| 		}
| 791| 791| 	}
| 792|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 792|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 793| 793| 	return closestOffsetId;
| 794| 794| };
| 795| 795| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 799| 799| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 800| 800| {
| 801| 801| 	var offsetPositions = [];
| 802|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 802|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 803| 803| 	// calculate the world positions
| 804| 804| 	for (var o of offsets)
| 805| 805| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 799| 799| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 800| 800| {
| 801| 801| 	var offsetPositions = [];
| 802|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 802|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 803| 803| 	// calculate the world positions
| 804| 804| 	for (var o of offsets)
| 805| 805| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 816| 816| Formation.prototype.GetEstimatedOrientation = function(pos)
| 817| 817| {
| 818| 818| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 819|    |-	var r = {"sin": 0, "cos": 1};
|    | 819|+	var r = { "sin": 0, "cos": 1};
| 820| 820| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 821| 821| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 822| 822| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 816| 816| Formation.prototype.GetEstimatedOrientation = function(pos)
| 817| 817| {
| 818| 818| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 819|    |-	var r = {"sin": 0, "cos": 1};
|    | 819|+	var r = {"sin": 0, "cos": 1 };
| 820| 820| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 821| 821| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 822| 822| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Formation.js
| 898| 898| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 899| 899| 		this.AddMembers(otherMembers);
| 900| 900| 		Engine.DestroyEntity(this.twinFormations[i]);
| 901|    |-		this.twinFormations.splice(i,1);
|    | 901|+		this.twinFormations.splice(i, 1);
| 902| 902| 	}
| 903| 903| 	// Switch between column and box if necessary
| 904| 904| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 335| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 422| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 468| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 509| »   »   var·cmpUnitAI·=·Engine.QueryInterface(offset.ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 544| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 596| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 605| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 620| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 660| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 694| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 696| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 707| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 710| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 712| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 718| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 698| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 699| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 704| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 714| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 724| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 597| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 602| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 603| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 610| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 612| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 614| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 755| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 860| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
Executing section cli...

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

bb added inline comments.Jan 5 2019, 11:25 PM
binaries/data/mods/public/simulation/components/Formation.js
938–941

why is that inside the if block?

940

why are you checking fro cmpAura here? it should always be true if a unit is in that array
(my comment was on another line)

942

the new unit can have a different aura than the old one, thus we need to unapply the old (which is NOT done onOwnershipChange as the old is not a member than anymore) and apply the new aura to all members.

944–945

that is a missing check, not related to the patch though

952–953

here need the cmpAuras stuff a check

smiley marked an inline comment as done.Jan 8 2019, 1:03 PM
smiley added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
940

cmpAura of msg.newentity.

952–953

It's added to the array after doing the check. The check you said to remove up there.

bb added inline comments.Apr 21 2019, 6:53 PM
binaries/data/mods/public/simulation/components/Formation.js
940

true

952–953

gotcha

bb requested changes to this revision.May 30 2019, 9:25 PM

As a general comment, it might be easier/cleaner to extract some parts of the Add/RemoveMembers function and reuse those (since that is what we will be doing anyways), maybe even creating some helper functions of those exerts.

binaries/data/mods/public/simulation/components/Formation.js
928

index is used several times, so save it in a variable

935

since we remove the member here, the old aura's won't be disabled to all other members

938–941

A unit in a formation could have an aura without a unitAI, so the aura code shouldn't be in the unitAI check

941

If the old ent doesn't have an Aura butthe new one has, this will not add the new aura...

947–948

I suppose that could be moved into the scope above

953

If the new ent has an aura it won't be applied to all other member right?

958

(unrelated to the patch, it seems addMembers doesn't change the speeds, sounds bad...)

This revision now requires changes to proceed.May 30 2019, 9:25 PM

requested changes to this revision.

I don't have any other answer than requesting someone else to commandeer.

Freagarach updated this revision to Diff 9889.Sep 20 2019, 9:43 PM
Freagarach retitled this revision from Update auras when a formation member renames to Update auras when a formation member renames..
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)
Freagarach added a subscriber: Freagarach.

Just an idea?

Freagarach commandeered this revision.Sep 20 2019, 9:43 PM
Freagarach added a reviewer: smiley.

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/269/display/redirect

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return { "width": this.width, "depth": this.depth};
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return {"width": this.width, "depth": this.depth };
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 558| 558| 			footprints.push(cmpFootprint.GetShape());
| 559| 559| 	}
| 560| 560| 	if (!footprints.length)
| 561|    |-		return {"width":1, "depth": 1};
|    | 561|+		return { "width":1, "depth": 1};
| 562| 562| 
| 563| 563| 	var r = {"width": 0, "depth": 0};
| 564| 564| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 558| 558| 			footprints.push(cmpFootprint.GetShape());
| 559| 559| 	}
| 560| 560| 	if (!footprints.length)
| 561|    |-		return {"width":1, "depth": 1};
|    | 561|+		return {"width": 1, "depth": 1};
| 562| 562| 
| 563| 563| 	var r = {"width": 0, "depth": 0};
| 564| 564| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 558| 558| 			footprints.push(cmpFootprint.GetShape());
| 559| 559| 	}
| 560| 560| 	if (!footprints.length)
| 561|    |-		return {"width":1, "depth": 1};
|    | 561|+		return {"width":1, "depth": 1 };
| 562| 562| 
| 563| 563| 	var r = {"width": 0, "depth": 0};
| 564| 564| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 560| 560| 	if (!footprints.length)
| 561| 561| 		return {"width":1, "depth": 1};
| 562| 562| 
| 563|    |-	var r = {"width": 0, "depth": 0};
|    | 563|+	var r = { "width": 0, "depth": 0};
| 564| 564| 	for (var shape of footprints)
| 565| 565| 	{
| 566| 566| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 560| 560| 	if (!footprints.length)
| 561| 561| 		return {"width":1, "depth": 1};
| 562| 562| 
| 563|    |-	var r = {"width": 0, "depth": 0};
|    | 563|+	var r = {"width": 0, "depth": 0 };
| 564| 564| 	for (var shape of footprints)
| 565| 565| 	{
| 566| 566| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 586| 586| 	separation.depth *= this.separationMultiplier.depth;
| 587| 587| 
| 588| 588| 	if (this.columnar)
| 589|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 589|+		var sortingClasses = ["Cavalry", "Infantry"];
| 590| 590| 	else
| 591| 591| 		var sortingClasses = this.sortingClasses.slice();
| 592| 592| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 606| 606| 		{
| 607| 607| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 608| 608| 			{
| 609|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 609|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 610| 610| 				done = true;
| 611| 611| 				break;
| 612| 612| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 606| 606| 		{
| 607| 607| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 608| 608| 			{
| 609|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 609|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 610| 610| 				done = true;
| 611| 611| 				break;
| 612| 612| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			}
| 613| 613| 		}
| 614| 614| 		if (!done)
| 615|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 615|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 616| 616| 	}
| 617| 617| 
| 618| 618| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			}
| 613| 613| 		}
| 614| 614| 		if (!done)
| 615|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 615|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 616| 616| 	}
| 617| 617| 
| 618| 618| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			}
| 613| 613| 		}
| 614| 614| 		if (!done)
| 615|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 615|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 616| 616| 	}
| 617| 617| 
| 618| 618| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 630| 630| 	if (this.columnar)
| 631| 631| 	{
| 632| 632| 		shape = "square";
| 633|    |-		cols = Math.min(count,3);
|    | 633|+		cols = Math.min(count, 3);
| 634| 634| 		shiftRows = false;
| 635| 635| 		centerGap = 0;
| 636| 636| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 725| 725| 	// calculating offset distances without a zero average makes no sense, as the formation
| 726| 726| 	// will jump to a different position any time
| 727| 727| 	var avgoffset = Vector2D.average(offsets);
| 728|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 728|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 729| 729| 
| 730| 730| 	// sort the available places in certain ways
| 731| 731| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 784| 784| 			closestOffsetId = i;
| 785| 785| 		}
| 786| 786| 	}
| 787|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 787|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 788| 788| 	return closestOffsetId;
| 789| 789| };
| 790| 790| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 784| 784| 			closestOffsetId = i;
| 785| 785| 		}
| 786| 786| 	}
| 787|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 787|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 788| 788| 	return closestOffsetId;
| 789| 789| };
| 790| 790| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 784| 784| 			closestOffsetId = i;
| 785| 785| 		}
| 786| 786| 	}
| 787|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 787|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 788| 788| 	return closestOffsetId;
| 789| 789| };
| 790| 790| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 794| 794| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 795| 795| {
| 796| 796| 	var offsetPositions = [];
| 797|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 797|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 798| 798| 	// calculate the world positions
| 799| 799| 	for (var o of offsets)
| 800| 800| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 794| 794| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 795| 795| {
| 796| 796| 	var offsetPositions = [];
| 797|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 797|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 798| 798| 	// calculate the world positions
| 799| 799| 	for (var o of offsets)
| 800| 800| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 811| 811| Formation.prototype.GetEstimatedOrientation = function(pos)
| 812| 812| {
| 813| 813| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 814|    |-	var r = {"sin": 0, "cos": 1};
|    | 814|+	var r = { "sin": 0, "cos": 1};
| 815| 815| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 816| 816| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 817| 817| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 811| 811| Formation.prototype.GetEstimatedOrientation = function(pos)
| 812| 812| {
| 813| 813| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 814|    |-	var r = {"sin": 0, "cos": 1};
|    | 814|+	var r = {"sin": 0, "cos": 1 };
| 815| 815| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 816| 816| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 817| 817| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 893| 893| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 894| 894| 		this.AddMembers(otherMembers);
| 895| 895| 		Engine.DestroyEntity(this.twinFormations[i]);
| 896|    |-		this.twinFormations.splice(i,1);
|    | 896|+		this.twinFormations.splice(i, 1);
| 897| 897| 	}
| 898| 898| 	// Switch between column and box if necessary
| 899| 899| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 326| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 417| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 463| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 504| »   »   var·cmpUnitAI·=·Engine.QueryInterface(offset.ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 539| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 591| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 600| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 615| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 655| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 689| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 691| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 695| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 702| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 705| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 707| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 713| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 693| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 694| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 695| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 699| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 709| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 719| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 592| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 597| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 598| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 605| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 607| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 609| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 750| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 855| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/781/display/redirect

Angen added inline comments.Fri, Nov 29, 10:57 AM
binaries/data/mods/public/simulation/components/Formation.js
380
Angen requested changes to this revision.Mon, Dec 2, 1:27 PM

code that takes care about renamed entities is shorter, cleaner and mostly correct.

But there is one problematic point.
Consider formation with two members. One member get killed or removed, making second one still in formation (he will stay in until he gets some order, then he is removed). In case he gets promoted by some technology while alone in formation, that would result in removing him and therefore formation disband and following addmember would lead to error.

There is also one smaller issue that needs to be fixed as it is included in this diff, see inline above.

This revision now requires changes to proceed.Mon, Dec 2, 1:27 PM
Freagarach marked 16 inline comments as done.Tue, Dec 3, 9:03 PM

Actually there is no error (shown), probably because the formation-entity is disbanded the following turn. So at first the entity is added, but then the formation is disbanded and the lonely entity is also not in formation anymore.
Nevertheless, it should probably be made such that previous behaviour is restored.

Angen added a comment.Tue, Dec 3, 9:09 PM

This might work now, but it will not with D1462 or if we disband formation with less than 2 members as that is done anyway after lonely units in formation gets order. In that cases formation cannot be disbanded because member was renamed.

Freagarach updated this revision to Diff 10497.Fri, Dec 6, 8:14 PM

Switch add and remove functions.

Vulcan added a comment.Fri, Dec 6, 8:15 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/696/display/redirect

Vulcan added a comment.Fri, Dec 6, 8:20 PM

Build failure - The Moirai have given mortals hearts that can endure.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return { "width": this.width, "depth": this.depth};
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return {"width": this.width, "depth": this.depth };
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 557| 557| 			footprints.push(cmpFootprint.GetShape());
| 558| 558| 	}
| 559| 559| 	if (!footprints.length)
| 560|    |-		return {"width":1, "depth": 1};
|    | 560|+		return { "width":1, "depth": 1};
| 561| 561| 
| 562| 562| 	var r = {"width": 0, "depth": 0};
| 563| 563| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 557| 557| 			footprints.push(cmpFootprint.GetShape());
| 558| 558| 	}
| 559| 559| 	if (!footprints.length)
| 560|    |-		return {"width":1, "depth": 1};
|    | 560|+		return {"width": 1, "depth": 1};
| 561| 561| 
| 562| 562| 	var r = {"width": 0, "depth": 0};
| 563| 563| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 557| 557| 			footprints.push(cmpFootprint.GetShape());
| 558| 558| 	}
| 559| 559| 	if (!footprints.length)
| 560|    |-		return {"width":1, "depth": 1};
|    | 560|+		return {"width":1, "depth": 1 };
| 561| 561| 
| 562| 562| 	var r = {"width": 0, "depth": 0};
| 563| 563| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 559| 559| 	if (!footprints.length)
| 560| 560| 		return {"width":1, "depth": 1};
| 561| 561| 
| 562|    |-	var r = {"width": 0, "depth": 0};
|    | 562|+	var r = { "width": 0, "depth": 0};
| 563| 563| 	for (var shape of footprints)
| 564| 564| 	{
| 565| 565| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 559| 559| 	if (!footprints.length)
| 560| 560| 		return {"width":1, "depth": 1};
| 561| 561| 
| 562|    |-	var r = {"width": 0, "depth": 0};
|    | 562|+	var r = {"width": 0, "depth": 0 };
| 563| 563| 	for (var shape of footprints)
| 564| 564| 	{
| 565| 565| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 585| 585| 	separation.depth *= this.separationMultiplier.depth;
| 586| 586| 
| 587| 587| 	if (this.columnar)
| 588|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 588|+		var sortingClasses = ["Cavalry", "Infantry"];
| 589| 589| 	else
| 590| 590| 		var sortingClasses = this.sortingClasses.slice();
| 591| 591| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 605| 605| 		{
| 606| 606| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 607| 607| 			{
| 608|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 608|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 609| 609| 				done = true;
| 610| 610| 				break;
| 611| 611| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 605| 605| 		{
| 606| 606| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 607| 607| 			{
| 608|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 608|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 609| 609| 				done = true;
| 610| 610| 				break;
| 611| 611| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 			}
| 612| 612| 		}
| 613| 613| 		if (!done)
| 614|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 614|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 615| 615| 	}
| 616| 616| 
| 617| 617| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 			}
| 612| 612| 		}
| 613| 613| 		if (!done)
| 614|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 614|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 615| 615| 	}
| 616| 616| 
| 617| 617| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 611| 611| 			}
| 612| 612| 		}
| 613| 613| 		if (!done)
| 614|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 614|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 615| 615| 	}
| 616| 616| 
| 617| 617| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 629| 629| 	if (this.columnar)
| 630| 630| 	{
| 631| 631| 		shape = "square";
| 632|    |-		cols = Math.min(count,3);
|    | 632|+		cols = Math.min(count, 3);
| 633| 633| 		shiftRows = false;
| 634| 634| 		centerGap = 0;
| 635| 635| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 724| 724| 	// calculating offset distances without a zero average makes no sense, as the formation
| 725| 725| 	// will jump to a different position any time
| 726| 726| 	var avgoffset = Vector2D.average(offsets);
| 727|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 727|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 728| 728| 
| 729| 729| 	// sort the available places in certain ways
| 730| 730| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 783| 783| 			closestOffsetId = i;
| 784| 784| 		}
| 785| 785| 	}
| 786|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 786|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 787| 787| 	return closestOffsetId;
| 788| 788| };
| 789| 789| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 783| 783| 			closestOffsetId = i;
| 784| 784| 		}
| 785| 785| 	}
| 786|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 786|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 787| 787| 	return closestOffsetId;
| 788| 788| };
| 789| 789| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 783| 783| 			closestOffsetId = i;
| 784| 784| 		}
| 785| 785| 	}
| 786|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 786|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 787| 787| 	return closestOffsetId;
| 788| 788| };
| 789| 789| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 793| 793| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 794| 794| {
| 795| 795| 	var offsetPositions = [];
| 796|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 796|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 797| 797| 	// calculate the world positions
| 798| 798| 	for (var o of offsets)
| 799| 799| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 793| 793| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 794| 794| {
| 795| 795| 	var offsetPositions = [];
| 796|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 796|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 797| 797| 	// calculate the world positions
| 798| 798| 	for (var o of offsets)
| 799| 799| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 810| 810| Formation.prototype.GetEstimatedOrientation = function(pos)
| 811| 811| {
| 812| 812| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 813|    |-	var r = {"sin": 0, "cos": 1};
|    | 813|+	var r = { "sin": 0, "cos": 1};
| 814| 814| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 815| 815| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 816| 816| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 810| 810| Formation.prototype.GetEstimatedOrientation = function(pos)
| 811| 811| {
| 812| 812| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 813|    |-	var r = {"sin": 0, "cos": 1};
|    | 813|+	var r = {"sin": 0, "cos": 1 };
| 814| 814| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 815| 815| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 816| 816| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 892| 892| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 893| 893| 		this.AddMembers(otherMembers);
| 894| 894| 		Engine.DestroyEntity(this.twinFormations[i]);
| 895|    |-		this.twinFormations.splice(i,1);
|    | 895|+		this.twinFormations.splice(i, 1);
| 896| 896| 	}
| 897| 897| 	// Switch between column and box if necessary
| 898| 898| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 326| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 416| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 462| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 503| »   »   var·cmpUnitAI·=·Engine.QueryInterface(offset.ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 538| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 590| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 599| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 614| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 654| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 688| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 690| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 694| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 701| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 704| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 706| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 712| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 692| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 693| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 694| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 698| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 708| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 718| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 591| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 596| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 597| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 604| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 606| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 608| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 749| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 854| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1212/display/redirect

Vulcan added a comment.Sun, Dec 8, 3:10 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/719/display/redirect

Vulcan added a comment.Sun, Dec 8, 3:12 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return { "width": this.width, "depth": this.depth};
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return {"width": this.width, "depth": this.depth };
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 559| 559| 			footprints.push(cmpFootprint.GetShape());
| 560| 560| 	}
| 561| 561| 	if (!footprints.length)
| 562|    |-		return {"width":1, "depth": 1};
|    | 562|+		return { "width":1, "depth": 1};
| 563| 563| 
| 564| 564| 	var r = {"width": 0, "depth": 0};
| 565| 565| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 559| 559| 			footprints.push(cmpFootprint.GetShape());
| 560| 560| 	}
| 561| 561| 	if (!footprints.length)
| 562|    |-		return {"width":1, "depth": 1};
|    | 562|+		return {"width": 1, "depth": 1};
| 563| 563| 
| 564| 564| 	var r = {"width": 0, "depth": 0};
| 565| 565| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 559| 559| 			footprints.push(cmpFootprint.GetShape());
| 560| 560| 	}
| 561| 561| 	if (!footprints.length)
| 562|    |-		return {"width":1, "depth": 1};
|    | 562|+		return {"width":1, "depth": 1 };
| 563| 563| 
| 564| 564| 	var r = {"width": 0, "depth": 0};
| 565| 565| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 561| 561| 	if (!footprints.length)
| 562| 562| 		return {"width":1, "depth": 1};
| 563| 563| 
| 564|    |-	var r = {"width": 0, "depth": 0};
|    | 564|+	var r = { "width": 0, "depth": 0};
| 565| 565| 	for (var shape of footprints)
| 566| 566| 	{
| 567| 567| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 561| 561| 	if (!footprints.length)
| 562| 562| 		return {"width":1, "depth": 1};
| 563| 563| 
| 564|    |-	var r = {"width": 0, "depth": 0};
|    | 564|+	var r = {"width": 0, "depth": 0 };
| 565| 565| 	for (var shape of footprints)
| 566| 566| 	{
| 567| 567| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 587| 587| 	separation.depth *= this.separationMultiplier.depth;
| 588| 588| 
| 589| 589| 	if (this.columnar)
| 590|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 590|+		var sortingClasses = ["Cavalry", "Infantry"];
| 591| 591| 	else
| 592| 592| 		var sortingClasses = this.sortingClasses.slice();
| 593| 593| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 607| 607| 		{
| 608| 608| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 609| 609| 			{
| 610|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 610|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 611| 611| 				done = true;
| 612| 612| 				break;
| 613| 613| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 607| 607| 		{
| 608| 608| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 609| 609| 			{
| 610|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 610|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 611| 611| 				done = true;
| 612| 612| 				break;
| 613| 613| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			}
| 614| 614| 		}
| 615| 615| 		if (!done)
| 616|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 616|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 617| 617| 	}
| 618| 618| 
| 619| 619| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			}
| 614| 614| 		}
| 615| 615| 		if (!done)
| 616|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 616|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 617| 617| 	}
| 618| 618| 
| 619| 619| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			}
| 614| 614| 		}
| 615| 615| 		if (!done)
| 616|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 616|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 617| 617| 	}
| 618| 618| 
| 619| 619| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 631| 631| 	if (this.columnar)
| 632| 632| 	{
| 633| 633| 		shape = "square";
| 634|    |-		cols = Math.min(count,3);
|    | 634|+		cols = Math.min(count, 3);
| 635| 635| 		shiftRows = false;
| 636| 636| 		centerGap = 0;
| 637| 637| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 726| 726| 	// calculating offset distances without a zero average makes no sense, as the formation
| 727| 727| 	// will jump to a different position any time
| 728| 728| 	var avgoffset = Vector2D.average(offsets);
| 729|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 729|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 730| 730| 
| 731| 731| 	// sort the available places in certain ways
| 732| 732| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 785| 785| 			closestOffsetId = i;
| 786| 786| 		}
| 787| 787| 	}
| 788|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 788|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 789| 789| 	return closestOffsetId;
| 790| 790| };
| 791| 791| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 785| 785| 			closestOffsetId = i;
| 786| 786| 		}
| 787| 787| 	}
| 788|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 788|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 789| 789| 	return closestOffsetId;
| 790| 790| };
| 791| 791| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 785| 785| 			closestOffsetId = i;
| 786| 786| 		}
| 787| 787| 	}
| 788|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 788|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 789| 789| 	return closestOffsetId;
| 790| 790| };
| 791| 791| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 795| 795| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 796| 796| {
| 797| 797| 	var offsetPositions = [];
| 798|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 798|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 799| 799| 	// calculate the world positions
| 800| 800| 	for (var o of offsets)
| 801| 801| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 795| 795| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 796| 796| {
| 797| 797| 	var offsetPositions = [];
| 798|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 798|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 799| 799| 	// calculate the world positions
| 800| 800| 	for (var o of offsets)
| 801| 801| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 812| 812| Formation.prototype.GetEstimatedOrientation = function(pos)
| 813| 813| {
| 814| 814| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 815|    |-	var r = {"sin": 0, "cos": 1};
|    | 815|+	var r = { "sin": 0, "cos": 1};
| 816| 816| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 817| 817| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 818| 818| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 812| 812| Formation.prototype.GetEstimatedOrientation = function(pos)
| 813| 813| {
| 814| 814| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 815|    |-	var r = {"sin": 0, "cos": 1};
|    | 815|+	var r = {"sin": 0, "cos": 1 };
| 816| 816| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 817| 817| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 818| 818| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 894| 894| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 895| 895| 		this.AddMembers(otherMembers);
| 896| 896| 		Engine.DestroyEntity(this.twinFormations[i]);
| 897|    |-		this.twinFormations.splice(i,1);
|    | 897|+		this.twinFormations.splice(i, 1);
| 898| 898| 	}
| 899| 899| 	// Switch between column and box if necessary
| 900| 900| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 326| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 418| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 464| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 505| »   »   var·cmpUnitAI·=·Engine.QueryInterface(offset.ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 540| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 592| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 601| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 616| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 656| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 690| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 692| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 696| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 703| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 706| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 708| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 714| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 694| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 695| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 696| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 710| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 720| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 749| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 593| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 598| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 599| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 606| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 608| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 610| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 749| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 751| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 856| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1235/display/redirect

Angen accepted this revision.Sun, Dec 8, 8:31 PM

Issue with current code is that it does not apply and removes auras when entity is renamed.
I confirmed by testing that this diff is solving that issue and auras are correctly updated upon e.g. promotion.

Implementation introduced in this diff is delegating handling of switching entities to adding and removing member, what is generally good way how to do it, because that makes sure that anything that needs to be recalculated is recalculated and updated correctly. Also it removes code duplication and possible future problems with keeping OnGlobalEntityRenamed in synced with add / remove member functions.

First adding and then removing might look like it does + 2 not needed work, but it is indeed needed to not disband formation by renaming member if by his removing would formation disband. (other possibility would be to pass some boolean to remove member function and do not allow disband if true, but I do not care for that + 2 more updated of auras, if someone feels strong against that, I keep this open at least 3 days feel free to request changes)