Fixed another off-by-one error in EntitySpawner ID comparisons, clients reset their ChatMessage ID when (re)connecting to the server

This commit is contained in:
Regalis
2017-03-24 17:56:56 +02:00
parent 7e431c7dfd
commit ccc09560a1
2 changed files with 2 additions and 1 deletions

View File

@@ -214,7 +214,7 @@ namespace Barotrauma
ushort entityId = message.ReadUInt16();
var entity = Entity.FindEntityByID(entityId);
if (entity == null || NetIdUtils.IdMoreRecent(NetStateID,(UInt16)(ID - entityCount + i))) continue; //already removed
if (entity == null || NetIdUtils.IdMoreRecent((UInt16)(NetStateID - 1), (UInt16)(ID - entityCount + i))) continue; //already removed
entity.Remove();
}

View File

@@ -123,6 +123,7 @@ namespace Barotrauma.Networking
}
myCharacter = Character.Controlled;
ChatMessage.LastID = 0;
// Create new instance of configs. Parameter is "application Id". It has to be same on client and server.
NetPeerConfiguration config = new NetPeerConfiguration("barotrauma");