Ticket #1915: garrisonCapacity-v3.diff
File garrisonCapacity-v3.diff, 3.7 KB (added by , 11 years ago) |
---|
-
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 -
binaries/data/mods/public/gui/session/input.js
227 227 data.command = "garrison"; 228 228 data.target = target; 229 229 cursor = "action-garrison"; 230 tooltip = "Current garrison: " + targetState.garrisonHolder.entities.length 231 + "/" + targetState.garrisonHolder.capacity; 232 if (targetState.garrisonHolder.entities.length >= targetState.garrisonHolder.capacity) 233 tooltip = "[color=\"orange\"]" + tooltip + "[/color]"; 230 234 } 231 235 else if (targetState.resourceSupply) 232 236 { … … 311 315 case "garrison": 312 316 if (hasClass(entState, "Unit") && targetState.garrisonHolder && (playerOwned || mutualAllyOwned)) 313 317 { 318 var tooltip = "Current garrison: " + targetState.garrisonHolder.entities.length 319 + "/" + targetState.garrisonHolder.capacity; 320 if (targetState.garrisonHolder.entities.length >= targetState.garrisonHolder.capacity) 321 tooltip = "[color=\"orange\"]" + tooltip + "[/color]"; 314 322 var allowedClasses = targetState.garrisonHolder.allowedClasses; 315 323 for each (var unitClass in entState.identity.classes) 316 324 { 317 325 if (allowedClasses.indexOf(unitClass) != -1) 318 326 { 319 return {"possible": true };327 return {"possible": true, "tooltip": tooltip}; 320 328 } 321 329 } 322 330 } … … 460 468 target = targets[0]; 461 469 } 462 470 471 var actionInfo = undefined; 463 472 if (preSelectedAction != ACTION_NONE) 464 473 { 465 474 switch (preSelectedAction) 466 475 { 467 476 case ACTION_GARRISON: 468 if ( getActionInfo("garrison", target).possible)469 return {"type": "garrison", "cursor": "action-garrison", "t arget": target};477 if ((actionInfo = getActionInfo("garrison", target)).possible) 478 return {"type": "garrison", "cursor": "action-garrison", "tooltip": actionInfo.tooltip, "target": target}; 470 479 else 471 return 480 return {"type": "none", "cursor": "action-garrison-disabled", "target": undefined}; 472 481 break; 473 482 case ACTION_REPAIR: 474 483 if (getActionInfo("repair", target).possible) … … 482 491 { 483 492 return {"type": "attack", "cursor": "action-attack", "target": target}; 484 493 } 485 else if (Engine.HotkeyIsPressed("session.garrison") && getActionInfo("garrison", target).possible)494 else if (Engine.HotkeyIsPressed("session.garrison") && (actionInfo = getActionInfo("garrison", target)).possible) 486 495 { 487 return {"type": "garrison", "cursor": "action-garrison", "t arget": target};496 return {"type": "garrison", "cursor": "action-garrison", "tooltip": actionInfo.tooltip, "target": target}; 488 497 } 489 498 else if (Engine.HotkeyIsPressed("session.attackmove") && getActionInfo("attack-move", target).possible) 490 499 { … … 492 501 } 493 502 else 494 503 { 495 var actionInfo = undefined;496 504 if ((actionInfo = getActionInfo("setup-trade-route", target)).possible) 497 505 return {"type": "setup-trade-route", "cursor": "action-setup-trade-route", "tooltip": actionInfo.tooltip, "target": target}; 498 506 else if ((actionInfo = getActionInfo("gather", target)).possible)