Fix player connection notifications.

New player notifications are now never reported to the joining player,
and always reported in the dedicated server output.
This commit is contained in:
Paul Chote
2018-05-20 09:35:37 +00:00
committed by Matthias Mailänder
parent c77051790a
commit 9073249fe4

View File

@@ -378,8 +378,8 @@ namespace OpenRA.Server
Log.Write("server", "{0} ({1}) has joined the game.", Log.Write("server", "{0} ({1}) has joined the game.",
client.Name, newConn.Socket.RemoteEndPoint); client.Name, newConn.Socket.RemoteEndPoint);
if (LobbyInfo.NonBotClients.Count() > 1) // Report to all other players
SendMessage("{0} has joined the game.".F(client.Name)); SendMessage("{0} has joined the game.".F(client.Name), newConn);
// Send initial ping // Send initial ping
SendOrderTo(newConn, "Ping", Game.RunTime.ToString(CultureInfo.InvariantCulture)); SendOrderTo(newConn, "Ping", Game.RunTime.ToString(CultureInfo.InvariantCulture));
@@ -470,9 +470,9 @@ namespace OpenRA.Server
DispatchOrdersToClient(conn, 0, 0, new ServerOrder(order, data).Serialize()); DispatchOrdersToClient(conn, 0, 0, new ServerOrder(order, data).Serialize());
} }
public void SendMessage(string text) public void SendMessage(string text, Connection conn = null)
{ {
DispatchOrdersToClients(null, 0, new ServerOrder("Message", text).Serialize()); DispatchOrdersToClients(conn, 0, new ServerOrder("Message", text).Serialize());
if (Dedicated) if (Dedicated)
Console.WriteLine("[{0}] {1}".F(DateTime.Now.ToString(Settings.TimestampFormat), text)); Console.WriteLine("[{0}] {1}".F(DateTime.Now.ToString(Settings.TimestampFormat), text));