moved Game.players, LocalPlayer, localPlayerIndex to World. Setting LocalPlayer via settings is broken.

This commit is contained in:
Bob
2010-01-21 12:19:25 +13:00
parent b037250054
commit d07b782044
36 changed files with 120 additions and 123 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRa.Effects;
using OpenRa.Support;
using OpenRa.FileFormats;
@@ -14,6 +15,19 @@ namespace OpenRa
List<IEffect> effects = new List<IEffect>();
List<Action<World>> frameEndActions = new List<Action<World>>();
public readonly Dictionary<int, Player> players = new Dictionary<int, Player>();
int localPlayerIndex;
public Player LocalPlayer
{
get { return players[localPlayerIndex]; }
set
{
localPlayerIndex = value.Index;
Game.viewport.GoToStartLocation();
}
}
public readonly BuildingInfluenceMap BuildingInfluence;
public readonly UnitInfluenceMap UnitInfluence;
@@ -46,6 +60,9 @@ namespace OpenRa
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));
Bridges.MakeBridges(this);
PathFinder = new PathFinder(this);
@@ -104,6 +121,8 @@ namespace OpenRa
UnitInfluence.Tick();
Minimap.Update();
foreach (var player in players.Values)
player.Tick();
}
public IEnumerable<Actor> Actors { get { return actors; } }