moved oreTick to World. moved call to UIM.Tick() to World.
This commit is contained in:
@@ -98,9 +98,6 @@ namespace OpenRa
|
||||
|
||||
chrome = new Chrome(renderer);
|
||||
|
||||
oreFrequency = (int)(Rules.General.GrowthRate * 60 * 25);
|
||||
oreTicks = oreFrequency;
|
||||
|
||||
SpawnPoints = Rules.AllRules.GetSection("Waypoints")
|
||||
.Select(kv => Pair.New(int.Parse(kv.Key), new int2(int.Parse(kv.Value) % 128, int.Parse(kv.Value) / 128)))
|
||||
.Where(a => a.First < 8)
|
||||
@@ -158,8 +155,6 @@ namespace OpenRa
|
||||
lastTime = Environment.TickCount;
|
||||
}
|
||||
|
||||
static int oreFrequency;
|
||||
static int oreTicks;
|
||||
public static int RenderFrame = 0;
|
||||
|
||||
internal static Chat chat = new Chat();
|
||||
@@ -192,16 +187,7 @@ namespace OpenRa
|
||||
if (controller.orderGenerator != null)
|
||||
controller.orderGenerator.Tick();
|
||||
|
||||
if (--oreTicks == 0)
|
||||
using (new PerfSample("ore"))
|
||||
{
|
||||
Game.world.Map.GrowOre(SharedRandom);
|
||||
minimap.InvalidateOre();
|
||||
oreTicks = oreFrequency;
|
||||
}
|
||||
|
||||
world.Tick();
|
||||
Game.world.UnitInfluence.Tick();
|
||||
foreach (var player in players.Values)
|
||||
player.Tick();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@ namespace OpenRa
|
||||
public readonly Map Map;
|
||||
public readonly TileSet TileSet;
|
||||
|
||||
readonly int oreFrequency;
|
||||
int oreTicks;
|
||||
|
||||
public World()
|
||||
{
|
||||
Map = new Map( Rules.AllRules );
|
||||
@@ -27,6 +30,9 @@ namespace OpenRa
|
||||
BuildingInfluence = new BuildingInfluenceMap();
|
||||
UnitInfluence = new UnitInfluenceMap();
|
||||
|
||||
oreFrequency = (int)(Rules.General.GrowthRate * 60 * 25);
|
||||
oreTicks = oreFrequency;
|
||||
|
||||
CreateActor("World", new int2(int.MaxValue, int.MaxValue), null);
|
||||
}
|
||||
|
||||
@@ -61,6 +67,14 @@ namespace OpenRa
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
if (--oreTicks == 0)
|
||||
using( new PerfSample( "ore" ) )
|
||||
{
|
||||
Map.GrowOre( Game.SharedRandom );
|
||||
Game.minimap.InvalidateOre();
|
||||
oreTicks = oreFrequency;
|
||||
}
|
||||
|
||||
foreach (var a in actors) a.Tick();
|
||||
foreach (var e in effects) e.Tick();
|
||||
|
||||
@@ -69,6 +83,8 @@ namespace OpenRa
|
||||
var acts = frameEndActions;
|
||||
frameEndActions = new List<Action<World>>();
|
||||
foreach (var a in acts) a(this);
|
||||
|
||||
UnitInfluence.Tick();
|
||||
}
|
||||
|
||||
public IEnumerable<Actor> Actors { get { return actors; } }
|
||||
|
||||
Reference in New Issue
Block a user