forked from 0ad/0ad
petra: reset some collections only if needed
This was SVN commit r18531.
This commit is contained in:
parent
a498d18738
commit
01ff2fb0e0
@ -172,13 +172,13 @@ m.SharedScript.prototype.init = function(state, deserialization)
|
||||
this._entities.set(+id, new m.Entity(this, state.entities[id]));
|
||||
// entity collection updated on create/destroy event.
|
||||
this.entities = new m.EntityCollection(this, this._entities);
|
||||
|
||||
|
||||
// create the terrain analyzer
|
||||
this.terrainAnalyzer = new m.TerrainAnalysis();
|
||||
this.terrainAnalyzer.init(this, state);
|
||||
this.accessibility = new m.Accessibility();
|
||||
this.accessibility.init(state, this.terrainAnalyzer);
|
||||
|
||||
|
||||
// Setup resources
|
||||
this.resourceTypes = { "food": 0, "wood": 1, "stone": 2, "metal": 2 };
|
||||
this.resourceList = [];
|
||||
|
@ -131,10 +131,13 @@ m.HQ.prototype.checkEvents = function (gameState, events, queues)
|
||||
if (events.TerritoriesChanged.length || events.DiplomacyChanged.length)
|
||||
this.updateTerritories(gameState);
|
||||
|
||||
if (events.DiplomacyChanged.length)
|
||||
for (let evt of events.DiplomacyChanged)
|
||||
{
|
||||
if (evt.player !== PlayerID && evt.otherPlayer !== PlayerID)
|
||||
continue;
|
||||
gameState.resetAllyStructures();
|
||||
gameState.resetEnemyStructures();
|
||||
break;
|
||||
}
|
||||
|
||||
for (let evt of events.Create)
|
||||
|
Loading…
Reference in New Issue
Block a user