move CosmeticRandom to game

This commit is contained in:
Bob
2010-04-13 22:00:32 +12:00
committed by Chris Forbes
parent 9b0ce4ff62
commit c3f1ec9ed2
4 changed files with 7 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Effects
Args.dest += (info.Inaccuracy * factor * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2(); Args.dest += (info.Inaccuracy * factor * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2();
} }
VisualDest = Args.dest + (10 * args.firedBy.World.CosmeticRandom.Gauss2D(1)).ToInt2(); VisualDest = Args.dest + (10 * Game.CosmeticRandom.Gauss2D(1)).ToInt2();
if (Info.Image != null) if (Info.Image != null)
{ {

View File

@@ -31,7 +31,9 @@ using OpenRA.Graphics;
using OpenRA.Network; using OpenRA.Network;
using OpenRA.Support; using OpenRA.Support;
using OpenRA.Traits; using OpenRA.Traits;
using Timer = OpenRA.Support.Timer; using Timer = OpenRA.Support.Timer;
using XRandom = OpenRA.Thirdparty.Random;
namespace OpenRA namespace OpenRA
{ {
@@ -49,6 +51,8 @@ namespace OpenRA
public static bool skipMakeAnims = true; public static bool skipMakeAnims = true;
public static XRandom CosmeticRandom = new XRandom(); // not synced
internal static Renderer renderer; internal static Renderer renderer;
static int2 clientSize; static int2 clientSize;
static string mapName; static string mapName;

View File

@@ -67,7 +67,7 @@ namespace OpenRA.GameRules
if (liveclips.Count == 0) if (liveclips.Count == 0)
return null; /* avoid crashing if there's no clips at all */ return null; /* avoid crashing if there's no clips at all */
var i = Game.world.CosmeticRandom.Next(liveclips.Count); var i = Game.CosmeticRandom.Next(liveclips.Count);
var s = liveclips[i]; var s = liveclips[i];
liveclips.RemoveAt(i); liveclips.RemoveAt(i);
return s; return s;

View File

@@ -39,8 +39,7 @@ namespace OpenRA
List<IEffect> effects = new List<IEffect>(); List<IEffect> effects = new List<IEffect>();
List<Action<World>> frameEndActions = new List<Action<World>>(); List<Action<World>> frameEndActions = new List<Action<World>>();
public XRandom SharedRandom = new XRandom(0); // synced public XRandom SharedRandom = new XRandom(0);
public XRandom CosmeticRandom = new XRandom(); // not synced
public readonly Dictionary<int, Player> players = new Dictionary<int, Player>(); public readonly Dictionary<int, Player> players = new Dictionary<int, Player>();