Unstable v0.19.3.0
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user