Fix map importer
This commit is contained in:
@@ -251,7 +251,7 @@ namespace OpenRA.Editor
|
|||||||
Map.MapResources[i, j] = new TileReference<byte, byte>(res.First, res.Second);
|
Map.MapResources[i, j] = new TileReference<byte, byte>(res.First, res.Second);
|
||||||
|
|
||||||
if (o != 255 && overlayActorMapping.ContainsKey(raOverlayNames[o]))
|
if (o != 255 && overlayActorMapping.ContainsKey(raOverlayNames[o]))
|
||||||
Map.Actors.Add("Actor" + ActorCount,
|
Map.Actors.Add("Actor" + ActorCount++,
|
||||||
new ActorReference(overlayActorMapping[raOverlayNames[o]])
|
new ActorReference(overlayActorMapping[raOverlayNames[o]])
|
||||||
{
|
{
|
||||||
new LocationInit( new int2(i, j) ),
|
new LocationInit( new int2(i, j) ),
|
||||||
@@ -269,7 +269,7 @@ namespace OpenRA.Editor
|
|||||||
foreach (KeyValuePair<string, string> kv in terrain)
|
foreach (KeyValuePair<string, string> kv in terrain)
|
||||||
{
|
{
|
||||||
var loc = int.Parse(kv.Key);
|
var loc = int.Parse(kv.Key);
|
||||||
Map.Actors.Add("Actor" + ActorCount,
|
Map.Actors.Add("Actor" + ActorCount++,
|
||||||
new ActorReference(kv.Value.ToLowerInvariant())
|
new ActorReference(kv.Value.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
||||||
@@ -315,7 +315,7 @@ namespace OpenRA.Editor
|
|||||||
Map.MapResources[cell.X, cell.Y] = new TileReference<byte, byte>(res.First, res.Second);
|
Map.MapResources[cell.X, cell.Y] = new TileReference<byte, byte>(res.First, res.Second);
|
||||||
|
|
||||||
if (overlayActorMapping.ContainsKey(kv.Value.ToLower()))
|
if (overlayActorMapping.ContainsKey(kv.Value.ToLower()))
|
||||||
Map.Actors.Add("Actor" + ActorCount,
|
Map.Actors.Add("Actor" + ActorCount++,
|
||||||
new ActorReference(overlayActorMapping[kv.Value.ToLower()])
|
new ActorReference(overlayActorMapping[kv.Value.ToLower()])
|
||||||
{
|
{
|
||||||
new LocationInit(cell),
|
new LocationInit(cell),
|
||||||
@@ -333,7 +333,7 @@ namespace OpenRA.Editor
|
|||||||
foreach (KeyValuePair<string, string> kv in terrain)
|
foreach (KeyValuePair<string, string> kv in terrain)
|
||||||
{
|
{
|
||||||
var loc = int.Parse(kv.Key);
|
var loc = int.Parse(kv.Key);
|
||||||
Map.Actors.Add("Actor" + ActorCount,
|
Map.Actors.Add("Actor" + ActorCount++,
|
||||||
new ActorReference(kv.Value.Split(',')[0].ToLowerInvariant())
|
new ActorReference(kv.Value.Split(',')[0].ToLowerInvariant())
|
||||||
{
|
{
|
||||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
||||||
@@ -351,7 +351,7 @@ namespace OpenRA.Editor
|
|||||||
var loc = int.Parse(parts[3]);
|
var loc = int.Parse(parts[3]);
|
||||||
if (parts[0] == "")
|
if (parts[0] == "")
|
||||||
parts[0] = "Neutral";
|
parts[0] = "Neutral";
|
||||||
Map.Actors.Add("Actor" + ActorCount,
|
Map.Actors.Add("Actor" + ActorCount++,
|
||||||
new ActorReference(parts[1].ToLowerInvariant())
|
new ActorReference(parts[1].ToLowerInvariant())
|
||||||
{
|
{
|
||||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace OpenRA.FileFormats
|
namespace OpenRA.FileFormats
|
||||||
{
|
{
|
||||||
@@ -22,6 +23,9 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
public ActorReference( string type, Dictionary<string, MiniYaml> inits )
|
public ActorReference( string type, Dictionary<string, MiniYaml> inits )
|
||||||
{
|
{
|
||||||
|
if (!Rules.Info.ContainsKey(type))
|
||||||
|
throw new InvalidDataException("Unknown actor: `{0}'".F(type));
|
||||||
|
|
||||||
Type = type;
|
Type = type;
|
||||||
InitDict = new TypeDictionary();
|
InitDict = new TypeDictionary();
|
||||||
foreach( var i in inits )
|
foreach( var i in inits )
|
||||||
|
|||||||
Reference in New Issue
Block a user