editor compiles again
This commit is contained in:
@@ -251,7 +251,12 @@ namespace OpenRA.Editor
|
||||
Map.MapResources[i, j] = new TileReference<byte, byte>(res.First, res.Second);
|
||||
|
||||
if (o != 255 && overlayActorMapping.ContainsKey(raOverlayNames[o]))
|
||||
Map.Actors.Add("Actor" + ActorCount, new ActorReference("Actor" + ActorCount++, overlayActorMapping[raOverlayNames[o]], new int2(i, j), "Neutral"));
|
||||
Map.Actors.Add("Actor" + ActorCount,
|
||||
new ActorReference(overlayActorMapping[raOverlayNames[o]])
|
||||
{
|
||||
new LocationInit( new int2(i, j) ),
|
||||
new OwnerInit( "Neutral" )
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +269,12 @@ namespace OpenRA.Editor
|
||||
foreach (KeyValuePair<string, string> kv in terrain)
|
||||
{
|
||||
var loc = int.Parse(kv.Key);
|
||||
Map.Actors.Add("Actor" + ActorCount, new ActorReference("Actor" + ActorCount++, kv.Value.ToLowerInvariant(), new int2(loc % MapSize, loc / MapSize), "Neutral"));
|
||||
Map.Actors.Add("Actor" + ActorCount,
|
||||
new ActorReference(kv.Value.ToLowerInvariant())
|
||||
{
|
||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
||||
new OwnerInit("Neutral")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +315,12 @@ namespace OpenRA.Editor
|
||||
Map.MapResources[cell.X, cell.Y] = new TileReference<byte, byte>(res.First, res.Second);
|
||||
|
||||
if (overlayActorMapping.ContainsKey(kv.Value.ToLower()))
|
||||
Map.Actors.Add("Actor" + ActorCount, new ActorReference("Actor" + ActorCount++, overlayActorMapping[kv.Value.ToLower()], new int2(cell.X, cell.Y), "Neutral"));
|
||||
Map.Actors.Add("Actor" + ActorCount,
|
||||
new ActorReference(overlayActorMapping[kv.Value.ToLower()])
|
||||
{
|
||||
new LocationInit(cell),
|
||||
new OwnerInit("Neutral")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +333,12 @@ namespace OpenRA.Editor
|
||||
foreach (KeyValuePair<string, string> kv in terrain)
|
||||
{
|
||||
var loc = int.Parse(kv.Key);
|
||||
Map.Actors.Add("Actor" + ActorCount, new ActorReference("Actor" + ActorCount++, kv.Value.Split(',')[0].ToLowerInvariant(), new int2(loc % MapSize, loc / MapSize), "Neutral"));
|
||||
Map.Actors.Add("Actor" + ActorCount,
|
||||
new ActorReference(kv.Value.Split(',')[0].ToLowerInvariant())
|
||||
{
|
||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
||||
new OwnerInit("Neutral")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +351,12 @@ namespace OpenRA.Editor
|
||||
var loc = int.Parse(parts[3]);
|
||||
if (parts[0] == "")
|
||||
parts[0] = "Neutral";
|
||||
Map.Actors.Add("Actor" + ActorCount, new ActorReference("Actor" + ActorCount++, parts[1].ToLowerInvariant(), new int2(loc % MapSize, loc / MapSize), parts[0]));
|
||||
Map.Actors.Add("Actor" + ActorCount,
|
||||
new ActorReference(parts[1].ToLowerInvariant())
|
||||
{
|
||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
||||
new OwnerInit(parts[0])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,15 +8,13 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Thirdparty;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
{
|
||||
@@ -215,7 +213,7 @@ namespace OpenRA.Editor
|
||||
Resource = null;
|
||||
Waypoint = null;
|
||||
|
||||
var key = Map.Actors.FirstOrDefault(a => a.Value.Location == GetBrushLocation());
|
||||
var key = Map.Actors.FirstOrDefault(a => a.Value.Location() == GetBrushLocation());
|
||||
if (key.Key != null) Map.Actors.Remove(key.Key);
|
||||
|
||||
if (Map.MapResources[GetBrushLocation().X, GetBrushLocation().Y].type != 0)
|
||||
@@ -257,12 +255,16 @@ namespace OpenRA.Editor
|
||||
|
||||
void DrawWithActor()
|
||||
{
|
||||
if (Map.Actors.Any(a => a.Value.Location == GetBrushLocation()))
|
||||
if (Map.Actors.Any(a => a.Value.Location() == GetBrushLocation()))
|
||||
return;
|
||||
|
||||
var owner = "Neutral";
|
||||
var id = NextActorName();
|
||||
Map.Actors[id] = new ActorReference(id,Actor.Info.Name.ToLowerInvariant(), GetBrushLocation(), owner);
|
||||
Map.Actors[id] = new ActorReference(Actor.Info.Name.ToLowerInvariant())
|
||||
{
|
||||
new LocationInit( GetBrushLocation() ),
|
||||
new OwnerInit( owner)
|
||||
};
|
||||
|
||||
AfterChange();
|
||||
}
|
||||
@@ -397,7 +399,7 @@ namespace OpenRA.Editor
|
||||
new Rectangle(Map.XOffset * 24 + Offset.X, Map.YOffset * 24 + Offset.Y, Map.Width * 24, Map.Height * 24));
|
||||
|
||||
foreach (var ar in Map.Actors)
|
||||
DrawActor(e.Graphics, ar.Value.Location, ActorTemplates[ar.Value.Type]);
|
||||
DrawActor(e.Graphics, ar.Value.Location(), ActorTemplates[ar.Value.Type]);
|
||||
|
||||
foreach (var wp in Map.Waypoints)
|
||||
e.Graphics.DrawRectangle(Pens.LimeGreen, new Rectangle(
|
||||
@@ -424,10 +426,18 @@ namespace OpenRA.Editor
|
||||
|
||||
if (Brush == null && Actor == null && Resource == null)
|
||||
{
|
||||
var x = Map.Actors.FirstOrDefault(a => a.Value.Location == GetBrushLocation());
|
||||
var x = Map.Actors.FirstOrDefault(a => a.Value.Location() == GetBrushLocation());
|
||||
if (x.Key != null)
|
||||
DrawActorBorder(e.Graphics, x.Value.Location, ActorTemplates[x.Value.Type]);
|
||||
DrawActorBorder(e.Graphics, x.Value.Location(), ActorTemplates[x.Value.Type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ActorReferenceExts
|
||||
{
|
||||
public static int2 Location(this ActorReference ar)
|
||||
{
|
||||
return ar.InitDict.Get<LocationInit>().value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user