server picks random seed for world.SharedRandom
This commit is contained in:
@@ -52,6 +52,7 @@ namespace OpenRA.FileFormats
|
||||
public string[] Packages = {}; // filename:sha1 pairs.
|
||||
public string[] Mods = { "ra" }; // mod names
|
||||
public int OrderLatency = 3;
|
||||
public int RandomSeed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -234,6 +234,9 @@ namespace OpenRA
|
||||
|
||||
LobbyInfo = session;
|
||||
|
||||
if (!IsStarted)
|
||||
world.SharedRandom = new OpenRA.Thirdparty.Random(LobbyInfo.GlobalSettings.RandomSeed);
|
||||
|
||||
if (Game.orderManager.Connection.ConnectionState == ConnectionState.Connected)
|
||||
world.SetLocalPlayer(Game.orderManager.Connection.LocalClientId);
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace OpenRA.Server
|
||||
static string Name;
|
||||
static WebClient wc = new WebClient();
|
||||
static int ExternalPort;
|
||||
static int randomSeed;
|
||||
|
||||
const int DownloadChunkInterval = 20000;
|
||||
const int DownloadChunkSize = 16384;
|
||||
@@ -61,9 +62,11 @@ namespace OpenRA.Server
|
||||
initialMods = mods;
|
||||
Name = name;
|
||||
ExternalPort = extport;
|
||||
randomSeed = (int)DateTime.Now.ToBinary();
|
||||
|
||||
lobbyInfo = new Session();
|
||||
lobbyInfo.GlobalSettings.Mods = mods;
|
||||
lobbyInfo.GlobalSettings.RandomSeed = randomSeed;
|
||||
|
||||
Console.WriteLine("Initial mods: ");
|
||||
foreach( var m in lobbyInfo.GlobalSettings.Mods )
|
||||
@@ -548,6 +551,7 @@ namespace OpenRA.Server
|
||||
inFlightFrames.Clear();
|
||||
lobbyInfo = new Session();
|
||||
lobbyInfo.GlobalSettings.Mods = initialMods;
|
||||
lobbyInfo.GlobalSettings.RandomSeed = randomSeed;
|
||||
GameStarted = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user