diff --git a/OpenRa.Game/Chat.cs b/OpenRa.Game/Chat.cs index 30d4186df6..bafd46ce16 100644 --- a/OpenRa.Game/Chat.cs +++ b/OpenRa.Game/Chat.cs @@ -10,15 +10,22 @@ namespace OpenRa public List> recentLines = new List>(); public string typing = ""; - public bool isChatting = false; + public bool isChatting = true; public void Toggle() { if (isChatting && typing.Length > 0) - Game.IssueOrder(Order.Chat(typing)); + Game.IssueOrder(Order.Chat(typing)); + typing = ""; + if (Game.orderManager.GameStarted) + isChatting ^= true; + } + + public void Reset() + { typing = ""; - isChatting ^= true; + isChatting = false; } public void TypeChar(char c) diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 8b6e51e994..5c132be711 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -214,6 +214,7 @@ namespace OpenRa public static void StartGame() { + Game.chat.Reset(); var available = world.Map.SpawnPoints.ToList(); var taken = new List(); @@ -283,12 +284,12 @@ namespace OpenRa internal static void HandleKeyPress( KeyPressEventArgs e ) { int sync = Game.world.SyncHash(); - + if( e.KeyChar == '\r' ) Game.chat.Toggle(); else if( Game.chat.isChatting ) Game.chat.TypeChar( e.KeyChar ); - + if( sync != Game.world.SyncHash() ) throw new InvalidOperationException( "Desync in OnKeyPress" ); } diff --git a/OpenRa.Game/Graphics/Viewport.cs b/OpenRa.Game/Graphics/Viewport.cs index 10328669e2..291fed28d0 100644 --- a/OpenRa.Game/Graphics/Viewport.cs +++ b/OpenRa.Game/Graphics/Viewport.cs @@ -56,6 +56,7 @@ namespace OpenRa.Graphics { world.WorldRenderer.Draw(); Game.chrome.Draw( world ); + if( Game.orderManager.Connection.ConnectionState == ConnectionState.NotConnected ) Game.chrome.DrawDialog("Connection lost.");