From 36f68a402670d70353b0eed37d0e6e8974331cde Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 19 Mar 2010 18:25:58 +1300 Subject: [PATCH] setup stances; not using team ids from lobby yet. --- OpenRA.Game/Game.cs | 13 +++++++++++++ OpenRA.Game/Player.cs | 2 ++ 2 files changed, 15 insertions(+) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 67def27f91..b16e4c765a 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -263,6 +263,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); @@ -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) { diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 3d5b0e423b..3c7b151dfe 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -195,5 +195,7 @@ namespace OpenRA Sound.PlayToPlayer(this, eva.CashTickDown); } } + + public Dictionary Stances = new Dictionary(); } }