Page MenuHomeWildfire Games

Remove duplication in AttackPlan [Petra]
ClosedPublic

Authored by Silier on Mar 17 2020, 8:03 PM.

Details

Summary

Move duplicating code to functions.
Cleaner, nicer, easier to extend.

Test Plan

:)

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Silier created this revision.Mar 17 2020, 8:03 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 324| 324| 	this.queue.empty();
| 325| 325| 	this.queueChamp.empty();
| 326| 326| 	this.queueSiege.empty();
| 327|    |-}
|    | 327|+};
| 328| 328| 
| 329| 329| PETRA.AttackPlan.prototype.removeQueues = function(gameState)
| 330| 330| {
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 331| 331| 	gameState.ai.queueManager.removeQueue("plan_" + this.name);
| 332| 332| 	gameState.ai.queueManager.removeQueue("plan_" + this.name + "_champ");
| 333| 333| 	gameState.ai.queueManager.removeQueue("plan_" + this.name + "_siege");
| 334|    |-}
|    | 334|+};
| 335| 335| 
| 336| 336| /** Adds a build order. If resetQueue is true, this will reset the queue. */
| 337| 337| PETRA.AttackPlan.prototype.addBuildOrder = function(gameState, name, unitStats, resetQueue)

binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 327| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 334| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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

Silier updated this revision to Diff 11496.Mar 17 2020, 8:17 PM

fix linter comments

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

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

This revision was not accepted when it landed; it landed in state Needs Review.Mar 17 2020, 8:30 PM
This revision was automatically updated to reflect the committed changes.