Ticket #1915: garrisonCapacity.diff

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

     
    311311        case "garrison":
    312312            if (hasClass(entState, "Unit") && targetState.garrisonHolder && (playerOwned || mutualAllyOwned))
    313313            {
     314                var tooltip = "Current garrison " + targetState.garrisonHolder.entities.length
     315                    + ", with a capacity of " + targetState.garrisonHolder.capacity + ".";
    314316                var allowedClasses = targetState.garrisonHolder.allowedClasses;
    315317                for each (var unitClass in entState.identity.classes)
    316318                {
    317319                    if (allowedClasses.indexOf(unitClass) != -1)
    318320                    {
    319                         return {"possible": true};
     321                        return {"possible": true, "tooltip": tooltip};
    320322                    }
    321323                }
    322324            }
     
    460462        target = targets[0];
    461463    }
    462464
     465    var actionInfo = undefined;
    463466    if (preSelectedAction != ACTION_NONE)
    464467    {
    465468        switch (preSelectedAction)
     
    482485    {
    483486        return {"type": "attack", "cursor": "action-attack", "target": target};
    484487    }
    485     else if (Engine.HotkeyIsPressed("session.garrison") && getActionInfo("garrison", target).possible)
     488    else if (Engine.HotkeyIsPressed("session.garrison") && (actionInfo = getActionInfo("garrison", target)).possible)
    486489    {
    487         return {"type": "garrison", "cursor": "action-garrison", "target": target};
     490        return {"type": "garrison", "cursor": "action-garrison", "tooltip": actionInfo.tooltip, "target": target};
    488491    }
    489492    else if (Engine.HotkeyIsPressed("session.attackmove") && getActionInfo("attack-move", target).possible)
    490493    {
     
    492495    }
    493496    else
    494497    {
    495         var actionInfo = undefined;
    496498        if ((actionInfo = getActionInfo("setup-trade-route", target)).possible)
    497499            return {"type": "setup-trade-route", "cursor": "action-setup-trade-route", "tooltip": actionInfo.tooltip, "target": target};
    498500        else if ((actionInfo = getActionInfo("gather", target)).possible)
  • binaries/data/mods/public/simulation/components/GuiInterface.js

     
    297297    {
    298298        ret.garrisonHolder = {
    299299            "entities": cmpGarrisonHolder.GetEntities(),
    300             "allowedClasses": cmpGarrisonHolder.GetAllowedClassesList()
     300            "allowedClasses": cmpGarrisonHolder.GetAllowedClassesList(),
     301            "capacity": cmpGarrisonHolder.GetCapacity()
    301302        };
    302303    }
    303304