Merge pull request #8792 from deniz1a/reveal-shroud

Changes shroud lobby setting from disabling shroud to revealing it.
This commit is contained in:
abcdefg30
2015-08-12 22:04:15 +02:00
9 changed files with 20 additions and 18 deletions

View File

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

View File

@@ -173,6 +173,10 @@ namespace OpenRA
MapUid = Map.Uid,
MapTitle = Map.Title
};
if (!LobbyInfo.GlobalSettings.Shroud)
foreach (var player in Players)
player.Shroud.ExploreAll(this);
}
public void LoadComplete(WorldRenderer wr)

View File

@@ -440,8 +440,8 @@ namespace OpenRA.Mods.Common.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Shroud);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} {1} Shroud."
.F(client.Name, server.LobbyInfo.GlobalSettings.Shroud ? "enabled" : "disabled"));
server.SendMessage("{0} {1} Explored map."
.F(client.Name, server.LobbyInfo.GlobalSettings.Shroud ? "disabled" : "enabled"));
return true;
}

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Server
server.SendOrderTo(conn, "Message", "Allow Cheats: {0}".F(server.LobbyInfo.GlobalSettings.AllowCheats));
if (server.LobbyInfo.GlobalSettings.Shroud != defaults.Shroud)
server.SendOrderTo(conn, "Message", "Shroud: {0}".F(server.LobbyInfo.GlobalSettings.Shroud));
server.SendOrderTo(conn, "Message", "Explored map: {0}".F(!server.LobbyInfo.GlobalSettings.Shroud));
if (server.LobbyInfo.GlobalSettings.Fog != defaults.Fog)
server.SendOrderTo(conn, "Message", "Fog of war: {0}".F(server.LobbyInfo.GlobalSettings.Fog));

View File

@@ -30,7 +30,6 @@ namespace OpenRA.Mods.Common.Traits
static readonly PPos[] NoCells = { };
readonly RevealsShroudInfo info;
readonly bool lobbyShroudFogDisabled;
[Sync] CPos cachedLocation;
[Sync] bool cachedDisabled;
@@ -41,7 +40,6 @@ namespace OpenRA.Mods.Common.Traits
public RevealsShroud(Actor self, RevealsShroudInfo info)
{
this.info = info;
lobbyShroudFogDisabled = !self.World.LobbyInfo.GlobalSettings.Shroud && !self.World.LobbyInfo.GlobalSettings.Fog;
addCellsToPlayerShroud = (p, uv) => p.Shroud.AddProjectedVisibility(self, uv);
removeCellsFromPlayerShroud = p => p.Shroud.RemoveVisibility(self);
@@ -66,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
public void Tick(Actor self)
{
if (lobbyShroudFogDisabled || !self.IsInWorld)
if (!self.IsInWorld)
return;
var centerPosition = self.CenterPosition;

View File

@@ -497,12 +497,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
}
var enableShroud = optionsBin.GetOrNull<CheckboxWidget>("SHROUD_CHECKBOX");
if (enableShroud != null)
var exploredMap = optionsBin.GetOrNull<CheckboxWidget>("EXPLORED_MAP_CHECKBOX");
if (exploredMap != null)
{
enableShroud.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Shroud;
enableShroud.IsDisabled = () => Map.Status != MapStatus.Available || Map.Map.Options.Shroud.HasValue || configurationDisabled();
enableShroud.OnClick = () => orderManager.IssueOrder(Order.Command(
exploredMap.IsChecked = () => !orderManager.LobbyInfo.GlobalSettings.Shroud;
exploredMap.IsDisabled = () => Map.Status != MapStatus.Available || Map.Map.Options.Shroud.HasValue || configurationDisabled();
exploredMap.OnClick = () => orderManager.IssueOrder(Order.Command(
"shroud {0}".F(!orderManager.LobbyInfo.GlobalSettings.Shroud)));
}

View File

@@ -110,11 +110,11 @@ Background@LOBBY_OPTIONS_BIN:
Width: PARENT_RIGHT-60
Height: PARENT_BOTTOM-75
Children:
Checkbox@SHROUD_CHECKBOX:
Checkbox@EXPLORED_MAP_CHECKBOX:
Width: 230
Height: 20
Font: Regular
Text: Shroud
Text: Explored map
Checkbox@FOG_CHECKBOX:
Y: 35
Width: 230

View File

@@ -109,10 +109,10 @@ Background@LOBBY_OPTIONS_BIN:
Width: PARENT_RIGHT-60
Height: PARENT_BOTTOM-75
Children:
Checkbox@SHROUD_CHECKBOX:
Checkbox@EXPLORED_MAP_CHECKBOX:
Width: 140
Height: 20
Text: Shroud
Text: Explored map
Checkbox@FOG_CHECKBOX:
Y: 35
Width: 140

View File

@@ -109,10 +109,10 @@ Background@LOBBY_OPTIONS_BIN:
Width: PARENT_RIGHT-60
Height: PARENT_BOTTOM-75
Children:
Checkbox@SHROUD_CHECKBOX:
Checkbox@EXPLORED_MAP_CHECKBOX:
Width: 140
Height: 20
Text: Shroud
Text: Explored map
Checkbox@FOG_CHECKBOX:
Y: 35
Width: 140