Prepare Shroud code for trait-defined lobby options.

This commit is contained in:
Paul Chote
2016-04-20 00:09:29 -04:00
parent a0b5b5ce66
commit 1eba0bea13

View File

@@ -67,6 +67,9 @@ namespace OpenRA.Traits
}
}
bool fogEnabled;
public bool FogEnabled { get { return !Disabled && fogEnabled; } }
public int Hash { get; private set; }
public Shroud(Actor self)
@@ -81,7 +84,9 @@ namespace OpenRA.Traits
void INotifyCreated.Created(Actor self)
{
if (!self.World.LobbyInfo.GlobalSettings.Shroud)
fogEnabled = self.World.LobbyInfo.GlobalSettings.Fog;
var shroudEnabled = self.World.LobbyInfo.GlobalSettings.Shroud;
if (!shroudEnabled)
self.World.AddFrameEndTask(w => ExploreAll());
}
@@ -304,15 +309,13 @@ namespace OpenRA.Traits
public bool IsExplored(PPos puv)
{
if (!ShroudEnabled)
if (Disabled)
return map.Contains(puv);
var uv = (MPos)puv;
return explored.Contains(uv) && explored[uv] && (generatedShroudCount[uv] == 0 || visibleCount[uv] > 0);
}
public bool ShroudEnabled { get { return !Disabled; } }
public bool IsVisible(WPos pos)
{
return IsVisible(map.ProjectedCellCovering(pos));
@@ -345,8 +348,6 @@ namespace OpenRA.Traits
return visibleCount.Contains(uv) && visibleCount[uv] > 0;
}
public bool FogEnabled { get { return !Disabled && self.World.LobbyInfo.GlobalSettings.Fog; } }
public bool Contains(PPos uv)
{
// Check that uv is inside the map area. There is nothing special