fixes error with GetPosition2D called while out of world
This was SVN commit r15694.
This commit is contained in:
parent
5bfe2a4b65
commit
611d20016a
@ -521,7 +521,6 @@ ProductionQueue.prototype.OnDestroy = function()
|
||||
ProductionQueue.prototype.SpawnUnits = function(templateName, count, metadata)
|
||||
{
|
||||
var cmpFootprint = Engine.QueryInterface(this.entity, IID_Footprint);
|
||||
var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|
||||
var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
|
||||
var cmpRallyPoint = Engine.QueryInterface(this.entity, IID_RallyPoint);
|
||||
|
||||
|
@ -1264,9 +1264,10 @@ function GetFormationUnitAIs(ents, player, formationTemplate)
|
||||
var nonformedUnitAIs = [];
|
||||
for each (var ent in ents)
|
||||
{
|
||||
// Skip units with no UnitAI
|
||||
// Skip units with no UnitAI or no position
|
||||
var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI);
|
||||
if (!cmpUnitAI)
|
||||
var cmpPosition = Engine.QueryInterface(ent, IID_Position);
|
||||
if (!cmpUnitAI || !cmpPosition || !cmpPosition.IsInWorld())
|
||||
continue;
|
||||
|
||||
var cmpIdentity = Engine.QueryInterface(ent, IID_Identity);
|
||||
@ -1388,11 +1389,6 @@ function ClusterEntities(ents, separationDistance)
|
||||
matrix[i] = [];
|
||||
clusters.push([ents[i]]);
|
||||
var cmpPosition = Engine.QueryInterface(ents[i], IID_Position);
|
||||
if (!cmpPosition)
|
||||
{
|
||||
error("Asked to cluster entities without position: "+ents[i]);
|
||||
return clusters;
|
||||
}
|
||||
positions.push(cmpPosition.GetPosition2D());
|
||||
for (var j = 0; j < i; j++)
|
||||
matrix[i][j] = positions[i].distanceToSquared(positions[j]);
|
||||
|
Loading…
Reference in New Issue
Block a user