only notify when the lobby settings differ from the default

This commit is contained in:
Matthias Mailänder
2014-08-02 08:18:30 +02:00
parent 61b7e63e77
commit b382c0339f

View File

@@ -361,15 +361,35 @@ namespace OpenRA.Server
void NotifyNewClientOfLobbyInfo(Connection newConn)
{
SendOrderTo(newConn, "Message", "Diplomacy Changes: {0}".F(LobbyInfo.GlobalSettings.FragileAlliances));
SendOrderTo(newConn, "Message", "Allow Cheats: {0}".F(LobbyInfo.GlobalSettings.AllowCheats));
SendOrderTo(newConn, "Message", "Shroud: {0}".F(LobbyInfo.GlobalSettings.Shroud));
SendOrderTo(newConn, "Message", "Fog of war: {0}".F(LobbyInfo.GlobalSettings.Fog));
SendOrderTo(newConn, "Message", "Crates Appear: {0}".F(LobbyInfo.GlobalSettings.Crates));
SendOrderTo(newConn, "Message", "Build off Ally ConYards: {0}".F(LobbyInfo.GlobalSettings.AllyBuildRadius));
SendOrderTo(newConn, "Message", "Starting Units: {0}".F(LobbyInfo.GlobalSettings.StartingUnitsClass));
SendOrderTo(newConn, "Message", "Starting Cash: ${0}".F(LobbyInfo.GlobalSettings.StartingCash));
SendOrderTo(newConn, "Message", "Tech Level: {0}".F(LobbyInfo.GlobalSettings.TechLevel));
var defaults = new Session.Global();
FieldLoader.Load(defaults, Game.modData.Manifest.LobbyDefaults);
if (LobbyInfo.GlobalSettings.FragileAlliances != defaults.FragileAlliances)
SendOrderTo(newConn, "Message", "Diplomacy Changes: {0}".F(LobbyInfo.GlobalSettings.FragileAlliances));
if (LobbyInfo.GlobalSettings.AllowCheats != defaults.AllowCheats)
SendOrderTo(newConn, "Message", "Allow Cheats: {0}".F(LobbyInfo.GlobalSettings.AllowCheats));
if (LobbyInfo.GlobalSettings.Shroud != defaults.Shroud)
SendOrderTo(newConn, "Message", "Shroud: {0}".F(LobbyInfo.GlobalSettings.Shroud));
if (LobbyInfo.GlobalSettings.Fog != defaults.Fog)
SendOrderTo(newConn, "Message", "Fog of war: {0}".F(LobbyInfo.GlobalSettings.Fog));
if (LobbyInfo.GlobalSettings.Crates != defaults.Crates)
SendOrderTo(newConn, "Message", "Crates Appear: {0}".F(LobbyInfo.GlobalSettings.Crates));
if (LobbyInfo.GlobalSettings.AllyBuildRadius != defaults.AllyBuildRadius)
SendOrderTo(newConn, "Message", "Build off Ally ConYards: {0}".F(LobbyInfo.GlobalSettings.AllyBuildRadius));
if (LobbyInfo.GlobalSettings.StartingUnitsClass != defaults.StartingUnitsClass)
SendOrderTo(newConn, "Message", "Starting Units: {0}".F(LobbyInfo.GlobalSettings.StartingUnitsClass));
if (LobbyInfo.GlobalSettings.StartingCash != defaults.StartingCash)
SendOrderTo(newConn, "Message", "Starting Cash: ${0}".F(LobbyInfo.GlobalSettings.StartingCash));
if (LobbyInfo.GlobalSettings.TechLevel != defaults.TechLevel)
SendOrderTo(newConn, "Message", "Tech Level: {0}".F(LobbyInfo.GlobalSettings.TechLevel));
}
void SetOrderLag()