AICharacte syncing bugfixes, cleanbuild removes the temp save folder, minor networkevent optimizations (enum max value == GetValues().Length-1)

This commit is contained in:
Regalis11
2016-02-21 20:46:57 +02:00
parent 419384188a
commit c613e5fcf8
9 changed files with 97 additions and 82 deletions

View File

@@ -132,7 +132,7 @@ namespace Barotrauma.Networking
public bool FillData(NetBuffer message)
{
message.WriteRangedInteger(0, Enum.GetValues(typeof(NetworkEventType)).Length, (int)eventType);
message.WriteRangedInteger(0, Enum.GetValues(typeof(NetworkEventType)).Length-1, (int)eventType);
Entity e = Entity.FindEntityByID(id);
if (e == null) return false;
@@ -189,13 +189,13 @@ namespace Barotrauma.Networking
try
{
eventType = (NetworkEventType)message.ReadRangedInteger(0, Enum.GetValues(typeof(NetworkEventType)).Length);
eventType = (NetworkEventType)message.ReadRangedInteger(0, Enum.GetValues(typeof(NetworkEventType)).Length-1);
id = message.ReadUInt16();
}
catch
catch (Exception exception)
{
#if DEBUG
DebugConsole.ThrowError("Received invalid network message");
DebugConsole.ThrowError("Received invalid network message", exception);
#endif
return false;
}