(f26b88b8c) Ignore revision number (the last digit of the version number) when determining client/server compatibility. Allows us to release hotfixes etc with a different version number without breaking compatibility. Also incremented version number to make the next version incompatible with older ones.
This commit is contained in:
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.9.0.6")]
|
[assembly: AssemblyVersion("0.9.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.9.0.6")]
|
[assembly: AssemblyFileVersion("0.9.1.0")]
|
||||||
|
|||||||
@@ -185,9 +185,15 @@ namespace Barotrauma
|
|||||||
if (!(child.UserData is ServerInfo)) continue;
|
if (!(child.UserData is ServerInfo)) continue;
|
||||||
ServerInfo serverInfo = (ServerInfo)child.UserData;
|
ServerInfo serverInfo = (ServerInfo)child.UserData;
|
||||||
|
|
||||||
|
Version remoteVersion = null;
|
||||||
|
if (!string.IsNullOrEmpty(serverInfo.GameVersion))
|
||||||
|
{
|
||||||
|
Version.TryParse(serverInfo.GameVersion, out remoteVersion);
|
||||||
|
}
|
||||||
|
|
||||||
bool incompatible =
|
bool incompatible =
|
||||||
(!serverInfo.ContentPackageHashes.Any() && serverInfo.ContentPackagesMatch(GameMain.Config.SelectedContentPackages)) ||
|
(!serverInfo.ContentPackageHashes.Any() && serverInfo.ContentPackagesMatch(GameMain.Config.SelectedContentPackages)) ||
|
||||||
(!string.IsNullOrEmpty(serverInfo.GameVersion) && serverInfo.GameVersion != GameMain.Version.ToString());
|
(remoteVersion != null && !NetworkMember.IsCompatible(GameMain.Version, remoteVersion));
|
||||||
|
|
||||||
child.Visible =
|
child.Visible =
|
||||||
serverInfo.ServerName.ToLowerInvariant().Contains(searchBox.Text.ToLowerInvariant()) &&
|
serverInfo.ServerName.ToLowerInvariant().Contains(searchBox.Text.ToLowerInvariant()) &&
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.9.0.6")]
|
[assembly: AssemblyVersion("0.9.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.9.0.6")]
|
[assembly: AssemblyFileVersion("0.9.1.0")]
|
||||||
|
|||||||
@@ -339,13 +339,14 @@ namespace Barotrauma.Networking
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clVersion != GameMain.Version.ToString())
|
bool? isCompatibleVersion = IsCompatible(clVersion, GameMain.Version.ToString());
|
||||||
|
if (isCompatibleVersion.HasValue && !isCompatibleVersion.Value)
|
||||||
{
|
{
|
||||||
DisconnectUnauthClient(inc, unauthClient, DisconnectReason.InvalidVersion,
|
DisconnectUnauthClient(inc, unauthClient, DisconnectReason.InvalidVersion,
|
||||||
$"DisconnectMessage.InvalidVersion~[version]={GameMain.Version.ToString()}~[clientversion]={clVersion}");
|
$"DisconnectMessage.InvalidVersion~[version]={GameMain.Version.ToString()}~[clientversion]={clVersion}");
|
||||||
|
|
||||||
Log(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (wrong game version)", ServerLog.MessageType.Error);
|
Log(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (incompatible game version)", ServerLog.MessageType.Error);
|
||||||
DebugConsole.NewMessage(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (wrong game version)", Color.Red);
|
DebugConsole.NewMessage(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (incompatible game version)", Color.Red);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -241,6 +241,30 @@ namespace Barotrauma.Networking
|
|||||||
public virtual void Update(float deltaTime) { }
|
public virtual void Update(float deltaTime) { }
|
||||||
|
|
||||||
public virtual void Disconnect() { }
|
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 (!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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user