Connection Failed when trying to join custom map #12881

This commit is contained in:
rob-v
2017-03-17 00:06:27 +01:00
parent 832ae3149d
commit c3255e275c

View File

@@ -9,8 +9,8 @@
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Traits;
using OpenRA.Network;
using OpenRA.Server;
using OpenRA.Traits;
@@ -29,16 +29,19 @@ namespace OpenRA.Mods.Common.Server
var options = server.Map.Rules.Actors["player"].TraitInfos<ILobbyOptions>()
.Concat(server.Map.Rules.Actors["world"].TraitInfos<ILobbyOptions>())
.SelectMany(t => t.LobbyOptions(server.Map.Rules))
.ToDictionary(o => o.Id, o => o);
.SelectMany(t => t.LobbyOptions(server.Map.Rules));
var optionNames = new Dictionary<string, string>();
foreach (var o in options)
optionNames[o.Id] = o.Name;
foreach (var kv in server.LobbyInfo.GlobalSettings.LobbyOptions)
{
Session.LobbyOptionState def;
LobbyOption option;
string optionName;
if (!defaults.LobbyOptions.TryGetValue(kv.Key, out def) || kv.Value.Value != def.Value)
if (options.TryGetValue(kv.Key, out option))
server.SendOrderTo(conn, "Message", option.Name + ": " + kv.Value.Value);
if (optionNames.TryGetValue(kv.Key, out optionName))
server.SendOrderTo(conn, "Message", optionName + ": " + kv.Value.Value);
}
}
}