RunStartTests: the belt race takes the first arena that has a belt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 05:31:08 +02:00
commit 3ef0ac21eb

View file

@ -311,8 +311,14 @@ public sealed partial class RunStartTests : IDisposable
[Fact]
public void NoOrbitStandsStillAgainstItsParent()
{
var zone = Arena(false); // no ships: nothing but the zone runs
Assert.True(zone.AsteroidBelts.Count > 0, "the arena has an asteroid belt to race against");
// No ships: nothing but the zone runs. Belts are rarer than they were, so the first galaxy seed whose entrance holds one.
Zone zone = null;
for (uint seed = GalaxySeed; zone == null && seed < GalaxySeed + 60; seed++)
{
var (_, arena, _, _) = Launch(new Scripted(false, _ => { }, seed), Inputs());
if (arena.AsteroidBelts.Count > 0) zone = arena;
}
Assert.True(zone != null, "no arena of the first 60 seeds has an asteroid belt to race against");
float2 Relative(Orbit orbit, bool previous) =>
(previous ? orbit.PreviousPosition : orbit.Position) -
(zone.Orbits.TryGetValue(orbit.Data.Parent.Key, out var parent) ? previous ? parent.PreviousPosition : parent.Position : orbit.Data.FixedPosition);