don't allow stacking of mapactors

This commit is contained in:
Chris Forbes
2010-05-10 18:27:01 +12:00
parent e275677d11
commit 8118e022cb
2 changed files with 16 additions and 1 deletions

View File

@@ -101,8 +101,23 @@ namespace OpenRA.Editor
}
}
int id;
string NextActorName()
{
for (; ; )
{
var possible = "Actor{0}".F(id++);
if (!Map.Actors.ContainsKey(possible)) return possible;
}
}
void DrawWithActor()
{
if (Map.Actors.Any(a => a.Value.Location == GetBrushLocation()))
return;
var owner = "Neutral";
Map.Actors[NextActorName()] = new ActorReference(Actor.Info.Name.ToLowerInvariant(), GetBrushLocation(), owner);
}
protected override void OnMouseDown(MouseEventArgs e)