ship out ChooseInitialStance from Game
This commit is contained in:
@@ -224,25 +224,6 @@ namespace OpenRA
|
|||||||
AfterGameStart();
|
AfterGameStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stance ChooseInitialStance(Player p, Player q)
|
|
||||||
{
|
|
||||||
if (p == q) return Stance.Ally;
|
|
||||||
|
|
||||||
// Hack: All map players are neutral wrt everyone else
|
|
||||||
if (p.Index < 0 || q.Index < 0) return Stance.Neutral;
|
|
||||||
|
|
||||||
var pc = GetClientForPlayer(p);
|
|
||||||
var qc = GetClientForPlayer(q);
|
|
||||||
|
|
||||||
return pc.Team != 0 && pc.Team == qc.Team
|
|
||||||
? Stance.Ally : Stance.Enemy;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Session.Client GetClientForPlayer(Player p)
|
|
||||||
{
|
|
||||||
return LobbyInfo.Clients.Single(c => c.Index == p.Index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DispatchMouseInput(MouseInputEvent ev, MouseEventArgs e, Modifiers modifierKeys)
|
public static void DispatchMouseInput(MouseInputEvent ev, MouseEventArgs e, Modifiers modifierKeys)
|
||||||
{
|
{
|
||||||
int sync = world.SyncHash();
|
int sync = world.SyncHash();
|
||||||
|
|||||||
@@ -6,10 +6,11 @@
|
|||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see LICENSE.
|
* see LICENSE.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRA.Network;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
@@ -32,8 +33,27 @@ namespace OpenRA.Mods.RA
|
|||||||
foreach (var q in w.players.Values)
|
foreach (var q in w.players.Values)
|
||||||
{
|
{
|
||||||
if (!p.Stances.ContainsKey(q))
|
if (!p.Stances.ContainsKey(q))
|
||||||
p.Stances[q] = Game.ChooseInitialStance(p, q);
|
p.Stances[q] = ChooseInitialStance(p, q);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Stance ChooseInitialStance(Player p, Player q)
|
||||||
|
{
|
||||||
|
if (p == q) return Stance.Ally;
|
||||||
|
|
||||||
|
// Hack: All map players are neutral wrt everyone else
|
||||||
|
if (p.Index < 0 || q.Index < 0) return Stance.Neutral;
|
||||||
|
|
||||||
|
var pc = GetClientForPlayer(p);
|
||||||
|
var qc = GetClientForPlayer(q);
|
||||||
|
|
||||||
|
return pc.Team != 0 && pc.Team == qc.Team
|
||||||
|
? Stance.Ally : Stance.Enemy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Session.Client GetClientForPlayer(Player p)
|
||||||
|
{
|
||||||
|
return Game.LobbyInfo.Clients.Single(c => c.Index == p.Index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user