mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
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:
parent
0e0b4e3057
commit
4ef80d26aa
3 changed files with 5 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue