diff --git a/Subsurface/Properties/AssemblyInfo.cs b/Subsurface/Properties/AssemblyInfo.cs index d100587cb..13cd8707e 100644 --- a/Subsurface/Properties/AssemblyInfo.cs +++ b/Subsurface/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.1.5")] -[assembly: AssemblyFileVersion("0.3.1.5")] +[assembly: AssemblyVersion("0.3.2.2")] +[assembly: AssemblyFileVersion("0.3.2.2")] diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index b3be35082..f9b67df76 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -937,6 +937,8 @@ namespace Barotrauma.Networking if (autoRestart) AutoRestartTimer = 20.0f; + if (saveServerLogs) log.Save(); + return true; } @@ -1275,7 +1277,7 @@ namespace Barotrauma.Networking List recipients = new List(); Client targetClient = null; - if (words.Length > 2) + if (words.Length > 2 && words[1].FirstOrDefault()=='/' && type==ChatMessageType.Server) { if (words[1] == "/dead" || words[1] == "/d") { @@ -1284,12 +1286,13 @@ namespace Barotrauma.Networking else { targetClient = ConnectedClients.Find(c => - words[0] == "/" + c.name.ToLower() || - c.Character != null && words[0] == "/" + c.Character.Name.ToLower()); + words[1] == "/" + c.name.ToLower() || + c.Character != null && words[1] == "/" + c.Character.Name.ToLower()); if (targetClient==null) { - AddChatMessage("Player ''"+words[0].Replace("/", "")+"'' not found!", ChatMessageType.Admin); + AddChatMessage("Player ''"+words[1].Replace("/", "")+"'' not found!", ChatMessageType.Admin); + return; } } diff --git a/Subsurface/Source/Networking/ServerLog.cs b/Subsurface/Source/Networking/ServerLog.cs index ca76a8441..1ca3782ed 100644 --- a/Subsurface/Source/Networking/ServerLog.cs +++ b/Subsurface/Source/Networking/ServerLog.cs @@ -17,6 +17,8 @@ namespace Barotrauma.Networking public GUIFrame LogFrame; + private GUIListBox listBox; + private Queue lines; public ServerLog(string serverName) @@ -30,13 +32,19 @@ namespace Barotrauma.Networking { string logLine = "[" + DateTime.Now.ToLongTimeString() + "] " + line; - lines.Enqueue(new ColoredText(logLine, color == null ? Color.White : (Color)color)); + var newText = new ColoredText(logLine, color == null ? Color.White : (Color)color); - if (LogFrame != null) CreateLogFrame(); + lines.Enqueue(newText); - if (lines.Count>=LinesPerFile) + if (LogFrame != null) + { + AddLine(newText); + } + + if (lines.Count >= LinesPerFile) { Save(); + lines.Clear(); } } @@ -47,20 +55,16 @@ namespace Barotrauma.Networking GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,400, 400), null, Alignment.Center, GUI.Style, LogFrame); innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); - GUIListBox listBox = new GUIListBox(new Rectangle(0,0,0,355), GUI.Style, innerFrame); + listBox = new GUIListBox(new Rectangle(0,0,0,355), GUI.Style, innerFrame); var currLines = lines.ToList(); foreach (ColoredText line in currLines) { - 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, (line.Text.Count(c => c == '\n') + 1) * 15); - - textBlock.TextColor = line.Color; - textBlock.CanBeFocused = false; + AddLine(line); } - listBox.BarScroll = 1.0f; + if (listBox.BarScroll==0.0f || listBox.BarScroll==1.0f) listBox.BarScroll = 1.0f; GUIButton closeButton = new GUIButton(new Rectangle(0,0,100, 15), "Close", Alignment.BottomRight, GUI.Style, innerFrame); closeButton.OnClicked = (GUIButton button, object userData) => @@ -70,6 +74,15 @@ namespace Barotrauma.Networking }; } + private void AddLine(ColoredText line) + { + 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, (line.Text.Count(c => c == '\n') + 1) * 15); + + textBlock.TextColor = line.Color; + textBlock.CanBeFocused = false; + } + public void Save() { if (!Directory.Exists(SavePath)) @@ -88,6 +101,8 @@ namespace Barotrauma.Networking string fileName = serverName+"_"+DateTime.Now.ToShortDateString()+"_"+DateTime.Now.ToShortTimeString()+".txt"; fileName = fileName.Replace(":", ""); + fileName = fileName.Replace("../", ""); + fileName = fileName.Replace("/", ""); string filePath = Path.Combine(SavePath, fileName); @@ -99,6 +114,8 @@ namespace Barotrauma.Networking { DebugConsole.ThrowError("Saving the server log to " + filePath + " failed", e); } + + lines.Clear(); } } } diff --git a/Subsurface/changelog.txt b/Subsurface/changelog.txt index a1e7d3625..8059ac5f8 100644 --- a/Subsurface/changelog.txt +++ b/Subsurface/changelog.txt @@ -1,15 +1,32 @@ +--------------------------------------------------------------------------------------------------------- +v0.3.2.2 +--------------------------------------------------------------------------------------------------------- + +- clearing the server log after saving! +- saving the log after every round (even if it isn't full) + +--------------------------------------------------------------------------------------------------------- +v0.3.2.1 +--------------------------------------------------------------------------------------------------------- + +- fixed words missing from chat messages +- the server log UI doesn't scroll to the bottom when new lines appear, making it easier to read it during +a round + --------------------------------------------------------------------------------------------------------- v0.3.2.0 --------------------------------------------------------------------------------------------------------- -- server log -- more reliable door syncing -- deattaching items takes some time -- welders and cutters do damage to players/enemies again -- molochs can do damage to players +- server logs - server admins have the option to send messages only to dead players and spectators (/d [message]) or to one specific player (/name [message]) +- more reliable door syncing +- railgun syncing bugfixes +- longer view distance when outside +- deattaching items takes some time +- welders and cutters do damage to players/enemies again - a new enemy +- molochs can do damage to players --------------------------------------------------------------------------------------------------------- v0.3.1.5 diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 3773365a1..a02f5188f 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ