Merge pull request #5359 from Mailaender/mersenne-twister

Renamed OpenRA.Support.Random aka XRandom to MersenneTwister
This commit is contained in:
Paul Chote
2014-05-19 11:07:21 +12:00
15 changed files with 32 additions and 31 deletions

View File

@@ -18,7 +18,7 @@ using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move;
using OpenRA.Traits;
using OpenRA.Primitives;
using XRandom = OpenRA.Support.Random;
using OpenRA.Support;
namespace OpenRA.Mods.RA.AI
{
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA.AI
bool enabled;
public int ticks;
public Player p;
public XRandom random;
public MersenneTwister random;
public CPos baseCenter;
PowerManager playerPower;
SupportPowerManager supportPowerMngr;
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.RA.AI
new BaseBuilder(this, "Defense", q => ChooseBuildingToBuild(q, true))
};
random = new XRandom((int)p.PlayerActor.ActorID);
random = new MersenneTwister((int)p.PlayerActor.ActorID);
resourceTypes = Map.Rules.Actors["world"].Traits.WithInterface<ResourceTypeInfo>()
.Select(t => t.TerrainType).ToArray();

View File

@@ -10,8 +10,8 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.Support;
using OpenRA.Traits;
using XRandom = OpenRA.Support.Random;
namespace OpenRA.Mods.RA.AI
{
@@ -24,12 +24,11 @@ namespace OpenRA.Mods.RA.AI
internal World world;
internal HackyAI bot;
internal XRandom random;
internal MersenneTwister random;
internal Target target;
internal StateMachine fsm;
//fuzzy
internal AttackOrFleeFuzzy attackOrFleeFuzzy = new AttackOrFleeFuzzy();
public Squad(HackyAI bot, SquadType type) : this(bot, type, null) { }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.RA.Render;
using OpenRA.Traits;
using OpenRA.Support;
namespace OpenRA.Mods.RA
{
@@ -69,7 +70,7 @@ namespace OpenRA.Mods.RA
}
static IEnumerable<CPos> RandomWalk(CPos p, Support.Random r)
static IEnumerable<CPos> RandomWalk(CPos p, MersenneTwister r)
{
for (; ; )
{

View File

@@ -11,13 +11,13 @@
using System;
using OpenRA.Traits;
using OpenRA.Widgets;
using XRandom = OpenRA.Support.Random;
using OpenRA.Support;
namespace OpenRA.Mods.RA.Widgets.Logic
{
public class CheatsLogic
{
public static XRandom CosmeticRandom = new XRandom();
public static MersenneTwister CosmeticRandom = new MersenneTwister();
[ObjectCreator.UseCtor]
public CheatsLogic(Widget widget, Action onExit, World world)

View File

@@ -15,6 +15,7 @@ using System.IO;
using System.Linq;
using System.Net;
using OpenRA.FileFormats;
using OpenRA.Support;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA.Widgets.Logic
@@ -127,7 +128,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (!string.IsNullOrEmpty(line))
mirrorList.Add(line);
}
mirror = mirrorList.Random(new OpenRA.Support.Random());
mirror = mirrorList.Random(new MersenneTwister());
// Save the package to a temp file
var dl = new Download(mirror, file, onDownloadProgress, onDownloadComplete);