Changed ServerSettings cloning to a more reliable approach

This commit is contained in:
Thehx
2015-11-13 05:47:40 +03:00
parent 7b0c9b7bf5
commit 6bd3195c3d
3 changed files with 4 additions and 22 deletions

View File

@@ -358,7 +358,7 @@ namespace OpenRA
{ {
Settings.Server.Map = WidgetUtils.ChooseInitialMap(Settings.Server.Map); Settings.Server.Map = WidgetUtils.ChooseInitialMap(Settings.Server.Map);
Settings.Save(); Settings.Save();
CreateServer(new ServerSettings(Settings.Server)); CreateServer(Settings.Server.Clone());
while (true) while (true)
{ {

View File

@@ -74,27 +74,9 @@ namespace OpenRA
public string TimestampFormat = "s"; public string TimestampFormat = "s";
public ServerSettings() { } public ServerSettings Clone()
public ServerSettings(ServerSettings other)
{ {
Name = other.Name; return (ServerSettings)MemberwiseClone();
ListenPort = other.ListenPort;
ExternalPort = other.ExternalPort;
AdvertiseOnline = other.AdvertiseOnline;
Password = other.Password;
MasterServer = other.MasterServer;
DiscoverNatDevices = other.DiscoverNatDevices;
AllowPortForward = other.AllowPortForward;
NatDeviceAvailable = other.NatDeviceAvailable;
NatDiscoveryTimeout = other.NatDiscoveryTimeout;
VerboseNatDiscovery = other.VerboseNatDiscovery;
Map = other.Map;
Ban = other.Ban;
TimeOut = other.TimeOut;
Dedicated = other.Dedicated;
DedicatedLoop = other.DedicatedLoop;
LockBots = other.LockBots;
} }
} }

View File

@@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Game.Settings.Save(); Game.Settings.Save();
// Take a copy so that subsequent changes don't affect the server // Take a copy so that subsequent changes don't affect the server
var settings = new ServerSettings(Game.Settings.Server); var settings = Game.Settings.Server.Clone();
// Create and join the server // Create and join the server
try try