mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-09 00:15:48 -07:00
When adding a batch of unit, these in-training units get added to the production queue and to the entity limit count. These in-training units need to be removed from the entity limit counts when spawning them, or we would be double-counting them. This was done when creating the cached entities, but this was too early: entities might fail to spawn, for example when there is no room around the foundation. Change that so the entity limit count is now decremented right before giving spawned entities the correct owner (which triggers EntityLimits OnGlobalOwnershipChanged, which adds the spawned entities to the entity limit count). Additionally, add Init to TrainingRestrictions so that the test setup doesn't complain. Other components have an empty Init instead of checking for Init in the test setup (and 61/67 have an Init function) so it seems more standard this way. Reported By: elexis Reviewed By: wraitii Patch By: Angen Tests By: wraitii Differential Revision: https://code.wildfiregames.com/D1879 This was SVN commit r22375.
25 lines
778 B
JavaScript
25 lines
778 B
JavaScript
function TrainingRestrictions() {}
|
|
|
|
TrainingRestrictions.prototype.Schema =
|
|
"<a:help>Specifies unit training restrictions, currently only unit category</a:help>" +
|
|
"<a:example>" +
|
|
"<TrainingRestrictions>" +
|
|
"<Category>Hero</Category>" +
|
|
"</TrainingRestrictions>" +
|
|
"</a:example>" +
|
|
"<element name='Category' a:help='Specifies the category of this unit, for satisfying special constraints. Choices include: Hero, Juggernaut, WarDog'>" +
|
|
"<text/>" +
|
|
"</element>";
|
|
|
|
TrainingRestrictions.prototype.Init = function()
|
|
{
|
|
};
|
|
|
|
TrainingRestrictions.prototype.Serialize = null;
|
|
|
|
TrainingRestrictions.prototype.GetCategory = function()
|
|
{
|
|
return this.template.Category;
|
|
};
|
|
|
|
Engine.RegisterComponentType(IID_TrainingRestrictions, "TrainingRestrictions", TrainingRestrictions);
|