Simplify editor/importer map creation.
This commit is contained in:
@@ -143,21 +143,17 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var width = Exts.ParseIntegerInvariant(mapSection.GetValue("Width", "0"));
|
||||
var height = Exts.ParseIntegerInvariant(mapSection.GetValue("Height", "0"));
|
||||
mapSize = (legacyMapFormat == IniMapFormat.RedAlert) ? 128 : 64;
|
||||
var size = new Size(mapSize, mapSize);
|
||||
|
||||
var tileset = Truncate(mapSection.GetValue("Theater", "TEMPERAT"), 8);
|
||||
map = Map.FromTileset(rules.TileSets[tileset]);
|
||||
map.Title = basic.GetValue("Name", Path.GetFileNameWithoutExtension(iniFile));
|
||||
map.Author = "Westwood Studios";
|
||||
map.MapSize = new int2(mapSize, mapSize);
|
||||
map.Bounds = Rectangle.FromLTRB(offsetX, offsetY, offsetX + width, offsetY + height);
|
||||
map = new Map(rules.TileSets[tileset], mapSize, mapSize)
|
||||
{
|
||||
Title = basic.GetValue("Name", Path.GetFileNameWithoutExtension(iniFile)),
|
||||
Author = "Westwood Studios"
|
||||
};
|
||||
|
||||
map.MapResources = Exts.Lazy(() => new CellLayer<ResourceTile>(TileShape.Rectangle, size));
|
||||
map.MapTiles = Exts.Lazy(() => new CellLayer<TerrainTile>(TileShape.Rectangle, size));
|
||||
|
||||
map.Videos = new MapVideos();
|
||||
|
||||
map.Options = new MapOptions();
|
||||
var tl = new MPos(offsetX, offsetY);
|
||||
var br = new MPos(offsetX + width - 1, offsetY + height - 1);
|
||||
map.SetBounds(tl, br);
|
||||
|
||||
if (legacyMapFormat == IniMapFormat.RedAlert)
|
||||
{
|
||||
|
||||
@@ -51,9 +51,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
panel.Get<ButtonWidget>("CREATE_BUTTON").OnClick = () =>
|
||||
{
|
||||
var tileset = modRules.TileSets[tilesetDropDown.Text];
|
||||
var map = Map.FromTileset(tileset);
|
||||
|
||||
int width, height;
|
||||
int.TryParse(widthTextField.Text, out width);
|
||||
int.TryParse(heightTextField.Text, out height);
|
||||
@@ -63,7 +60,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
width = Math.Max(2, width);
|
||||
height = Math.Max(2, height);
|
||||
|
||||
map.Resize(width + 2, height + tileset.MaxGroundHeight + 2);
|
||||
var tileset = modRules.TileSets[tilesetDropDown.Text];
|
||||
var map = new Map(tileset, width + 2, height + tileset.MaxGroundHeight + 2);
|
||||
|
||||
var tl = new MPos(1, 1);
|
||||
var br = new MPos(width, height + tileset.MaxGroundHeight);
|
||||
|
||||
Reference in New Issue
Block a user