From 7729d31b6a5b601800c7bfe9bfc796591c054b9f Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 9 Feb 2010 13:23:09 +1300 Subject: [PATCH] remove special case in World for InitOreDensity() --- OpenRa.Game/Traits/OreGrowth.cs | 7 ++++++- OpenRa.Game/World.cs | 7 +------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenRa.Game/Traits/OreGrowth.cs b/OpenRa.Game/Traits/OreGrowth.cs index 3fbf09b061..f79b21decc 100644 --- a/OpenRa.Game/Traits/OreGrowth.cs +++ b/OpenRa.Game/Traits/OreGrowth.cs @@ -16,7 +16,7 @@ namespace OpenRa.Traits public object Create(Actor self) { return new OreGrowth(); } } - class OreGrowth : ITick + class OreGrowth : ITick, ILoadWorldHook { int remainingTicks; @@ -38,5 +38,10 @@ namespace OpenRa.Traits remainingTicks = (int)(info.Interval * 60 * 25); } } + + public void WorldLoaded(World w) + { + Ore.InitOreDensity(w.Map); + } } } diff --git a/OpenRa.Game/World.cs b/OpenRa.Game/World.cs index f087859c01..584131b246 100644 --- a/OpenRa.Game/World.cs +++ b/OpenRa.Game/World.cs @@ -34,7 +34,6 @@ namespace OpenRa } if (!string.IsNullOrEmpty(Game.Settings.PlayerName) && LocalPlayer.PlayerName != Game.Settings.PlayerName) Game.IssueOrder(Order.Chat("/name " + Game.Settings.PlayerName)); - } public readonly Actor WorldActor; @@ -63,15 +62,11 @@ namespace OpenRa WorldRenderer = new WorldRenderer(this, Game.renderer); Timer.Time("renderer: {0}"); - Map.InitOreDensity(); - Timer.Time( "Ore: {0}" ); - WorldActor = CreateActor("World", new int2(int.MaxValue, int.MaxValue), null); for (int i = 0; i < 8; i++) - { players[i] = new Player(this, i, Game.LobbyInfo.Clients.FirstOrDefault(a => a.Index == i)); - } + Timer.Time( "worldActor, players: {0}" ); Queries = new AllQueries( this );