Fixed occasional invalid object header errors when attempting to send a status NetworkEvent for a character (easy way to reproduce was to kill multiple characters during the same frame with an explosion).

This commit is contained in:
Joonas Rikkonen
2018-01-16 17:02:01 +02:00
parent 0db1885872
commit 0f7befa09e
3 changed files with 13 additions and 4 deletions
@@ -379,8 +379,7 @@ namespace Barotrauma
if (GameMain.Server == null) return;
if (extraData != null)
{
{
switch ((NetEntityEvent.Type)extraData[0])
{
case NetEntityEvent.Type.InventoryState:
@@ -392,6 +391,13 @@ namespace Barotrauma
Client owner = ((Client)extraData[1]);
msg.Write(owner == null ? (byte)0 : owner.ID);
break;
case NetEntityEvent.Type.Status:
msg.WriteRangedInteger(0, 2, 2);
WriteStatus(msg);
break;
default:
DebugConsole.ThrowError("Invalid NetworkEvent type for entity " + ToString() + " (" + (NetEntityEvent.Type)extraData[0] + ")");
break;
}
msg.WritePadBits();
}