Ticket #1659: queuecapacitytweak3.diff
File queuecapacitytweak3.diff, 5.1 KB (added by , 12 years ago) |
---|
-
binaries/data/mods/public/gui/session/unit_commands.js
322 322 break; 323 323 324 324 case QUEUE: 325 var slider = getGUIObjectByName("unit"+guiName+"ProgressSlider["+i+"]"); 326 var lamp = getGUIObjectByName("unit"+guiName+"ProgressLamp["+i+"]"); 325 327 var tooltip = getEntityNames(template); 328 if (item.slots < 0) { 329 tooltip += "\nInsufficient population capacity: [color=\"red\"]"+Math.abs(item.slots)+"[/color]"; 330 // When training is blocked, flash icon (alternates colour every 500msec) 331 if (g_IsTrainingBlocked && (Date.now() % 1000) < 500) 332 { 333 slider.hidden = true; 334 lamp.hidden = false; //POPULATION_ALERT_COLOR 335 } 336 else 337 { 338 slider.hidden = true; 339 lamp.hidden = true; //DEFAULT_POPULATION_COLOR 340 } 341 } 342 else 343 { 344 slider.hidden = false; 345 lamp.hidden = true; 346 } 347 326 348 var progress = Math.round(item.progress*100) + "%"; 327 349 getGUIObjectByName("unit"+guiName+"Count["+i+"]").caption = (item.count > 1 ? item.count : ""); 328 350 -
binaries/data/mods/public/gui/session/session.js
271 271 // Update music state 272 272 global.music.updateTimer(); 273 273 274 // When training is blocked, flash population (alternates colour every 500msec)275 if (g_IsTrainingBlocked && (Date.now() % 1000) < 500)276 getGUIObjectByName("resourcePop").textcolor = POPULATION_ALERT_COLOR;277 else278 getGUIObjectByName("resourcePop").textcolor = DEFAULT_POPULATION_COLOR;279 280 274 // Clear renamed entities list 281 275 Engine.GuiInterfaceCall("ClearRenamedEntities"); 282 276 } … … 450 444 getGUIObjectByName("resourcePop").caption = playerState.popCount + "/" + playerState.popLimit; 451 445 452 446 g_IsTrainingBlocked = playerState.trainingBlocked; 447 448 // When training is blocked, flash population (alternates colour every 500msec) 449 if (g_IsTrainingBlocked && (Date.now() % 1000) < 500) 450 getGUIObjectByName("resourcePop").textcolor = POPULATION_ALERT_COLOR; 451 else 452 getGUIObjectByName("resourcePop").textcolor = DEFAULT_POPULATION_COLOR; 453 453 } 454 454 455 455 function selectAndMoveTo(ent) -
binaries/data/mods/public/gui/session/session.xml
894 894 <object name="unitQueueButton[n]" hidden="true" style="iconButton" type="button" size="0 0 40 40" tooltip_style="sessionToolTipBottom"> 895 895 <object name="unitQueueIcon[n]" ghost="true" type="image" size="3 3 37 37"/> 896 896 <object name="unitQueueProgressSlider[n]" type="image" sprite="queueProgressSlider" ghost="true" size="3 3 37 37" z="20"/> 897 <object name="unitQueueProgressLamp[n]" type="image" sprite="colour: 255 165 0 128" ghost="true" size="3 3 37 37" z="20"/> 897 898 <object name="unitQueueCount[n]" ghost="true" style="groupIconsText" type="text" z="20"/> 898 899 </object> 899 900 </repeat> -
binaries/data/mods/public/simulation/components/ProductionQueue.js
353 353 "unitTemplate": item.unitTemplate, 354 354 "technologyTemplate": item.technologyTemplate, 355 355 "count": item.count, 356 "slots": item.slots, 356 357 "progress": 1-(item.timeRemaining/item.timeTotal), 357 358 "metadata": item.metadata, 358 359 }); … … 506 507 { 507 508 // Batch's training hasn't started yet. 508 509 // Try to reserve the necessary population slots 509 if (item.unitTemplate && !cmpPlayer.TryReservePopulationSlots(item.population * item.count)) 510 item.slots = cmpPlayer.TryReservePopulationSlots(item.population * item.count); 511 if (item.unitTemplate && item.slots < 0) 510 512 { 511 513 // No slots available - don't train this batch now 512 514 // (we'll try again on the next timeout) -
binaries/data/mods/public/simulation/components/Player.js
73 73 return this.colour; 74 74 }; 75 75 76 // Try reserving num population slots. Returns num if successful or the inverse of the number of missing slots if failed. 76 77 Player.prototype.TryReservePopulationSlots = function(num) 77 78 { 78 79 if (num != 0 && num > (this.GetPopulationLimit() - this.GetPopulationCount())) 79 return false;80 return (this.GetPopulationLimit() - this.GetPopulationCount()) - num; 80 81 81 82 this.popUsed += num; 82 return true;83 return num; 83 84 }; 84 85 85 86 Player.prototype.UnReservePopulationSlots = function(num)