Fix map-player ctor.

This commit is contained in:
Paul Chote
2010-05-23 20:48:19 +12:00
parent a6f5b12a55
commit 9837b4ce32
4 changed files with 24 additions and 34 deletions

View File

@@ -94,20 +94,7 @@ namespace OpenRA
int mapPlayerIndex = -1;
foreach (var kv in Map.Players)
{
var player = new Player(this, null);
// Lets just pretend that i didn't do this.... Will fix later
player.GetType().GetField("Index").SetValue( player, mapPlayerIndex-- );
player.GetType().GetField("Palette").SetValue( player, kv.Value.Palette );// Todo: set Player.Color as well
player.GetType().GetField("PlayerName").SetValue( player, kv.Value.Name );
player.GetType().GetField("InternalName").SetValue( player, kv.Value.Name );
player.GetType().GetField("isSpecial").SetValue( player, kv.Value.isSpecial );
var country = WorldActor.Info.Traits.WithInterface<CountryInfo>().FirstOrDefault(c => kv.Value.Race == c.Race);
if (country == null)
throw new NotImplementedException("Invalid country: {0}".F(kv.Value.Race));
player.GetType().GetField("Country").SetValue( player, country);
var player = new Player(this, kv.Value, mapPlayerIndex--);
AddPlayer(player);
if (kv.Value.OwnsWorld)