Sending multiple networkevents in one packet, removed limb updates from ImportantEntityUpdate

This commit is contained in:
Regalis
2015-11-04 00:12:53 +02:00
parent 963f46e7d1
commit 9f9f0205e7
6 changed files with 138 additions and 61 deletions

View File

@@ -474,7 +474,34 @@ namespace Barotrauma.Networking
case (byte)PacketTypes.NetworkEvent:
//read the data from the message and update client state accordingly
if (!gameStarted) break;
NetworkEvent.ReadData(inc);
byte msgCount = inc.ReadByte();
long currPos = inc.PositionInBytes;
System.Diagnostics.Debug.WriteLine("msgcount: " + msgCount + " startpos: " + inc.PositionInBytes);
for (int i = 0; i < msgCount; i++ )
{
byte msgLength = inc.ReadByte();
System.Diagnostics.Debug.WriteLine("msglength: "+msgLength);
try
{
NetworkEvent.ReadData(inc);
}
catch
{
int afghj = 1;
}
//+1 because msgLength is one additional byte
currPos += msgLength+1;
inc.Position = currPos*8;
System.Diagnostics.Debug.WriteLine("currpos: " + currPos);
}
break;
case (byte)PacketTypes.UpdateNetLobby:
if (gameStarted) continue;