moved randoms onto World (reqd for side-by-side worlds, also fixes some obscure desyncs)

This commit is contained in:
Chris Forbes
2010-02-13 21:06:02 +13:00
parent c026796c04
commit 641c21107e
9 changed files with 17 additions and 17 deletions

View File

@@ -177,9 +177,6 @@ namespace OpenRa
PerfHistory.items["batches"].Tick();
}
public static Random SharedRandom = new Random(0); /* for things that require sync */
public static Random CosmeticRandom = new Random(); /* for things that are just fluff */
public static void SyncLobbyInfo(string data)
{
var session = new Session();
@@ -256,7 +253,7 @@ namespace OpenRa
throw new InvalidOperationException("No free spawnpoint.");
var n = taken.Count == 0
? Game.SharedRandom.Next(available.Count)
? world.SharedRandom.Next(available.Count)
: available // pick the most distant spawnpoint from everyone else
.Select((k,i) => Pair.New(k,i))
.OrderByDescending(a => taken.Sum(t => (t - a.First).LengthSquared))