2026-10-18 17:30:50 +02:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using GameCult.Caching;
|
|
|
|
|
|
|
|
|
|
// A fixture's run at a fixed seed, restored as Continue restores it: one zone, committed through RunSave.Commit and
|
|
|
|
|
// read back by the Galaxy save constructor, so a test's galaxy carries the seed the way a real run's does.
|
|
|
|
|
internal static class RunSeedFixture
|
|
|
|
|
{
|
|
|
|
|
public static Galaxy Continue(CultCache cache, string zoneName, uint seed)
|
|
|
|
|
{
|
|
|
|
|
var game = new SavedGame
|
|
|
|
|
{
|
Retire the prelude and the tutorial: the cast, the scenario and the save own what they bundled
Galaxy.IsPrelude, SavedGame.IsTutorial (key 11 retired), TutorialGalaxy, TutorialGenerationSettings, its Settings.asset block and the
dead GalaxyStage/Galaxy constructor parameters (PlayerSettings, narrative directory) are gone. The rules they bundled move to their
owners: GalaxyCast.InfluenceScale (demo and test cast .5, main 1) carried by Galaxy and saved as SavedGame key 17, so a pre-cut run is
refused at Continue with a message; Scenario.EntranceStation (MainGalaxy false) decides the forced entrance station instead of the
galaxy; GalaxyStage.Cast(cast) replaces Prelude. The six arenas that read the authored cast generate DemoTerminus.Cast; Development
lists only Main Galaxy. TutorialBackgroundSettings is renamed CastBackgroundSettings in the asset YAML. Tests build their galaxy from
TestCasts.Wide and Background, the retired block's values, so every test galaxy is unchanged.
Suite at 8b2d1f544: 4 red (font credits, chunk info, trojan swarm, two-ai digest, Windows). After: the same 4, digest unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-19 20:14:26 +01:00
|
|
|
InfluenceScale = 1,
|
2026-10-18 17:30:50 +02:00
|
|
|
Seed = seed,
|
|
|
|
|
Factions = new CultRecordRef<Faction>[0],
|
|
|
|
|
Relationships = new FactionRelationship[0],
|
|
|
|
|
HomeZones = new Dictionary<int, int>(),
|
|
|
|
|
BossZones = new Dictionary<int, int>(),
|
|
|
|
|
DiscoveredZones = new[] { 0 },
|
|
|
|
|
ActionBarBindings = new SavedActionBarBinding[0],
|
|
|
|
|
Entrance = 0,
|
|
|
|
|
Exit = -1
|
|
|
|
|
};
|
|
|
|
|
var zone = new SavedZone { Name = zoneName, AdjacentZones = new int[0], Factions = new int[0], Owner = -1 };
|
|
|
|
|
RunSave.Commit(cache, game, new[] { zone }, new ProvenanceLedger());
|
|
|
|
|
return new Galaxy(cache, cache.GetGlobal<SavedGame>(), _ => { });
|
|
|
|
|
}
|
|
|
|
|
}
|