Remove ActorMap.ActorsInWorld.
Prefer the more direct and efficient query on World.Actors instead.
This commit is contained in:
@@ -559,10 +559,5 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Actor> ActorsInWorld()
|
|
||||||
{
|
|
||||||
return bins.SelectMany(bin => bin.Actors.Where(actor => actor.IsInWorld));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
static IEnumerable<Actor> SelectActorsInWorld(World world, IEnumerable<string> selectionClasses, Player player)
|
static IEnumerable<Actor> SelectActorsInWorld(World world, IEnumerable<string> selectionClasses, Player player)
|
||||||
{
|
{
|
||||||
return SelectActorsByOwnerAndSelectionClass(world.ActorMap.ActorsInWorld(), player, selectionClasses);
|
return SelectActorsByOwnerAndSelectionClass(world.Actors.Where(a => a.IsInWorld), player, selectionClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IEnumerable<Actor> SelectActorsByOwnerAndSelectionClass(IEnumerable<Actor> actors, Player owner, IEnumerable<string> selectionClasses)
|
static IEnumerable<Actor> SelectActorsByOwnerAndSelectionClass(IEnumerable<Actor> actors, Player owner, IEnumerable<string> selectionClasses)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out ai))
|
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out ai))
|
||||||
throw new LuaException("Unknown actor type '{0}'".F(type));
|
throw new LuaException("Unknown actor type '{0}'".F(type));
|
||||||
|
|
||||||
result.AddRange(Player.World.ActorMap.ActorsInWorld()
|
result.AddRange(Player.World.Actors
|
||||||
.Where(actor => actor.Owner == Player && !actor.IsDead && actor.IsInWorld && actor.Info.Name == ai.Name));
|
.Where(actor => actor.Owner == Player && !actor.IsDead && actor.IsInWorld && actor.Info.Name == ai.Name));
|
||||||
|
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user