Implement new server-connection mod switching logic.

This commit is contained in:
Paul Chote
2017-01-20 20:29:51 +00:00
parent 4d982f00e4
commit 2da4e87b94
7 changed files with 292 additions and 15 deletions

View File

@@ -140,14 +140,20 @@ namespace OpenRA.Network
Game.Mods.TryGetValue(request.Mod, out serverMod) &&
serverMod.Metadata.Version == request.Version)
{
var replay = orderManager.Connection as ReplayConnection;
var launchCommand = replay != null ?
"Launch.Replay=" + replay.Filename :
"Launch.Connect=" + orderManager.Host + ":" + orderManager.Port;
Game.ModData.LoadScreen.Display();
Game.InitializeMod(request.Mod, new Arguments(launchCommand));
// The ConnectionFailedLogic will prompt the user to switch mods
orderManager.ServerMod = serverMod;
orderManager.Connection.Dispose();
break;
}
var externalKey = ExternalMod.MakeKey(request.Mod, request.Version);
ExternalMod external;
if ((request.Mod != mod.Id || request.Version != mod.Metadata.Version)
&& Game.ExternalMods.TryGetValue(externalKey, out external))
{
// The ConnectionFailedLogic will prompt the user to switch mods
orderManager.ServerExternalMod = external;
orderManager.Connection.Dispose();
break;
}
@@ -187,6 +193,7 @@ namespace OpenRA.Network
case "AuthenticationError":
{
// The ConnectionFailedLogic will prompt the user for the password
orderManager.ServerError = order.TargetString;
orderManager.AuthenticationFailed = true;
break;