diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 4f63e84d36..6fa5601a80 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -57,6 +57,8 @@ namespace OpenRA public static GlobalChat GlobalChat; + public static string EngineVersion { get; private set; } + static Task discoverNat; public static OrderManager JoinServer(string host, int port, string password, bool recordReplay = true) @@ -246,6 +248,18 @@ namespace OpenRA { Console.WriteLine("Platform is {0}", Platform.CurrentPlatform); + // Load the engine version as early as possible so it can be written to exception logs + try + { + EngineVersion = File.ReadAllText(Platform.ResolvePath(Path.Combine(".", "VERSION"))).Trim(); + } + catch { } + + if (string.IsNullOrEmpty(EngineVersion)) + EngineVersion = "Unknown"; + + Console.WriteLine("Engine version is {0}", EngineVersion); + // Special case handling of Game.Mod argument: if it matches a real filesystem path // then we use this to override the mod search path, and replace it with the mod id var modID = args.GetValue("Game.Mod", null); diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index b54119ff00..ff0bb07f51 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -287,7 +287,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { // Send the mod and engine version to support version-filtered news (update prompts) newsURL += "?version={0}&mod={1}&modversion={2}".F( - Uri.EscapeUriString(Game.Mods["modcontent"].Metadata.Version), + Uri.EscapeUriString(Game.EngineVersion), Uri.EscapeUriString(Game.ModData.Manifest.Id), Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version)); diff --git a/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs index 5fc15fd70e..680ae5fb94 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs @@ -362,7 +362,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic }; var queryURL = services.ServerList + "games?version={0}&mod={1}&modversion={2}".F( - Uri.EscapeUriString(Game.Mods["modcontent"].Metadata.Version), + Uri.EscapeUriString(Game.EngineVersion), Uri.EscapeUriString(Game.ModData.Manifest.Id), Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version));