Ticket #963: training_queue.diff
File training_queue.diff, 1.2 KB (added by , 13 years ago) |
---|
-
TrainingQueue.js
349 349 } 350 350 351 351 var numSpawned = this.SpawnUnits(item.template, item.count, item.metadata); 352 if (numSpawned > 0)352 if (numSpawned == item.count) 353 353 { 354 // This could be only partially finised354 // All entities spawned, this batch finished 355 355 cmpPlayer.UnReservePopulationSlots(item.population * numSpawned); 356 item.count -= numSpawned; 357 Engine.PostMessage(this.entity, MT_TrainingQueueChanged, { }); 358 } 359 360 if (item.count == 0) 361 { 362 // All entities spawned, this batch finished 356 item.count = 0; 357 363 358 time -= item.timeRemaining; 364 359 this.queue.shift(); 365 360 // Unset flag that training queue is blocked 366 361 cmpPlayer.UnBlockTrainingQueue(); 367 362 this.spawnNotified = false; 363 Engine.PostMessage(this.entity, MT_TrainingQueueChanged, { }); 368 364 } 365 366 else if (numSpawned > 0) 367 { 368 // Only partially finished 369 cmpPlayer.UnReservePopulationSlots(item.population * numSpawned); 370 item.count -= numSpawned; 371 Engine.PostMessage(this.entity, MT_TrainingQueueChanged, { }); 372 } 369 373 else 370 374 { 371 375 // Some entities failed to spawn