Move initial map exploration to Shroud.

This commit is contained in:
Paul Chote
2016-04-20 00:00:26 -04:00
parent dade84db85
commit a0b5b5ce66
5 changed files with 14 additions and 12 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Traits
public object Create(ActorInitializer init) { return new Shroud(init.Self); }
}
public class Shroud : ISync
public class Shroud : ISync, INotifyCreated
{
public event Action<IEnumerable<PPos>> CellsChanged;
@@ -79,6 +79,12 @@ namespace OpenRA.Traits
explored = new CellLayer<bool>(map);
}
void INotifyCreated.Created(Actor self)
{
if (!self.World.LobbyInfo.GlobalSettings.Shroud)
self.World.AddFrameEndTask(w => ExploreAll());
}
void Invalidate(IEnumerable<PPos> changed)
{
if (CellsChanged != null)
@@ -241,7 +247,7 @@ namespace OpenRA.Traits
Invalidate(changed);
}
public void ExploreAll(World world)
public void ExploreAll()
{
var changed = new List<PPos>();
foreach (var puv in map.ProjectedCellBounds)