Merge pull request #10353 from Mailaender/resize-map

Added a resize map command
This commit is contained in:
Oliver Brakmann
2016-02-15 21:10:39 +01:00
3 changed files with 79 additions and 4 deletions

View File

@@ -838,7 +838,7 @@ namespace OpenRA
return delta.Yaw.Facing;
}
public void Resize(int width, int height) // editor magic.
public void Resize(int width, int height)
{
var oldMapTiles = MapTiles.Value;
var oldMapResources = MapResources.Value;
@@ -850,9 +850,10 @@ namespace OpenRA
MapHeight = Exts.Lazy(() => CellLayer.Resize(oldMapHeight, newSize, oldMapHeight[MPos.Zero]));
MapSize = new int2(newSize);
var tl = new MPos(0, 0).ToCPos(this);
var br = new MPos(MapSize.X - 1, MapSize.Y - 1).ToCPos(this);
AllCells = new CellRegion(Grid.Type, tl, br);
var tl = new MPos(0, 0);
var br = new MPos(MapSize.X - 1, MapSize.Y - 1);
AllCells = new CellRegion(Grid.Type, tl.ToCPos(this), br.ToCPos(this));
SetBounds(new PPos(tl.U + 1, tl.V + 1), new PPos(br.U - 1, br.V - 1));
}
public void SetBounds(PPos tl, PPos br)