This commit is contained in:
Chris Forbes
2010-01-14 22:00:18 +13:00
parent c7e525151f
commit 1a7a80ac84
3 changed files with 14 additions and 7 deletions

View File

@@ -50,6 +50,8 @@ namespace OpenRa.Game
static HardwarePalette palette;
public static Minimap minimap;
public static Session LobbyInfo = new Session();
public static void ChangeMap(string mapName)
{
SheetBuilder.Initialize(renderer);
@@ -72,7 +74,7 @@ namespace OpenRa.Game
{
var race = players.ContainsKey(i) ? players[i].Race : Race.Allies;
var name = players.ContainsKey(i) ? players[i].PlayerName : "Player {0}".F(i+1);
players[i] = new Player(i, (PaletteType) i, name, race, "Multi{0}".F(i));
players[i] = new Player(i, LobbyInfo.Clients.FirstOrDefault(a => a.Index == i));
}
Rules.Map.InitOreDensity();
@@ -346,6 +348,7 @@ namespace OpenRa.Game
public static void SyncLobbyInfo(string data)
{
var session = new Session();
var ys = MiniYaml.FromString(data);
foreach (var y in ys)
{
@@ -355,9 +358,12 @@ namespace OpenRa.Game
var client = new Session.Client();
FieldLoader.Load(client, y.Value);
session.Clients.Add(client);
players[index].SyncFromLobby(client);
}
LobbyInfo = session;
}
}
}

View File

@@ -31,14 +31,15 @@ namespace OpenRa.Game
public Shroud Shroud = new Shroud();
public Dictionary<string, SupportPower> SupportPowers;
public Player( int index, PaletteType palette, string playerName, Race race, string internalName )
public Player( int index, Session.Client client )
{
Game.world.Add(this.PlayerActor = new Actor("Player", new int2(int.MaxValue, int.MaxValue), this));
this.Index = index;
this.Palette = palette;
this.InternalName = internalName;
this.PlayerName = playerName;
this.Race = race;
this.InternalName = "Multi{0}".F(index);
this.Palette = client != null ? (PaletteType)client.Palette : (PaletteType)index;
this.PlayerName = client != null ? client.Name : "Player {0}".F(index+1);
this.Race = client != null ? (Race)client.Race : Race.Allies;
SupportPowers = Rules.SupportPowerInfo.ToDictionary(
spi => spi.Key,

View File

@@ -14,7 +14,7 @@ namespace OpenRa.Game.Traits.Activities
static Actor ChooseHelipad(Actor self)
{
return Game.world.Actors.FirstOrDefault(
a => a.Info == Rules.NewUnitInfo["HPAD"] &&
a => a.Info.Name == "hpad" &&
a.Owner == self.Owner &&
!Reservable.IsReserved(a));
}