More error logging to diagnose invalid header errors

This commit is contained in:
Joonas Rikkonen
2018-07-27 16:11:19 +03:00
parent 891a2c3257
commit 6209f48fff
2 changed files with 16 additions and 9 deletions
@@ -1044,6 +1044,12 @@ namespace Barotrauma.Networking
}
}
errorLines.Add("Last console messages:");
for (int i = DebugConsole.Messages.Count - 1; i > 0; i--)
{
errorLines.Add("[" + DebugConsole.Messages[i].Time + "] " + DebugConsole.Messages[i].Text);
}
foreach (string line in errorLines)
{
DebugConsole.ThrowError(line);
@@ -159,23 +159,24 @@ namespace Barotrauma.Networking
//skip the event if we've already received it or if the entity isn't found
if (thisEventID != (UInt16)(lastReceivedID + 1) || entity == null)
{
if (GameSettings.VerboseLogging)
if (thisEventID != (UInt16) (lastReceivedID + 1))
{
if (thisEventID != (UInt16) (lastReceivedID + 1))
if (GameSettings.VerboseLogging)
{
DebugConsole.NewMessage(
"received msg " + thisEventID + " (waiting for " + (lastReceivedID + 1) + ")",
"Received msg " + thisEventID + " (waiting for " + (lastReceivedID + 1) + ")",
thisEventID < lastReceivedID + 1
? Microsoft.Xna.Framework.Color.Yellow
: Microsoft.Xna.Framework.Color.Red);
}
else if (entity == null)
{
DebugConsole.NewMessage(
"received msg " + thisEventID + ", entity " + entityID + " not found",
Microsoft.Xna.Framework.Color.Red);
}
}
else if (entity == null)
{
DebugConsole.NewMessage(
"Received msg " + thisEventID + ", entity " + entityID + " not found",
Microsoft.Xna.Framework.Color.Red);
}
msg.Position += msgLength * 8;
}
else