Client communicates event syncing errors to the server
This should help
This commit is contained in:
@@ -1646,5 +1646,23 @@ namespace Barotrauma.Networking
|
||||
Vote(VoteType.EndRound, tickBox.Selected);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ReportError(ClientNetError error,UInt16 expectedID=0,UInt16 eventID=0,UInt16 entityID=0)
|
||||
{
|
||||
NetOutgoingMessage outMsg = client.CreateMessage();
|
||||
outMsg.Write((byte)error);
|
||||
switch (error)
|
||||
{
|
||||
case ClientNetError.MISSING_EVENT:
|
||||
outMsg.Write(expectedID);
|
||||
outMsg.Write(eventID);
|
||||
break;
|
||||
case ClientNetError.MISSING_ENTITY:
|
||||
outMsg.Write(eventID);
|
||||
outMsg.Write(entityID);
|
||||
break;
|
||||
}
|
||||
client.SendMessage(outMsg, NetDeliveryMethod.ReliableUnordered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-3
@@ -170,9 +170,14 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
DebugConsole.NewMessage(
|
||||
"Received msg " + thisEventID + " (waiting for " + (lastReceivedID + 1) + ")",
|
||||
thisEventID < lastReceivedID + 1
|
||||
? Microsoft.Xna.Framework.Color.Yellow
|
||||
: Microsoft.Xna.Framework.Color.Red);
|
||||
NetIdUtils.IdMoreRecent(thisEventID, (UInt16)(lastReceivedID + 1))
|
||||
? Microsoft.Xna.Framework.Color.Red
|
||||
: Microsoft.Xna.Framework.Color.Yellow);
|
||||
}
|
||||
|
||||
if (NetIdUtils.IdMoreRecent(thisEventID, (UInt16)(lastReceivedID + 1)))
|
||||
{
|
||||
GameMain.Client.ReportError(ClientNetError.MISSING_EVENT, expectedID: (UInt16)(lastReceivedID + 1), eventID: thisEventID);
|
||||
}
|
||||
}
|
||||
else if (entity == null)
|
||||
@@ -180,6 +185,7 @@ namespace Barotrauma.Networking
|
||||
DebugConsole.NewMessage(
|
||||
"Received msg " + thisEventID + ", entity " + entityID + " not found",
|
||||
Microsoft.Xna.Framework.Color.Red);
|
||||
GameMain.Client.ReportError(ClientNetError.MISSING_ENTITY, eventID: thisEventID, entityID: entityID);
|
||||
}
|
||||
|
||||
msg.Position += msgLength * 8;
|
||||
|
||||
Reference in New Issue
Block a user