setup stances; not using team ids from lobby yet.

This commit is contained in:
Chris Forbes
2010-03-19 18:25:58 +13:00
parent deffb10c81
commit 36f68a4026
2 changed files with 15 additions and 0 deletions

View File

@@ -264,6 +264,10 @@ namespace OpenRA
foreach (var c in LobbyInfo.Clients)
world.AddPlayer(new Player(world, c));
foreach (var p in world.players.Values)
foreach (var q in world.players.Values)
p.Stances[q] = ChooseInitialStance(p, q);
world.Queries = new World.AllQueries(world);
foreach (var gs in world.WorldActor.traits.WithInterface<IGameStarted>())
@@ -273,6 +277,15 @@ namespace OpenRA
orderManager.StartGame();
}
static Stance ChooseInitialStance(Player p, Player q)
{
if (p == q) return Stance.Ally;
if (p == world.NeutralPlayer || q == world.NeutralPlayer) return Stance.Neutral;
// todo: allies based on team index in LobbyInfo
return Stance.Enemy;
}
static int2 lastPos;
public static void DispatchMouseInput(MouseInputEvent ev, MouseEventArgs e, Modifiers modifierKeys)
{

View File

@@ -195,5 +195,7 @@ namespace OpenRA
Sound.PlayToPlayer(this, eva.CashTickDown);
}
}
public Dictionary<Player, Stance> Stances = new Dictionary<Player, Stance>();
}
}