Ticket #2131: hero.diff

File hero.diff, 1.3 KB (added by mimo, 11 years ago)
  • binaries/data/mods/public/gui/session/session.js

     
    468468            g_Selection.reset();
    469469        g_Selection.addList([hero]);
    470470    };
    471     heroButton.ondoublepress = function() { selectAndMoveTo(hero) };
     471    heroButton.ondoublepress = function() { selectAndMoveTo(getEntityOrHolder(hero)) };
    472472    heroButton.hidden = false;
    473473
    474474    // Setup tooltip
  • binaries/data/mods/public/gui/session/utility_functions.js

     
    573573
    574574    return tooltip;
    575575}
     576
     577/**
     578 * Returns the entity itself except when garrisoned where it returns its garrisonHolder
     579 */
     580function getEntityOrHolder(ent)
     581{
     582    var entState = GetEntityState(ent);
     583    if (entState && !entState.position)
     584        if (entState.unitAI && entState.unitAI.orders.length > 0 && entState.unitAI.orders[0].type == "Garrison")
     585            return entState.unitAI.orders[0].data.target;
     586
     587    return ent;
     588}