mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-17 22:03:56 -07:00
Focus on the building a hero is garrisoned in when the hero button is double-clicked. Patch by mimo. Fixes #2131
This was SVN commit r13978.
This commit is contained in:
parent
c7e3c1499f
commit
f6c9db33d6
2 changed files with 19 additions and 6 deletions
|
|
@ -462,13 +462,13 @@ function updateHero()
|
|||
heroImage.sprite = "stretched:session/portraits/" + template.icon;
|
||||
var hero = playerState.heroes[0];
|
||||
|
||||
heroButton.onpress = function()
|
||||
{
|
||||
heroButton.onpress = function()
|
||||
{
|
||||
if (!Engine.HotkeyIsPressed("selection.add"))
|
||||
g_Selection.reset();
|
||||
g_Selection.addList([hero]);
|
||||
g_Selection.reset();
|
||||
g_Selection.addList([hero]);
|
||||
};
|
||||
heroButton.ondoublepress = function() { selectAndMoveTo(hero) };
|
||||
heroButton.ondoublepress = function() { selectAndMoveTo(getEntityOrHolder(hero)); };
|
||||
heroButton.hidden = false;
|
||||
|
||||
// Setup tooltip
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ function getEntityNamesFormatted(template)
|
|||
if (specific)
|
||||
{
|
||||
// drop caps for specific name
|
||||
names += '[font="serif-bold-16"]' + specific[0] + '[/font]' +
|
||||
names += '[font="serif-bold-16"]' + specific[0] + '[/font]' +
|
||||
'[font="serif-bold-12"]' + specific.slice(1).toUpperCase() + '[/font]';
|
||||
|
||||
if (generic)
|
||||
|
|
@ -573,3 +573,16 @@ function getTradingTooltip(gain)
|
|||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the entity itself except when garrisoned where it returns its garrisonHolder
|
||||
*/
|
||||
function getEntityOrHolder(ent)
|
||||
{
|
||||
var entState = GetEntityState(ent);
|
||||
if (entState && !entState.position && entState.unitAI && entState.unitAI.orders.length > 0 &&
|
||||
entState.unitAI.orders[0].type == "Garrison")
|
||||
return entState.unitAI.orders[0].data.target;
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue