Ticket #1915: garrisonCapacity-v2.diff
File garrisonCapacity-v2.diff, 2.7 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/gui/session/input.js
311 311 case "garrison": 312 312 if (hasClass(entState, "Unit") && targetState.garrisonHolder && (playerOwned || mutualAllyOwned)) 313 313 { 314 var tooltip = "Current garrison: " + targetState.garrisonHolder.entities.length 315 + "/" + targetState.garrisonHolder.capacity; 316 if (targetState.garrisonHolder.entities.length >= targetState.garrisonHolder.capacity) 317 tooltip = "[color=\"orange\"]" + tooltip + "[/color]"; 314 318 var allowedClasses = targetState.garrisonHolder.allowedClasses; 315 319 for each (var unitClass in entState.identity.classes) 316 320 { 317 321 if (allowedClasses.indexOf(unitClass) != -1) 318 322 { 319 return {"possible": true };323 return {"possible": true, "tooltip": tooltip}; 320 324 } 321 325 } 322 326 } … … 460 464 target = targets[0]; 461 465 } 462 466 467 var actionInfo = undefined; 463 468 if (preSelectedAction != ACTION_NONE) 464 469 { 465 470 switch (preSelectedAction) … … 482 487 { 483 488 return {"type": "attack", "cursor": "action-attack", "target": target}; 484 489 } 485 else if (Engine.HotkeyIsPressed("session.garrison") && getActionInfo("garrison", target).possible)490 else if (Engine.HotkeyIsPressed("session.garrison") && (actionInfo = getActionInfo("garrison", target)).possible) 486 491 { 487 return {"type": "garrison", "cursor": "action-garrison", "t arget": target};492 return {"type": "garrison", "cursor": "action-garrison", "tooltip": actionInfo.tooltip, "target": target}; 488 493 } 489 494 else if (Engine.HotkeyIsPressed("session.attackmove") && getActionInfo("attack-move", target).possible) 490 495 { … … 492 497 } 493 498 else 494 499 { 495 var actionInfo = undefined;496 500 if ((actionInfo = getActionInfo("setup-trade-route", target)).possible) 497 501 return {"type": "setup-trade-route", "cursor": "action-setup-trade-route", "tooltip": actionInfo.tooltip, "target": target}; 498 502 else if ((actionInfo = getActionInfo("gather", target)).possible) -
binaries/data/mods/public/simulation/components/GuiInterface.js
297 297 { 298 298 ret.garrisonHolder = { 299 299 "entities": cmpGarrisonHolder.GetEntities(), 300 "allowedClasses": cmpGarrisonHolder.GetAllowedClassesList() 300 "allowedClasses": cmpGarrisonHolder.GetAllowedClassesList(), 301 "capacity": cmpGarrisonHolder.GetCapacity() 301 302 }; 302 303 } 303 304