Ensure permanent identifiers.

This commit is contained in:
Ottermandias 2023-01-17 13:19:05 +01:00
parent 7bb5a1ebe3
commit 23919d8083
2 changed files with 6 additions and 4 deletions

View file

@ -25,7 +25,7 @@ public readonly struct ActorIdentifier : IEquatable<ActorIdentifier>
// @formatter:on
public ActorIdentifier CreatePermanent()
=> new(Type, Kind, Index, DataId, PlayerName.IsEmpty ? PlayerName : PlayerName.Clone());
=> new(Type, Kind, Index, DataId, PlayerName.IsEmpty || PlayerName.IsOwned ? PlayerName : PlayerName.Clone());
public bool Equals(ActorIdentifier other)
{

View file

@ -145,12 +145,14 @@ public sealed partial class IndividualCollections
return false;
}
_assignments.Add( ( displayName, identifiers, collection ) );
foreach( var identifier in identifiers )
for( var i = 0; i < identifiers.Length; ++i )
{
_individuals.Add( identifier, collection );
identifiers[ i ] = identifiers[ i ].CreatePermanent();
_individuals.Add( identifiers[ i ], collection );
}
_assignments.Add( ( displayName, identifiers, collection ) );
return true;
}