Lazy actor loading

This commit is contained in:
Paul Chote
2011-02-11 21:35:37 +13:00
parent c2db816837
commit 79f3fccceb
5 changed files with 41 additions and 30 deletions

View File

@@ -30,12 +30,12 @@ namespace OpenRA.Editor
public void Apply(Surface surface)
{
if (surface.Map.Actors.Any(a => a.Value.Location() == surface.GetBrushLocation()))
if (surface.Map.Actors.Value.Any(a => a.Value.Location() == surface.GetBrushLocation()))
return;
var owner = "Neutral";
var id = NextActorName(surface);
surface.Map.Actors[id] = new ActorReference(Actor.Info.Name.ToLowerInvariant())
surface.Map.Actors.Value[id] = new ActorReference(Actor.Info.Name.ToLowerInvariant())
{
new LocationInit( surface.GetBrushLocation() ),
new OwnerInit( owner)
@@ -48,7 +48,7 @@ namespace OpenRA.Editor
for (; ; )
{
var possible = "Actor{0}".F(id++);
if (!surface.Map.Actors.ContainsKey(possible)) return possible;
if (!surface.Map.Actors.Value.ContainsKey(possible)) return possible;
}
}
}