Fix editor crash when modifying newly placed actor ID.
This commit is contained in:
@@ -283,5 +283,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
foreach (var preview in previewsForCell.Value)
|
foreach (var preview in previewsForCell.Value)
|
||||||
destinationBuffer.Add(Pair.New(previewsForCell.Key, preview.Owner.Color.RGB));
|
destinationBuffer.Add(Pair.New(previewsForCell.Key, preview.Owner.Color.RGB));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EditorActorPreview this[string id]
|
||||||
|
{
|
||||||
|
get { return previews.FirstOrDefault(p => p.ID.ToLowerInvariant() == id); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,8 +122,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var actorId = actorIDField.Text.ToLowerInvariant();
|
var actorId = actorIDField.Text.ToLowerInvariant();
|
||||||
if (CurrentActor.ID.ToLowerInvariant() != actorId)
|
if (CurrentActor.ID.ToLowerInvariant() != actorId)
|
||||||
{
|
{
|
||||||
var found = world.Map.ActorDefinitions.Any(x => x.Key.ToLowerInvariant() == actorId);
|
if (editorActorLayer[actorId] != null)
|
||||||
if (found)
|
|
||||||
{
|
{
|
||||||
nextActorIDStatus = ActorIDStatus.Duplicate;
|
nextActorIDStatus = ActorIDStatus.Duplicate;
|
||||||
return;
|
return;
|
||||||
@@ -143,8 +142,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void SetActorID(World world, string actorId)
|
void SetActorID(World world, string actorId)
|
||||||
{
|
{
|
||||||
var actorDef = world.Map.ActorDefinitions.First(x => x.Key == CurrentActor.ID);
|
|
||||||
actorDef.Key = actorId;
|
|
||||||
CurrentActor.ID = actorId;
|
CurrentActor.ID = actorId;
|
||||||
nextActorIDStatus = ActorIDStatus.Normal;
|
nextActorIDStatus = ActorIDStatus.Normal;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user