Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/buildManager.js
Show All 15 Lines | |||||
/** Initialization at start of game */ | /** Initialization at start of game */ | ||||
PETRA.BuildManager.prototype.init = function(gameState) | PETRA.BuildManager.prototype.init = function(gameState) | ||||
{ | { | ||||
let civ = gameState.getPlayerCiv(); | let civ = gameState.getPlayerCiv(); | ||||
for (let ent of gameState.getOwnUnits().values()) | for (let ent of gameState.getOwnUnits().values()) | ||||
this.incrementBuilderCounters(civ, ent, 1); | this.incrementBuilderCounters(civ, ent, 1); | ||||
}; | }; | ||||
PETRA.BuildManager.prototype.exitEmergency = function(gameState) | |||||
Silier: why is this recreation needed? | |||||
Done Inline ActionsWhat do you mean with recreation? JCWasmx86: What do you mean with recreation? | |||||
{ | |||||
// JCWASMX86_TODO: Check, whether this breaks anything | |||||
this.builderCounters = new Map(); | |||||
this.unbuildables = new Map(); | |||||
this.init(gameState); | |||||
}; | |||||
Done Inline ActionsCan we have builders that count for more than 1? Stan: Can we have builders that count for more than `1`? | |||||
Done Inline ActionsI don't know frankly. I had some error message in BuildManager, but this fixed it. JCWasmx86: I don't know frankly. I had some error message in BuildManager, but this fixed it. | |||||
PETRA.BuildManager.prototype.incrementBuilderCounters = function(civ, ent, increment) | PETRA.BuildManager.prototype.incrementBuilderCounters = function(civ, ent, increment) | ||||
{ | { | ||||
for (let buildable of ent.buildableEntities(civ)) | for (let buildable of ent.buildableEntities(civ)) | ||||
{ | { | ||||
if (this.builderCounters.has(buildable)) | if (this.builderCounters.has(buildable)) | ||||
{ | { | ||||
let count = this.builderCounters.get(buildable) + increment; | let count = this.builderCounters.get(buildable) + increment; | ||||
if (count < 0) | if (count < 0) | ||||
▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
why is this recreation needed?