From 68130c85f33e3ee2b7f24f1a26cad10c31b4da98 Mon Sep 17 00:00:00 2001 From: Igor Popov Date: Mon, 7 Jan 2013 14:46:38 +0400 Subject: [PATCH] fix #2453; MOTD for lobby (to be fetched from file); different motd for each mod --- OpenRA.Game/GameRules/Settings.cs | 2 -- OpenRA.Game/Network/Session.cs | 1 - OpenRA.Game/Server/Server.cs | 11 +++++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenRA.Game/GameRules/Settings.cs b/OpenRA.Game/GameRules/Settings.cs index 4099ab8e89..800d206a5c 100644 --- a/OpenRA.Game/GameRules/Settings.cs +++ b/OpenRA.Game/GameRules/Settings.cs @@ -36,7 +36,6 @@ namespace OpenRA.GameRules public int TimeOut = 0; public bool Dedicated = false; public bool DedicatedLoop = true; - public string DedicatedMOTD = null; public ServerSettings() { } @@ -54,7 +53,6 @@ namespace OpenRA.GameRules TimeOut = other.TimeOut; Dedicated = other.Dedicated; DedicatedLoop = other.DedicatedLoop; - DedicatedMOTD = other.DedicatedMOTD; } } diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index cd198867ed..305b92a49f 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -78,7 +78,6 @@ namespace OpenRA.Network public bool LockTeams = true; // don't allow team changes after game start. public bool AllowCheats = false; public bool Dedicated; - public string DedicatedMOTD; } public Session(string[] mods) diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 9e0b07e122..4fc81d1449 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -119,7 +119,6 @@ namespace OpenRA.Server lobbyInfo.GlobalSettings.ServerName = settings.Name; lobbyInfo.GlobalSettings.Ban = settings.Ban; lobbyInfo.GlobalSettings.Dedicated = settings.Dedicated; - lobbyInfo.GlobalSettings.DedicatedMOTD = settings.DedicatedMOTD; foreach (var t in ServerTraits.WithInterface()) t.ServerStarted(this); @@ -328,11 +327,15 @@ namespace OpenRA.Server SyncLobbyInfo(); SendChat(newConn, "has joined the game."); - + + if ( File.Exists("{0}motd_{1}.txt".F(Platform.SupportDir, lobbyInfo.GlobalSettings.Mods[0])) ) + { + var motd = System.IO.File.ReadAllText("{0}motd_{1}.txt".F(Platform.SupportDir, lobbyInfo.GlobalSettings.Mods[0])); + SendChatTo(newConn, motd); + } + if ( lobbyInfo.GlobalSettings.Dedicated ) { - if (lobbyInfo.GlobalSettings.DedicatedMOTD != null) - SendChatTo(newConn, lobbyInfo.GlobalSettings.DedicatedMOTD); if (client.IsAdmin) SendChatTo(newConn, " You are admin now!"); else