Proper fix for the gatherer count. Fix an AI bug. Thanks to Gameboy and Gildas for reporting.

This was SVN commit r14571.
This commit is contained in:
wraitii 2014-01-11 18:14:13 +00:00
parent 0e0b4e3057
commit 4ef80d26aa
3 changed files with 5 additions and 7 deletions

View file

@ -158,12 +158,12 @@ function displaySingle(entState, template)
Engine.GetGUIObjectByName("resourceCarryingText").caption = entState.foundation.numBuilders + " ";
Engine.GetGUIObjectByName("resourceCarryingIcon").tooltip = "Number of builders";
}
else if (entState.resourceSupply && (!entState.resourceSupply.killBeforeGather || !entState.hitpoints))
else if (entState.resourceSupply && (!entState.resourceSupply.killBeforeGather || !entState.hitpoints) && player !== 0)
{
Engine.GetGUIObjectByName("resourceCarryingIcon").hidden = false;
Engine.GetGUIObjectByName("resourceCarryingText").hidden = false;
Engine.GetGUIObjectByName("resourceCarryingIcon").sprite = "stretched:session/icons/repair.png";
Engine.GetGUIObjectByName("resourceCarryingText").caption = entState.resourceSupply.gatherers[entState.player-1].length + " / " + entState.resourceSupply.maxGatherers + " ";
Engine.GetGUIObjectByName("resourceCarryingText").caption = entState.resourceSupply.gatherers[player-1].length + " / " + entState.resourceSupply.maxGatherers + " ";
Engine.GetGUIObjectByName("resourceCarryingIcon").tooltip = "Current/max gatherers";
}
else

View file

@ -449,7 +449,7 @@ m.Army.prototype.getState = function (gameState)
// check if we should remain at state 2 or drift away
m.Army.prototype.checkDangerosity = function (gameState)
{
this.territoryMap = Map.createTerritoryMap(gameState);
this.territoryMap = m.createTerritoryMap(gameState);
// right now we'll check if our position is "enemy" or not.
if (this.territoryMap.getOwner(this.position) !== PlayerID)
this.state = 1;

View file

@ -148,10 +148,8 @@ ResourceSupply.prototype.RemoveGatherer = function(gathererID, player)
// this can happen if the unit is dead
if (player === undefined || player === -1)
{
var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
var numPlayers = cmpPlayerManager.GetNumPlayers();
for (var i = 0; i < numPlayers; ++i)
this.RemoveGatherer(gathererID, i);
for (var i = 0; i < this.gatherers.length; ++i)
this.RemoveGatherer(gathererID, i+1);
}
else
{