(98ad00fa2) v0.9.1.0

This commit is contained in:
Joonas Rikkonen
2019-07-10 13:52:12 +03:00
parent 2a791887ed
commit afa2137bd2
104 changed files with 3041 additions and 3134 deletions
@@ -241,6 +241,32 @@ namespace Barotrauma.Networking
public virtual void Update(float deltaTime) { }
public virtual void Disconnect() { }
}
/// <summary>
/// Check if the two version are compatible (= if they can play together in multiplayer).
/// Returns null if compatibility could not be determined (invalid/unknown version number).
/// </summary>
public static bool? IsCompatible(string myVersion, string remoteVersion)
{
if (string.IsNullOrEmpty(myVersion) || string.IsNullOrEmpty(remoteVersion)) { return null; }
if (!Version.TryParse(myVersion, out Version myVersionNumber)) { return null; }
if (!Version.TryParse(remoteVersion, out Version remoteVersionNumber)) { return null; }
return IsCompatible(myVersionNumber, remoteVersionNumber);
}
/// <summary>
/// Check if the two version are compatible (= if they can play together in multiplayer).
/// </summary>
public static bool IsCompatible(Version myVersion, Version remoteVersion)
{
//major.minor.build.revision
//revision number is ignored, other values have to match
return
myVersion.Major == remoteVersion.Major &&
myVersion.Minor == remoteVersion.Minor &&
myVersion.Build == remoteVersion.Build;
}
}
}