Remove redundant MapStub fields.
This commit is contained in:
@@ -42,25 +42,24 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
[FieldLoader.Load] public Rectangle Bounds;
|
[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() {} // Hack for the editor - not used for anything important
|
||||||
|
|
||||||
public MapStub(string path)
|
public MapStub(string path)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
Container = FileSystem.OpenPackage(path, int.MaxValue);
|
Container = FileSystem.OpenPackage(path, int.MaxValue);
|
||||||
var yaml = MiniYaml.FromStream(Container.GetContent("map.yaml"));
|
var yaml = new MiniYaml( null, MiniYaml.FromStream(Container.GetContent("map.yaml")) );
|
||||||
FieldLoader.Load( this, new MiniYaml( null, yaml ) );
|
FieldLoader.Load(this, yaml);
|
||||||
|
|
||||||
Uid = ComputeHash();
|
Uid = ComputeHash();
|
||||||
|
|
||||||
// Upgrade maps to define StartPoints
|
// Upgrade maps to define StartPoints
|
||||||
if (MapFormat < 5)
|
if (MapFormat < 5)
|
||||||
{
|
{
|
||||||
|
|
||||||
StartPoints = Waypoints.Select(kv => kv.Key).ToArray();
|
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);
|
Bounds = Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user