Added check for the existence of a resource somewhere on the map
This was SVN commit r10742.
This commit is contained in:
parent
81372522f3
commit
78d50b4149
@ -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];
|
||||||
|
Loading…
Reference in New Issue
Block a user