From 4a7be2e0c8029d05b4350fe2d37e6b85ee97cde4 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 11 Feb 2011 19:24:21 +1300 Subject: [PATCH] Remove redundant MapStub fields. --- OpenRA.FileFormats/Map/MapStub.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/OpenRA.FileFormats/Map/MapStub.cs b/OpenRA.FileFormats/Map/MapStub.cs index cc66907f10..50c0654ecb 100644 --- a/OpenRA.FileFormats/Map/MapStub.cs +++ b/OpenRA.FileFormats/Map/MapStub.cs @@ -41,26 +41,25 @@ namespace OpenRA.FileFormats public IEnumerable SpawnPoints{ get { return Waypoints.Where(kv => StartPoints.Contains(kv.Key)).Select(kv => kv.Value); } } [FieldLoader.Load] public Rectangle Bounds; - - // TODO: Remove these once we stop supporting MapFormat < 5 - [FieldLoader.Load] public int2 TopLeft; - [FieldLoader.Load] public int2 BottomRight; - + public MapStub() {} // Hack for the editor - not used for anything important public MapStub(string path) { Path = path; Container = FileSystem.OpenPackage(path, int.MaxValue); - var yaml = MiniYaml.FromStream(Container.GetContent("map.yaml")); - FieldLoader.Load( this, new MiniYaml( null, yaml ) ); + var yaml = new MiniYaml( null, MiniYaml.FromStream(Container.GetContent("map.yaml")) ); + FieldLoader.Load(this, yaml); Uid = ComputeHash(); // Upgrade maps to define StartPoints if (MapFormat < 5) { + StartPoints = Waypoints.Select(kv => kv.Key).ToArray(); + var TopLeft = (int2)FieldLoader.GetValue( "", typeof(int2), yaml.NodesDict["TopLeft"].Value); + var BottomRight = (int2)FieldLoader.GetValue( "", typeof(int2), yaml.NodesDict["BottomRight"].Value); Bounds = Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y); } }