Save standings by faction, not by list position

RunSave.Capture wrote Factions in HomeZones key order and Relationships in
galaxy.Factions order; Galaxy's save constructor paired them by index, so a
galaxy whose two orders differed resumed with standings on the wrong factions.
SavedGame.Standings (Key 16) now carries each standing with its faction ref.
A save without it still reads Relationships by index, the only record it holds.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Nibu 2026-11-07 11:55:50 +00:00
commit 65a6297aee
3 changed files with 76 additions and 9 deletions

View file

@ -58,10 +58,14 @@ public class Galaxy
Seed = savedGame.Seed;
Factions = savedGame.Factions.Select(faction => cultCache.Get(faction)).ToArray();
for (var i = 0; i < Factions.Length; i++)
{
FactionRelationships[Factions[i]] = savedGame.Relationships[i];
}
if (savedGame.Standings != null)
foreach (var standing in savedGame.Standings)
FactionRelationships[cultCache.Get(standing.Faction)] = standing.Relationship;
else
// A save before Standings wrote Relationships in an order it did not record; it is right only for a
// galaxy that never reordered, and is all that save holds.
for (var i = 0; i < Factions.Length; i++)
FactionRelationships[Factions[i]] = savedGame.Relationships[i];
var savedZones = savedGame.Zones.Select(zone => cultCache.Get(zone)).ToArray();
Zones = savedZones.Select(zone =>