fixes some leftover from 52f311da2b, refs #3934

This was SVN commit r19004.
This commit is contained in:
mimo 2016-11-27 16:35:50 +00:00
parent 3d9c6f19ab
commit 7464bb9ec7
3 changed files with 11 additions and 15 deletions

View File

@ -385,7 +385,7 @@ m.SharedScript.prototype.createResourceMaps = function()
{
for (let resource of this.resourceInfo.codes)
{
if (this.resourceInfo.aiInfluenceGroups[resource] === 0)
if (!(this.resourceInfo.aiInfluenceGroups[resource] in this.normalizationFactor))
continue;
// if there is no resourceMap create one with an influence for everything with that resource
if (this.resourceMaps[resource])
@ -422,7 +422,7 @@ m.SharedScript.prototype.updateResourceMaps = function(events)
{
for (let resource of this.resourceInfo.codes)
{
if (this.resourceInfo.aiInfluenceGroups[resource] === 0)
if (!(this.resourceInfo.aiInfluenceGroups[resource] in this.normalizationFactor))
continue;
// if there is no resourceMap create one with an influence for everything with that resource
if (this.resourceMaps[resource])

View File

@ -340,16 +340,11 @@ m.BaseManager.prototype.findBestDropsiteLocation = function(gameState, resource)
if (i < 0) // no room around
continue;
// we add 3 times the needed resource and once the other two (not food)
let total = 0;
// we add 3 times the needed resource and once the others (except food)
let total = 2*gameState.sharedScript.resourceMaps[resource].map[j];
for (let res in gameState.sharedScript.resourceMaps)
{
if (res === "food")
continue;
if (res !== "food")
total += gameState.sharedScript.resourceMaps[res].map[j];
if (res === resource)
total += 2*gameState.sharedScript.resourceMaps[res].map[j];
}
total = 0.7*total; // Just a normalisation factor as the locateMap is limited to 255
if (total <= bestVal)

View File

@ -852,10 +852,11 @@ m.HQ.prototype.findEconomicCCLocation = function(gameState, template, resource,
if (this.borderMap.map[j] > 0) // disfavor the borders of the map
norm *= 0.5;
let val = 2*gameState.sharedScript.ccResourceMaps[resource].map[j] +
gameState.sharedScript.ccResourceMaps.wood.map[j] +
gameState.sharedScript.ccResourceMaps.stone.map[j] +
gameState.sharedScript.ccResourceMaps.metal.map[j];
let val = 2*gameState.sharedScript.ccResourceMaps[resource].map[j];
for (let res in gameState.sharedScript.resourceMaps)
if (res !== "food")
val += gameState.sharedScript.ccResourceMaps[res].map[j];
val *= norm;
if (bestVal !== undefined && val < bestVal)