forked from 0ad/0ad
Fix qBot infinite loop due to NaN priorities
This was SVN commit r11684.
This commit is contained in:
parent
97bcdfb208
commit
7c93499c7d
@ -11,7 +11,7 @@ var EconomyManager = function() {
|
||||
};
|
||||
// More initialisation for stuff that needs the gameState
|
||||
EconomyManager.prototype.init = function(gameState){
|
||||
this.targetNumWorkers = Math.floor(gameState.getPopulationMax()/3);
|
||||
this.targetNumWorkers = Math.max(Math.floor(gameState.getPopulationMax()/3), 1);
|
||||
};
|
||||
|
||||
EconomyManager.prototype.trainMoreWorkers = function(gameState, queues) {
|
||||
|
@ -196,6 +196,14 @@ QueueManager.prototype.printQueues = function(gameState){
|
||||
};
|
||||
|
||||
QueueManager.prototype.update = function(gameState) {
|
||||
|
||||
for (var i in this.priorities){
|
||||
if (!(this.priorities[i] > 0)){
|
||||
this.priorities[i] = 1; // TODO: make the Queue Manager not die when priorities are zero.
|
||||
warn("QueueManager received bad priorities, please report this error: " + uneval(this.priorities));
|
||||
}
|
||||
}
|
||||
|
||||
Engine.ProfileStart("Queue Manager");
|
||||
//this.printQueues(gameState);
|
||||
|
||||
@ -259,12 +267,12 @@ QueueManager.prototype.update = function(gameState) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.affordableToOutQueue(gameState);
|
||||
} while (this.curItemQueue.length === 0);
|
||||
Engine.ProfileStop();
|
||||
|
||||
Engine.ProfileStart("Execute items");
|
||||
|
||||
// Handle output queues by executing items where possible
|
||||
for (p in this.queues) {
|
||||
while (this.queues[p].outQueueLength() > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user