Chat messages are added to the server log even if the host's character is out of range, message senders are shown in the server log, fixed multi-line log entries overlapping

This commit is contained in:
Regalis
2016-08-30 19:06:15 +03:00
parent 7ed95c430b
commit 2e2043bf7f
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -1521,7 +1521,7 @@ namespace Barotrauma.Networking
} }
else else
{ {
GameServer.Log(message.Text, message.Color); GameServer.Log(message.TextWithSender, message.Color);
} }
sender.ChatSpamSpeed += 5.0f; sender.ChatSpamSpeed += 5.0f;
@@ -264,6 +264,7 @@ namespace Barotrauma.Networking
public void AddChatMessage(ChatMessage message) public void AddChatMessage(ChatMessage message)
{ {
if (message.Type == ChatMessageType.Radio && if (message.Type == ChatMessageType.Radio &&
Character.Controlled != null && Character.Controlled != null &&
message.Sender != null && message.Sender != myCharacter) message.Sender != null && message.Sender != myCharacter)
@@ -278,6 +279,8 @@ namespace Barotrauma.Networking
return; return;
} }
GameServer.Log(message.TextWithSender, message.Color);
string displayedText = message.Text; string displayedText = message.Text;
if (message.Sender != null) if (message.Sender != null)
@@ -293,8 +296,6 @@ namespace Barotrauma.Networking
GameMain.NetLobbyScreen.NewChatMessage(message); GameMain.NetLobbyScreen.NewChatMessage(message);
GameServer.Log(message.Text, message.Color);
while (chatBox.CountChildren > 20) while (chatBox.CountChildren > 20)
{ {
chatBox.RemoveChild(chatBox.children[1]); chatBox.RemoveChild(chatBox.children[1]);
+2 -2
View File
@@ -98,10 +98,10 @@ namespace Barotrauma.Networking
{ {
float prevSize = listBox.BarSize; float prevSize = listBox.BarSize;
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, null, true, GUI.SmallFont); var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, listBox, true, GUI.SmallFont);
textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height)); textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height));
listBox.AddChild(textBlock); //listBox.AddChild(textBlock);
textBlock.TextColor = line.Color; textBlock.TextColor = line.Color;
textBlock.CanBeFocused = false; textBlock.CanBeFocused = false;