CellIsEvaluating perf optimization

If an actor has Mobile, it implements IOccupySpace
so we can use OccupiesSpace to save a trait look-up.
This commit is contained in:
reaperrr
2021-03-14 14:09:58 +01:00
committed by Paul Chote
parent 441e18b898
commit 75a3bb4f0b

View File

@@ -341,7 +341,7 @@ namespace OpenRA.Mods.Common.Activities
{ {
foreach (var actor in self.World.ActorMap.GetActorsAt(cell)) foreach (var actor in self.World.ActorMap.GetActorsAt(cell))
{ {
var move = actor.TraitOrDefault<Mobile>(); var move = actor.OccupiesSpace as Mobile;
if (move == null || !move.IsTraitEnabled() || !move.IsLeaving()) if (move == null || !move.IsTraitEnabled() || !move.IsLeaving())
return false; return false;
} }