Unstable v0.19.3.0

This commit is contained in:
Juan Pablo Arce
2022-09-02 15:10:56 -03:00
parent 28789616bd
commit 3f2c843247
336 changed files with 7152 additions and 7739 deletions
@@ -28,6 +28,19 @@ namespace Barotrauma.Networking
public static bool IdMoreRecentOrMatches(ushort newId, ushort oldId)
=> !IdMoreRecent(oldId, newId);
/// <summary>
/// Returns some ID that is older than the input ID. There are no guarantees
/// regarding its relation to values other than the input.
/// </summary>
public static ushort GetIdOlderThan(ushort id)
#if DEBUG
// Debug implementation has some RNG to discourage bad assumptions about the return value
=> unchecked((ushort)(id - 1 - Rand.Int(500, sync: Rand.RandSync.Unsynced)));
#else
// Release implementation favors performance
=> unchecked((ushort)(id - 1));
#endif
public static ushort Difference(ushort id1, ushort id2)
{
int diff = id2 > id1 ? id2 - id1 : id1 - id2;