Moved Submarine.ClientRead to the client project

This commit is contained in:
Joonas Rikkonen
2018-07-23 17:58:28 +03:00
parent 25a62b3a51
commit 9d1c4f3efb
2 changed files with 29 additions and 28 deletions
@@ -1326,34 +1326,6 @@ namespace Barotrauma
msg.Write(PhysicsBody.SimPosition.X);
msg.Write(PhysicsBody.SimPosition.Y);
}
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
{
var newTargetPosition = new Vector2(
msg.ReadFloat(),
msg.ReadFloat());
//already interpolating with more up-to-date data -> ignore
if (subBody.MemPos.Count > 1 && subBody.MemPos[0].Timestamp > sendingTime)
{
return;
}
int index = 0;
while (index < subBody.MemPos.Count && sendingTime > subBody.MemPos[index].Timestamp)
{
index++;
}
//position with the same timestamp already in the buffer (duplicate packet?)
// -> no need to add again
if (index < subBody.MemPos.Count && sendingTime == subBody.MemPos[index].Timestamp)
{
return;
}
subBody.MemPos.Insert(index, new PosInfo(newTargetPosition, 0.0f, sendingTime));
}
}
}