1
0
forked from 0ad/0ad

Added check for the existence of a resource somewhere on the map

This was SVN commit r10742.
This commit is contained in:
Jonathan Waller 2011-12-16 10:46:20 +00:00
parent 81372522f3
commit 78d50b4149

View File

@ -287,6 +287,7 @@ EconomyManager.prototype.updateResourceMaps = function(gameState, events){
this.resourceMaps[resource] = new Map(gameState); this.resourceMaps[resource] = new Map(gameState);
var supplies = gameState.findResourceSupplies(); var supplies = gameState.findResourceSupplies();
if (supplies[resource]){
for (var i in supplies[resource]){ for (var i in supplies[resource]){
var current = supplies[resource][i]; var current = supplies[resource][i];
var x = Math.round(current.position[0] / gameState.cellSize); var x = Math.round(current.position[0] / gameState.cellSize);
@ -295,6 +296,7 @@ EconomyManager.prototype.updateResourceMaps = function(gameState, events){
this.resourceMaps[resource].addInfluence(x, z, radius[resource], strength); this.resourceMaps[resource].addInfluence(x, z, radius[resource], strength);
} }
} }
}
// Look for destroy events and subtract the entities original influence from the resourceMap // Look for destroy events and subtract the entities original influence from the resourceMap
for (var i in events) { for (var i in events) {
var e = events[i]; var e = events[i];