1
0
forked from 0ad/0ad

fix double-click on a garrisoned hero button should select its holder, even if from autogarrison

This was SVN commit r15348.
This commit is contained in:
mimo 2014-06-14 14:21:30 +00:00
parent 7cf927baec
commit e2b493bb67
4 changed files with 5 additions and 5 deletions

View File

@ -631,7 +631,7 @@ function getEntityOrHolder(ent)
{
var entState = GetEntityState(ent);
if (entState && !entState.position && entState.unitAI && entState.unitAI.orders.length > 0 &&
entState.unitAI.orders[0].type == "Garrison")
(entState.unitAI.orders[0].type == "Garrison" || entState.unitAI.orders[0].type == "Autogarrison"))
return entState.unitAI.orders[0].data.target;
return ent;

View File

@ -551,7 +551,7 @@ ProductionQueue.prototype.SpawnUnits = function(templateName, count, metadata)
if (cmpAutoGarrison && cmpAutoGarrison.PerformGarrison(ent))
{
var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI);
cmpUnitAI.Autogarrison();
cmpUnitAI.Autogarrison(this.entity);
}
else
{

View File

@ -85,7 +85,7 @@ Promotion.prototype.Promote = function(promotedTemplateName)
// as we are already garrisoned and do not need to do
// any further checks (or else we should do them here).
orders.shift();
cmpPromotedUnitAI.Autogarrison();
cmpPromotedUnitAI.Autogarrison(orders[0].data.target);
}
else
warn("Promoted garrisoned entity with empty order queue.");

View File

@ -4982,9 +4982,9 @@ UnitAI.prototype.Ungarrison = function()
* Adds autogarrison order to the queue (only used by ProductionQueue for auto-garrisoning
* and Promotion when promoting already garrisoned entities).
*/
UnitAI.prototype.Autogarrison = function()
UnitAI.prototype.Autogarrison = function(target)
{
this.AddOrder("Autogarrison", null, false);
this.AddOrder("Autogarrison", { "target": target }, false);
};
/**