0.15.21.0

This commit is contained in:
Markus Isberg
2021-12-16 01:05:43 +09:00
parent 617d9ede88
commit 7d43cb1e91
74 changed files with 487 additions and 541 deletions
@@ -9,7 +9,7 @@ namespace Barotrauma.Networking
static class NetIdUtils
{
/// <summary>
/// Is newID more recent than oldID
/// Is newID more recent than oldID, i.e. newId > oldId accounting for ushort rollover
/// </summary>
public static bool IdMoreRecent(ushort newID, ushort oldID)
{
@@ -22,6 +22,12 @@ namespace Barotrauma.Networking
(id2 > id1) && (id2 - id1 > ushort.MaxValue / 2);
}
/// <summary>
/// newId >= oldId accounting for ushort rollover (newer or equals)
/// </summary>
public static bool IdMoreRecentOrMatches(ushort newId, ushort oldId)
=> !IdMoreRecent(oldId, newId);
public static ushort Difference(ushort id1, ushort id2)
{
int diff = id2 > id1 ? id2 - id1 : id1 - id2;