Account for disabled shroud/fog in ShroudRenderer.

Fixes #8827.
This commit is contained in:
Paul Chote
2015-08-03 20:34:22 +01:00
parent 34bf5b5810
commit 0b4543919d
2 changed files with 9 additions and 9 deletions

View File

@@ -282,7 +282,7 @@ namespace OpenRA.Traits
return explored.Contains(uv) && explored[uv] && (generatedShroudCount[uv] == 0 || visibleCount[uv] > 0);
}
bool ShroudEnabled { get { return !Disabled && self.World.LobbyInfo.GlobalSettings.Shroud; } }
public bool ShroudEnabled { get { return !Disabled && self.World.LobbyInfo.GlobalSettings.Shroud; } }
/// <summary>
/// Returns a fast exploration lookup that skips the usual validation.
@@ -329,7 +329,7 @@ namespace OpenRA.Traits
return visibleCount.Contains(uv) && visibleCount[uv] > 0;
}
bool FogEnabled { get { return !Disabled && self.World.LobbyInfo.GlobalSettings.Fog; } }
public bool FogEnabled { get { return !Disabled && self.World.LobbyInfo.GlobalSettings.Fog; } }
/// <summary>
/// Returns a fast visibility lookup that skips the usual validation.

View File

@@ -237,18 +237,18 @@ namespace OpenRA.Mods.Common.Traits
currentShroud.CellsChanged -= DirtyCells;
if (shroud != null)
{
shroud.CellsChanged += DirtyCells;
// Needs the anonymous function to ensure the correct overload is chosen
visibleUnderShroud = uv => currentShroud.IsExplored(uv);
visibleUnderFog = uv => currentShroud.IsVisible(uv);
}
// Needs the anonymous function to ensure the correct overload is chosen
if (shroud != null && shroud.ShroudEnabled)
visibleUnderShroud = puv => currentShroud.IsExplored(puv);
else
{
visibleUnderShroud = puv => map.Contains(puv);
if (shroud != null && shroud.FogEnabled)
visibleUnderFog = puv => currentShroud.IsVisible(puv);
else
visibleUnderFog = puv => map.Contains(puv);
}
currentShroud = shroud;
DirtyCells(map.ProjectedCellBounds);