RemoveActor impl in Shroud trait

This commit is contained in:
Chris Forbes
2010-03-29 19:25:28 +13:00
parent f701048310
commit 83a40e5039

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Traits
{
Map map;
int[,] visibleCells;
Dictionary<Actor, ActorVisibility> vis = new Dictionary<Actor, ActorVisibility>();
public Shroud(Actor self, ShroudInfo info)
{
@@ -44,11 +45,25 @@ namespace OpenRA.Traits
class ActorVisibility
{
int range;
int2[] vis;
public int range;
public int2[] vis;
}
void AddActor(Actor a) { }
void RemoveActor(Actor a) { }
void AddActor(Actor a)
{
if (a.Owner != a.Owner.World.LocalPlayer) return;
}
void RemoveActor(Actor a)
{
ActorVisibility v;
if (!vis.TryGetValue(a, out v)) return;
foreach (var p in v.vis)
foreach (var q in a.World.FindTilesInCircle(p, v.range))
--visibleCells[q.X, q.Y];
vis.Remove(a);
}
}
}