Create valid maps for custom tilesets
This commit is contained in:
@@ -362,13 +362,12 @@ namespace OpenRA.Editor
|
||||
|
||||
if (DialogResult.OK == nmd.ShowDialog())
|
||||
{
|
||||
var map = new Map();
|
||||
var map = new Map(nmd.theater.SelectedItem as string);
|
||||
|
||||
map.Resize((int)nmd.width.Value, (int)nmd.height.Value);
|
||||
|
||||
map.TopLeft = new int2((int)nmd.cordonLeft.Value, (int)nmd.cordonTop.Value);
|
||||
map.BottomRight = new int2((int)nmd.cordonRight.Value, (int)nmd.cordonBottom.Value);
|
||||
map.Tileset = nmd.theater.SelectedItem as string;
|
||||
map.Players.Add("Neutral", new PlayerReference("Neutral", Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race, true, true));
|
||||
NewMap(map);
|
||||
}
|
||||
|
||||
@@ -62,14 +62,22 @@ namespace OpenRA
|
||||
public Rectangle Bounds { get { return Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y); } }
|
||||
|
||||
public Map()
|
||||
{
|
||||
// Do nothing; not a valid map (editor hack)
|
||||
}
|
||||
|
||||
public Map(string tileset)
|
||||
{
|
||||
MapSize = new int2(1, 1);
|
||||
Tileset = tileset;
|
||||
MapResources = new TileReference<byte, byte>[1, 1];
|
||||
MapTiles = new TileReference<ushort, byte>[1, 1]
|
||||
{ { new TileReference<ushort, byte> {
|
||||
type = (ushort)0xffffu,
|
||||
image = (byte)0xffu,
|
||||
index = (byte)0xffu } } };
|
||||
|
||||
var tile = OpenRA.Rules.TileSets[Tileset].Templates.First();
|
||||
MapTiles = new TileReference<ushort, byte>[1, 1]
|
||||
{ { new TileReference<ushort, byte> {
|
||||
type = tile.Key,
|
||||
image = (byte)(tile.Value.PickAny ? 0xffu : 0),
|
||||
index = (byte)(tile.Value.PickAny ? 0xffu : 0) } } };
|
||||
|
||||
PlayerCount = 0;
|
||||
TopLeft = new int2(0, 0);
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
899fa73ce1ffd82799e84b63256930514db5e048
|
||||
1e36d6874ef7960ac0e21edf36bbe1490a4650eb
|
||||
@@ -32,27 +32,11 @@ Players:
|
||||
InitialCash: 0
|
||||
Allies:
|
||||
Enemies:
|
||||
PlayerReference@Multi0:
|
||||
Name: Multi0
|
||||
Palette:
|
||||
Race: Random
|
||||
OwnsWorld: False
|
||||
NonCombatant: False
|
||||
Playable: True
|
||||
DefaultStartingUnits: True
|
||||
Color: 255,238,238,238
|
||||
Color2: 255,44,28,24
|
||||
InitialCash: 0
|
||||
Allies:
|
||||
Enemies:
|
||||
|
||||
Actors:
|
||||
Actor0: mcv
|
||||
Location: 16,17
|
||||
Owner: Neutral
|
||||
|
||||
Waypoints:
|
||||
wp0: 18,18
|
||||
wp0: 20,20
|
||||
|
||||
Smudges:
|
||||
|
||||
|
||||
@@ -33,5 +33,5 @@ TileSets:
|
||||
Music:
|
||||
Movies:
|
||||
LoadScreen: NullLoadScreen
|
||||
ShellmapUid:899fa73ce1ffd82799e84b63256930514db5e048
|
||||
ShellmapUid:1e36d6874ef7960ac0e21edf36bbe1490a4650eb
|
||||
TileSize:32
|
||||
|
||||
@@ -14,13 +14,6 @@ Terrain:
|
||||
Color: 255,255,255,255
|
||||
|
||||
Templates:
|
||||
Template@65535:
|
||||
Id: 65535
|
||||
Image: t00
|
||||
Size: 1,1
|
||||
PickAny: False
|
||||
Tiles:
|
||||
0: Clear
|
||||
Template@0:
|
||||
Id: 0
|
||||
Image: t00
|
||||
|
||||
Reference in New Issue
Block a user