Disable maps with broken rules in the lobby. Fixes #4334.

This commit is contained in:
Paul Chote
2014-05-18 15:23:47 +12:00
parent 657ade7221
commit 69e87b0057
6 changed files with 140 additions and 13 deletions

View File

@@ -27,6 +27,9 @@ namespace OpenRA
// Used for grouping maps in the UI
public enum MapClassification { Unknown, System, User, Remote }
// Used for verifying map availability in the lobby
public enum MapRuleStatus { Unknown, Cached, Invalid }
// Fields names must match the with the remote API
public class RemoteMapData
{
@@ -58,6 +61,8 @@ namespace OpenRA
public MapStatus Status { get; private set; }
public MapClassification Class { get; private set; }
public MapRuleStatus RuleStatus { get; private set; }
Download download;
public long DownloadBytes { get; private set; }
public int DownloadPercentage { get; private set; }
@@ -227,5 +232,22 @@ namespace OpenRA
download.Cancel();
download = null;
}
public void CacheRules()
{
if (RuleStatus != MapRuleStatus.Unknown)
return;
try
{
Map.PreloadRules();
RuleStatus = MapRuleStatus.Cached;
}
catch (Exception e)
{
Log.Write("debug", "Map {0} failed validation with an exception:\n{1}", Uid, e.Message);
RuleStatus = MapRuleStatus.Invalid;
}
}
}
}