Place names: one validity rule (FactionPlace.IsValidName) for NamePlaces and the place-names command

NamePlaces treats an invalid entry as absent; the command refuses a table holding one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 22:14:22 +02:00
commit ac259c6259
3 changed files with 8 additions and 5 deletions

View file

@ -358,7 +358,7 @@ public class Galaxy
foreach (var faction in Factions)
{
if (!HomeZones.TryGetValue(faction, out var home)) continue;
var places = (faction.Places ?? Array.Empty<FactionPlace>()).Select(p => p?.Name).Where(n => !string.IsNullOrEmpty(n)).ToArray();
var places = (faction.Places ?? Array.Empty<FactionPlace>()).Select(p => p?.Name).Where(FactionPlace.IsValidName).ToArray();
var next = 0;
var owned = Zones.Select((zone, index) => (zone, index)).Where(z => z.zone.Owner == faction)
.OrderBy(z => z.zone.Distance[home]).ThenBy(z => z.index);