Fix batch not stopped when using the spawn cheat.
Reported and tested by @Langbart. Differential revision: https://code.wildfiregames.com/D4939 Fixes #6739 This was SVN commit r27549.
This commit is contained in:
parent
f7193ed595
commit
189fc18251
@ -199,6 +199,14 @@ Trainer.prototype.Item.prototype.Finish = function()
|
||||
this.finished = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean} -
|
||||
*/
|
||||
Trainer.prototype.Item.prototype.IsFinished = function()
|
||||
{
|
||||
return !!this.finished;
|
||||
};
|
||||
|
||||
/*
|
||||
* This function creates the entities and places them in world if possible
|
||||
* (some of these entities may be garrisoned directly if autogarrison, the others are spawned).
|
||||
@ -682,7 +690,7 @@ Trainer.prototype.Progress = function(id, allocatedTime)
|
||||
{
|
||||
const item = this.queue.get(id);
|
||||
const usedTime = item.Progress(allocatedTime);
|
||||
if (item.finished)
|
||||
if (item.IsFinished())
|
||||
this.queue.delete(id);
|
||||
return usedTime;
|
||||
};
|
||||
|
@ -83,7 +83,8 @@ function Cheat(input)
|
||||
const batch = new cmpTrainer.Item(input.templates[i % input.templates.length], 1, input.selected[0], null);
|
||||
batch.player = owner;
|
||||
batch.Finish();
|
||||
// ToDo: If not able to spawn, cancel the batch.
|
||||
if (!batch.IsFinished())
|
||||
batch.Stop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user