added World.NeutralPlayer
This commit is contained in:
@@ -29,7 +29,6 @@ using OpenRA.Orders;
|
|||||||
using OpenRA.Support;
|
using OpenRA.Support;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
using OpenRA.Network;
|
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -120,11 +120,12 @@ namespace OpenRA
|
|||||||
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
||||||
Timer.Time( "ChromeProv, SeqProv, viewport: {0}" );
|
Timer.Time( "ChromeProv, SeqProv, viewport: {0}" );
|
||||||
|
|
||||||
|
// todo: delay this
|
||||||
skipMakeAnims = true;
|
skipMakeAnims = true;
|
||||||
foreach (var actorReference in world.Map.Actors)
|
foreach (var actorReference in world.Map.Actors)
|
||||||
world.CreateActor(actorReference.Name, actorReference.Location,
|
world.CreateActor(actorReference.Name, actorReference.Location,
|
||||||
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Owner)
|
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Owner)
|
||||||
?? world.players[0]);
|
?? world.NeutralPlayer);
|
||||||
skipMakeAnims = false;
|
skipMakeAnims = false;
|
||||||
Timer.Time( "map actors: {0}" );
|
Timer.Time( "map actors: {0}" );
|
||||||
|
|
||||||
@@ -297,7 +298,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
foreach (var ssu in world.players[client.Index].PlayerActor
|
foreach (var ssu in world.players[client.Index].PlayerActor
|
||||||
.traits.WithInterface<IOnGameStart>())
|
.traits.WithInterface<IOnGameStart>())
|
||||||
ssu.SpawnStartingUnits(world.players[client.Index], sp);
|
ssu.GameStarted(world.players[client.Index], sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.viewport.GoToStartLocation( Game.world.LocalPlayer );
|
Game.viewport.GoToStartLocation( Game.world.LocalPlayer );
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
class ReplayConnection : IConnection
|
class ReplayConnection : IConnection
|
||||||
{
|
{
|
||||||
uint nextFrame = 1;
|
//uint nextFrame = 1;
|
||||||
FileStream replayStream;
|
FileStream replayStream;
|
||||||
|
|
||||||
public ReplayConnection( string replayFilename )
|
public ReplayConnection( string replayFilename )
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
class SpawnDefaultUnits : IOnGameStart
|
class SpawnDefaultUnits : IOnGameStart
|
||||||
{
|
{
|
||||||
public void SpawnStartingUnits(Player p, int2 sp)
|
public void GameStarted(Player p, int2 sp)
|
||||||
{
|
{
|
||||||
p.PlayerActor.World.CreateActor("mcv", sp, p);
|
p.World.CreateActor("mcv", sp, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public interface INotifySelection { void SelectionChanged(); }
|
public interface INotifySelection { void SelectionChanged(); }
|
||||||
public interface ILoadWorldHook { void WorldLoaded(World w); }
|
public interface ILoadWorldHook { void WorldLoaded(World w); }
|
||||||
public interface IOnGameStart { void SpawnStartingUnits(Player p, int2 sp); }
|
public interface IOnGameStart { void GameStarted(Player p, int2 sp); }
|
||||||
|
|
||||||
public interface IActivity
|
public interface IActivity
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ namespace OpenRA
|
|||||||
get { return players[localPlayerIndex]; }
|
get { return players[localPlayerIndex]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player NeutralPlayer
|
||||||
|
{
|
||||||
|
get { return players[0]; } // todo, perhaps.
|
||||||
|
}
|
||||||
|
|
||||||
public void SetLocalPlayer(int index)
|
public void SetLocalPlayer(int index)
|
||||||
{
|
{
|
||||||
if (index != localPlayerIndex)
|
if (index != localPlayerIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user