fix #1320 bogus use of Game.CosmeticRandom from server thread

This commit is contained in:
Chris Forbes
2012-01-07 19:09:51 +13:00
parent 1de3db0903
commit c169bc3c51
2 changed files with 4 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ namespace OpenRA.Server
public readonly IPAddress Ip; public readonly IPAddress Ip;
public readonly int Port; public readonly int Port;
int randomSeed; int randomSeed;
public readonly Thirdparty.Random Random = new Thirdparty.Random();
public ServerSettings Settings; public ServerSettings Settings;
public ModData ModData; public ModData ModData;

View File

@@ -210,9 +210,9 @@ namespace OpenRA.Mods.RA.Server
}; };
// pick a random color for the bot // pick a random color for the bot
var hue = (byte)Game.CosmeticRandom.Next(255); var hue = (byte)server.Random.Next(255);
var sat = (byte)Game.CosmeticRandom.Next(255); var sat = (byte)server.Random.Next(255);
var lum = (byte)Game.CosmeticRandom.Next(51,255); var lum = (byte)server.Random.Next(51,255);
bot.ColorRamp = new ColorRamp(hue, sat, lum, 10); bot.ColorRamp = new ColorRamp(hue, sat, lum, 10);
server.lobbyInfo.Clients.Add(bot); server.lobbyInfo.Clients.Add(bot);