31 lines
984 B
C#
31 lines
984 B
C#
namespace NeonSprawl.Server.Game.PositionState;
|
|
|
|
/// <summary>Configured player ids seeded at host start (dev player + Bruno/manual QA fixtures).</summary>
|
|
public static class GamePlayerSeed
|
|
{
|
|
/// <summary>Distinct normalized player ids from <see cref="GamePositionOptions.DevPlayerId"/> and <see cref="GamePositionOptions.FixturePlayerIds"/>.</summary>
|
|
public static IReadOnlyList<string> GetSeedPlayerIds(GamePositionOptions options)
|
|
{
|
|
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
|
var list = new List<string>();
|
|
Add(options.DevPlayerId, seen, list);
|
|
foreach (var id in options.FixturePlayerIds)
|
|
{
|
|
Add(id, seen, list);
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
private static void Add(string? raw, HashSet<string> seen, List<string> list)
|
|
{
|
|
var t = raw?.Trim();
|
|
if (string.IsNullOrEmpty(t) || !seen.Add(t))
|
|
{
|
|
return;
|
|
}
|
|
|
|
list.Add(t);
|
|
}
|
|
}
|