diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs index e199fe07c7..77dc11c30d 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs @@ -283,5 +283,10 @@ namespace OpenRA.Mods.Common.Traits foreach (var preview in previewsForCell.Value) destinationBuffer.Add(Pair.New(previewsForCell.Key, preview.Owner.Color.RGB)); } + + public EditorActorPreview this[string id] + { + get { return previews.FirstOrDefault(p => p.ID.ToLowerInvariant() == id); } + } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs index 3fb6c68f07..d2453ad5dc 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs @@ -122,8 +122,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var actorId = actorIDField.Text.ToLowerInvariant(); if (CurrentActor.ID.ToLowerInvariant() != actorId) { - var found = world.Map.ActorDefinitions.Any(x => x.Key.ToLowerInvariant() == actorId); - if (found) + if (editorActorLayer[actorId] != null) { nextActorIDStatus = ActorIDStatus.Duplicate; return; @@ -143,8 +142,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic void SetActorID(World world, string actorId) { - var actorDef = world.Map.ActorDefinitions.First(x => x.Key == CurrentActor.ID); - actorDef.Key = actorId; CurrentActor.ID = actorId; nextActorIDStatus = ActorIDStatus.Normal; }