From b887e0133424250926a7d8f5bc0a436d679fe5ea Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Mon, 12 Aug 2024 10:59:48 -0700 Subject: [PATCH] Eliminate RootSeason field --- MultiversalDiplomacy/Model/World.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/MultiversalDiplomacy/Model/World.cs b/MultiversalDiplomacy/Model/World.cs index 965bace..80bc62b 100644 --- a/MultiversalDiplomacy/Model/World.cs +++ b/MultiversalDiplomacy/Model/World.cs @@ -32,7 +32,7 @@ public class World /// /// The first season of the game. /// - public Season RootSeason { get; } + public Season RootSeason => GetSeason("a", 0); /// /// All units in the multiverse. @@ -60,7 +60,6 @@ public class World private World( Map map, ReadOnlyCollection seasons, - Season rootSeason, ReadOnlyCollection units, ReadOnlyCollection retreatingUnits, ReadOnlyDictionary orderHistory, @@ -68,7 +67,6 @@ public class World { this.Map = map; this.Seasons = seasons; - this.RootSeason = rootSeason; this.Units = units; this.RetreatingUnits = retreatingUnits; this.OrderHistory = orderHistory; @@ -88,7 +86,6 @@ public class World : this( previous.Map, seasons ?? previous.Seasons, - previous.RootSeason, // Can't change the root season units ?? previous.Units, retreatingUnits ?? previous.RetreatingUnits, orderHistory ?? previous.OrderHistory, @@ -101,13 +98,11 @@ public class World /// public static World WithMap(Map map) { - Season root = Season.MakeRoot(); return new World( map, - new(new List { root }), - root, - new(new List()), - new(new List()), + new([Season.MakeRoot()]), + new([]), + new([]), new(new Dictionary()), new Options()); } @@ -123,7 +118,7 @@ public class World IEnumerable? units = null, IEnumerable? retreats = null, IEnumerable>? orders = null) - => new World( + => new( previous: this, seasons: seasons == null ? this.Seasons