Add WorldRenderer parameter to WorldLoaded.

This commit is contained in:
Paul Chote
2013-09-27 15:20:49 +12:00
parent c26a0cb222
commit cad46e43c5
28 changed files with 67 additions and 38 deletions

View File

@@ -213,8 +213,11 @@ namespace OpenRA
viewport = new Viewport(new int2(Renderer.Resolution), map.Bounds, Renderer); viewport = new Viewport(new int2(Renderer.Resolution), map.Bounds, Renderer);
orderManager.world = new World(modData.Manifest, map, orderManager, isShellmap); orderManager.world = new World(modData.Manifest, map, orderManager, isShellmap);
worldRenderer = new WorldRenderer(orderManager.world); worldRenderer = new WorldRenderer(orderManager.world);
orderManager.world.LoadComplete(worldRenderer);
if (orderManager.GameStarted)
return;
if (orderManager.GameStarted) return;
Ui.MouseFocusWidget = null; Ui.MouseFocusWidget = null;
Ui.KeyboardFocusWidget = null; Ui.KeyboardFocusWidget = null;

View File

@@ -174,7 +174,7 @@ namespace OpenRA.Traits
public interface UsesInit<T> where T : IActorInit { } public interface UsesInit<T> where T : IActorInit { }
public interface INotifySelection { void SelectionChanged(); } public interface INotifySelection { void SelectionChanged(); }
public interface IWorldLoaded { void WorldLoaded(World w); } public interface IWorldLoaded { void WorldLoaded(World w, WorldRenderer wr); }
public interface ICreatePlayers { void CreatePlayers(World w); } public interface ICreatePlayers { void CreatePlayers(World w); }
public interface IBotInfo { string Name { get; } } public interface IBotInfo { string Name { get; } }

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Traits
} }
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
this.world = w; this.world = w;
content = new CellContents[w.Map.MapSize.X, w.Map.MapSize.Y]; content = new CellContents[w.Map.MapSize.X, w.Map.MapSize.Y];

View File

@@ -135,8 +135,12 @@ namespace OpenRA
p.Stances[q] = Stance.Neutral; p.Stances[q] = Stance.Neutral;
Sound.SoundVolumeModifier = 1.0f; Sound.SoundVolumeModifier = 1.0f;
}
public void LoadComplete(WorldRenderer wr)
{
foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>()) foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>())
wlh.WorldLoaded(this); wlh.WorldLoaded(this, wr);
} }
public Actor CreateActor( string name, TypeDictionary initDict ) public Actor CreateActor( string name, TypeDictionary initDict )

View File

@@ -11,6 +11,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Traits; using OpenRA.Traits;
@@ -24,7 +25,7 @@ namespace OpenRA.Mods.RA
static CPos viewportOrigin; static CPos viewportOrigin;
Dictionary<string, Actor> actors; Dictionary<string, Actor> actors;
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
var b = w.Map.Bounds; var b = w.Map.Bounds;
viewportOrigin = new CPos(b.Left + b.Width / 2, b.Top + b.Height / 2); viewportOrigin = new CPos(b.Left + b.Width / 2, b.Top + b.Height / 2);

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA; using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
@@ -28,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Missions
Dictionary<string, Actor> actors; Dictionary<string, Actor> actors;
Dictionary<string, Player> players; Dictionary<string, Player> players;
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
players = w.Players.ToDictionary(p => p.InternalName); players = w.Players.ToDictionary(p => p.InternalName);
actors = w.WorldActor.Trait<SpawnMapActors>().Actors; actors = w.WorldActor.Trait<SpawnMapActors>().Actors;

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.Cnc; using OpenRA.Mods.Cnc;
using OpenRA.Mods.RA; using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
@@ -162,7 +163,7 @@ namespace OpenRA.Mods.Cnc.Missions
nr3.QueueActivity(nr3.Trait<Mobile>().ScriptedMove(nr3.Location - new CVec(0, -5))); nr3.QueueActivity(nr3.Trait<Mobile>().ScriptedMove(nr3.Location - new CVec(0, -5)));
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;
nod = w.Players.Single(p => p.InternalName == "NOD"); nod = w.Players.Single(p => p.InternalName == "NOD");

View File

@@ -11,6 +11,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -36,7 +37,7 @@ namespace OpenRA.Mods.RA
this.world = self.World; this.world = self.World;
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
Bridges = new Bridge[w.Map.MapSize.X, w.Map.MapSize.Y]; Bridges = new Bridge[w.Map.MapSize.X, w.Map.MapSize.Y];

View File

@@ -8,6 +8,7 @@
*/ */
#endregion #endregion
using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Widgets; using OpenRA.Widgets;
@@ -28,7 +29,7 @@ namespace OpenRA.Mods.RA
this.Info = Info; this.Info = Info;
} }
public void WorldLoaded(World world) public void WorldLoaded(World world, WorldRenderer wr)
{ {
// Clear any existing widget state // Clear any existing widget state
if (Info.ClearRoot) if (Info.ClearRoot)

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Network; using OpenRA.Network;
using OpenRA.Traits; using OpenRA.Traits;
@@ -26,7 +27,7 @@ namespace OpenRA.Mods.RA
{ {
public Dictionary<Player, CPos> Start = new Dictionary<Player, CPos>(); public Dictionary<Player, CPos> Start = new Dictionary<Player, CPos>();
public void WorldLoaded(World world) public void WorldLoaded(World world, WorldRenderer wr)
{ {
var taken = world.LobbyInfo.Clients.Where(c => c.SpawnPoint != 0 && c.Slot != null) var taken = world.LobbyInfo.Clients.Where(c => c.SpawnPoint != 0 && c.Slot != null)
.Select(c => (CPos) world.Map.GetSpawnPoints()[c.SpawnPoint-1]).ToList(); .Select(c => (CPos) world.Map.GetSpawnPoints()[c.SpawnPoint-1]).ToList();

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
@@ -274,7 +275,7 @@ namespace OpenRA.Mods.RA.Missions
actor.Trait<AutoTarget>().stance = UnitStance.Defend; actor.Trait<AutoTarget>().stance = UnitStance.Defend;
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
@@ -270,7 +271,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
new LocationInit(yakEntryPoint.Location), new LocationInit(yakEntryPoint.Location),
new OwnerInit(soviets), new OwnerInit(soviets),
new FacingInit(Util.GetFacing(yakAttackPoint.Location - yakEntryPoint.Location, 0)), new FacingInit(Traits.Util.GetFacing(yakAttackPoint.Location - yakEntryPoint.Location, 0)),
new AltitudeInit(Rules.Info[YakName].Traits.Get<PlaneInfo>().CruiseAltitude) new AltitudeInit(Rules.Info[YakName].Traits.Get<PlaneInfo>().CruiseAltitude)
}); });
} }
@@ -405,7 +406,7 @@ namespace OpenRA.Mods.RA.Missions
unit.QueueActivity(new AttackMove.AttackMoveActivity(unit, new Move.Move(townPoint.Location, SovietTownMoveNearEnough))); unit.QueueActivity(new AttackMove.AttackMoveActivity(unit, new Move.Move(townPoint.Location, SovietTownMoveNearEnough)));
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
@@ -335,7 +336,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
new OwnerInit(owner), new OwnerInit(owner),
new LocationInit(entry), new LocationInit(entry),
new FacingInit(Util.GetFacing(to - entry, 0)) new FacingInit(Traits.Util.GetFacing(to - entry, 0))
}); });
unit.QueueActivity(new Move.Move(to)); unit.QueueActivity(new Move.Move(to));
return unit; return unit;
@@ -380,7 +381,7 @@ namespace OpenRA.Mods.RA.Missions
} }
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
@@ -350,7 +351,7 @@ namespace OpenRA.Mods.RA.Missions
actor.Trait<AutoTarget>().stance = UnitStance.Defend; actor.Trait<AutoTarget>().stance = UnitStance.Defend;
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -11,6 +11,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Traits; using OpenRA.Traits;
@@ -23,7 +24,7 @@ namespace OpenRA.Mods.RA
Dictionary<string, Actor> Actors; Dictionary<string, Actor> Actors;
static CPos ViewportOrigin; static CPos ViewportOrigin;
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
var b = w.Map.Bounds; var b = w.Map.Bounds;
ViewportOrigin = new CPos(b.Left + b.Width/2, b.Top + b.Height/2); ViewportOrigin = new CPos(b.Left + b.Width/2, b.Top + b.Height/2);

View File

@@ -11,6 +11,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
@@ -90,7 +91,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
var actor = OffmapAttackers.Random(world.SharedRandom); var actor = OffmapAttackers.Random(world.SharedRandom);
var spawn = offmapAttackerSpawns.Random(world.SharedRandom); var spawn = offmapAttackerSpawns.Random(world.SharedRandom);
var u = world.CreateActor(actor, soviets, spawn.Location, Util.GetFacing(attackLocation.Location - spawn.Location, 0)); var u = world.CreateActor(actor, soviets, spawn.Location, Traits.Util.GetFacing(attackLocation.Location - spawn.Location, 0));
var cargo = u.TraitOrDefault<Cargo>(); var cargo = u.TraitOrDefault<Cargo>();
if (cargo != null) if (cargo != null)
{ {
@@ -176,7 +177,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
foreach (var tank in HeavyTanks) foreach (var tank in HeavyTanks)
{ {
var u = world.CreateActor(tank, soviets, heavyTankSpawn.Location, Util.GetFacing(heavyTankWP.Location - heavyTankSpawn.Location, 0)); var u = world.CreateActor(tank, soviets, heavyTankSpawn.Location, Traits.Util.GetFacing(heavyTankWP.Location - heavyTankSpawn.Location, 0));
u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(heavyTankWP.Location, 0))); u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(heavyTankWP.Location, 0)));
} }
ironCurtain.Trait<IronCurtainPower>().Activate(ironCurtain, new Order { TargetLocation = heavyTankSpawn.Location }); ironCurtain.Trait<IronCurtainPower>().Activate(ironCurtain, new Order { TargetLocation = heavyTankSpawn.Location });
@@ -187,7 +188,7 @@ namespace OpenRA.Mods.RA.Missions
var chronoInfo = new List<Pair<Actor, CPos>>(); var chronoInfo = new List<Pair<Actor, CPos>>();
foreach (var tank in MediumTanks.Select((x, i) => new { x, i })) foreach (var tank in MediumTanks.Select((x, i) => new { x, i }))
{ {
var u = world.CreateActor(tank.x, allies, mediumTankChronoSpawn.Location, Util.GetFacing(heavyTankWP.Location - mediumTankChronoSpawn.Location, 0)); var u = world.CreateActor(tank.x, allies, mediumTankChronoSpawn.Location, Traits.Util.GetFacing(heavyTankWP.Location - mediumTankChronoSpawn.Location, 0));
chronoInfo.Add(Pair.New(u, new CPos(mediumTankChronoSpawn.Location.X + tank.i, mediumTankChronoSpawn.Location.Y))); chronoInfo.Add(Pair.New(u, new CPos(mediumTankChronoSpawn.Location.X + tank.i, mediumTankChronoSpawn.Location.Y)));
} }
RASpecialPowers.Chronoshift(world, chronoInfo, chronosphere, -1, false); RASpecialPowers.Chronoshift(world, chronoInfo, chronosphere, -1, false);
@@ -201,7 +202,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
new OwnerInit(soviets), new OwnerInit(soviets),
new LocationInit(waypoints[0]), new LocationInit(waypoints[0]),
new FacingInit(Util.GetFacing(waypoints[1] - waypoints[0], 0)) new FacingInit(Traits.Util.GetFacing(waypoints[1] - waypoints[0], 0))
}); });
foreach (var waypoint in waypoints) foreach (var waypoint in waypoints)
m.QueueActivity(Fly.ToCell(waypoint)); m.QueueActivity(Fly.ToCell(waypoint));
@@ -210,7 +211,7 @@ namespace OpenRA.Mods.RA.Missions
void SendChinookReinforcements(CPos entry, Actor lz) void SendChinookReinforcements(CPos entry, Actor lz)
{ {
var chinook = world.CreateActor("tran", allies, entry, Util.GetFacing(lz.Location - entry, 0)); var chinook = world.CreateActor("tran", allies, entry, Traits.Util.GetFacing(lz.Location - entry, 0));
var cargo = chinook.Trait<Cargo>(); var cargo = chinook.Trait<Cargo>();
while (cargo.HasSpace(1)) while (cargo.HasSpace(1))
@@ -234,7 +235,7 @@ namespace OpenRA.Mods.RA.Missions
alliedWarFactory.Trait<PrimaryBuilding>().SetPrimaryProducer(alliedWarFactory, true); alliedWarFactory.Trait<PrimaryBuilding>().SetPrimaryProducer(alliedWarFactory, true);
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -12,6 +12,7 @@ using System;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
@@ -342,7 +343,7 @@ namespace OpenRA.Mods.RA.Missions
bool SpawnVehicles = true; bool SpawnVehicles = true;
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;
soviets = w.Players.Single(p => p.InternalName == "Soviets"); soviets = w.Players.Single(p => p.InternalName == "Soviets");

View File

@@ -11,6 +11,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
@@ -258,7 +259,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
Sound.Play("reinfor1.aud"); Sound.Play("reinfor1.aud");
foreach (var unit in units) foreach (var unit in units)
world.CreateActor(unit, greece, startEntryPoint.Location, Util.GetFacing(startBridgeEndPoint.CenterPosition - startEntryPoint.CenterPosition, 0)) world.CreateActor(unit, greece, startEntryPoint.Location, Traits.Util.GetFacing(startBridgeEndPoint.CenterPosition - startEntryPoint.CenterPosition, 0))
.QueueActivity(new Move.Move(startMovePoint.Location, 0)); .QueueActivity(new Move.Move(startMovePoint.Location, 0));
} }
@@ -266,7 +267,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
Sound.Play("reinfor1.aud"); Sound.Play("reinfor1.aud");
foreach (var unit in units) foreach (var unit in units)
world.CreateActor(unit, greece, alliedBaseEntryPoint.Location, Util.GetFacing(alliedBaseMovePoint.CenterPosition - alliedBaseEntryPoint.CenterPosition, 0)) world.CreateActor(unit, greece, alliedBaseEntryPoint.Location, Traits.Util.GetFacing(alliedBaseMovePoint.CenterPosition - alliedBaseEntryPoint.CenterPosition, 0))
.QueueActivity(new Move.Move(alliedBaseMovePoint.Location, 0)); .QueueActivity(new Move.Move(alliedBaseMovePoint.Location, 0));
} }
@@ -294,7 +295,7 @@ namespace OpenRA.Mods.RA.Missions
OnObjectivesUpdated(true); OnObjectivesUpdated(true);
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
@@ -107,7 +108,7 @@ namespace OpenRA.Mods.RA.Missions
{ {
new OwnerInit(ussr), new OwnerInit(ussr),
new LocationInit(entry), new LocationInit(entry),
new FacingInit(Util.GetFacing(airfield.Location - entry, 0)), new FacingInit(Traits.Util.GetFacing(airfield.Location - entry, 0)),
new AltitudeInit(Rules.Info["yak"].Traits.Get<PlaneInfo>().CruiseAltitude) new AltitudeInit(Rules.Info["yak"].Traits.Get<PlaneInfo>().CruiseAltitude)
}); });
@@ -133,7 +134,7 @@ namespace OpenRA.Mods.RA.Missions
})); }));
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
@@ -271,7 +272,7 @@ namespace OpenRA.Mods.RA.Missions
OnObjectivesUpdated(true); OnObjectivesUpdated(true);
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;

View File

@@ -13,6 +13,7 @@ using System.Linq;
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Traits; using OpenRA.Traits;
@@ -351,7 +352,7 @@ namespace OpenRA.Mods.RA.Missions
bool producing = true; bool producing = true;
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;
allies = w.Players.SingleOrDefault(p => p.InternalName == "Allies"); allies = w.Players.SingleOrDefault(p => p.InternalName == "Allies");

View File

@@ -12,6 +12,7 @@ using System;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Traits; using OpenRA.Traits;
@@ -21,7 +22,7 @@ namespace OpenRA.Mods.RA
public class SpawnMPUnits : IWorldLoaded public class SpawnMPUnits : IWorldLoaded
{ {
public void WorldLoaded(World world) public void WorldLoaded(World world, WorldRenderer wr)
{ {
foreach (var s in world.WorldActor.Trait<MPStartLocations>().Start) foreach (var s in world.WorldActor.Trait<MPStartLocations>().Start)
SpawnUnitsForPlayer(world, s.Key, s.Value); SpawnUnitsForPlayer(world, s.Key, s.Value);

View File

@@ -10,6 +10,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -20,7 +21,7 @@ namespace OpenRA.Mods.RA
{ {
public Dictionary<string, Actor> Actors = new Dictionary<string, Actor>(); public Dictionary<string, Actor> Actors = new Dictionary<string, Actor>();
public void WorldLoaded(World world) public void WorldLoaded(World world, WorldRenderer wr)
{ {
foreach (var actorReference in world.Map.Actors.Value) foreach (var actorReference in world.Map.Actors.Value)
{ {

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
World world; World world;
public bool Visible; public bool Visible;
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
this.world = w; this.world = w;
this.refreshTick = 0; this.refreshTick = 0;

View File

@@ -14,6 +14,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Support; using OpenRA.Support;
using OpenRA.Traits; using OpenRA.Traits;
@@ -27,7 +28,7 @@ namespace OpenRA.Mods.RA
{ {
Dictionary<uint, MovementClassDomainIndex> domainIndexes; Dictionary<uint, MovementClassDomainIndex> domainIndexes;
public void WorldLoaded(World world) public void WorldLoaded(World world, WorldRenderer wr)
{ {
domainIndexes = new Dictionary<uint, MovementClassDomainIndex>(); domainIndexes = new Dictionary<uint, MovementClassDomainIndex>();
var movementClasses = new HashSet<uint>( var movementClasses = new HashSet<uint>(

View File

@@ -11,6 +11,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Widgets; using OpenRA.Widgets;
@@ -30,7 +31,7 @@ namespace OpenRA.Mods.RA
public PlayMusicOnMapLoad(PlayMusicOnMapLoadInfo info) { Info = info; } public PlayMusicOnMapLoad(PlayMusicOnMapLoadInfo info) { Info = info; }
public void WorldLoaded(World w) { PlayMusic(); } public void WorldLoaded(World w, WorldRenderer wr) { PlayMusic(); }
void PlayMusic() void PlayMusic()
{ {

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -34,7 +35,7 @@ namespace OpenRA.Mods.RA
} }
} }
public void WorldLoaded(OpenRA.World w) public void WorldLoaded(OpenRA.World w, WorldRenderer wr)
{ {
// NOTE(jsd): 32 seems a sane default initial capacity for the total # of harvesters in a game. Purely a guesstimate. // NOTE(jsd): 32 seems a sane default initial capacity for the total # of harvesters in a game. Purely a guesstimate.
claimByCell = new Dictionary<CPos, ResourceClaim>(32); claimByCell = new Dictionary<CPos, ResourceClaim>(32);

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA
smudgeSprites = Info.Types.Select(x => Game.modData.SpriteLoader.LoadAllSprites(x)).ToArray(); smudgeSprites = Info.Types.Select(x => Game.modData.SpriteLoader.LoadAllSprites(x)).ToArray();
} }
public void WorldLoaded(World w) public void WorldLoaded(World w, WorldRenderer wr)
{ {
world = w; world = w;
tiles = new Dictionary<CPos, TileReference<byte, byte>>(); tiles = new Dictionary<CPos, TileReference<byte, byte>>();