diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 5634352c35..a4180cb80b 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -61,7 +61,7 @@ namespace OpenRA else { // Map player - ClientIndex = 0; /* it's a map player, "owned" by host */ + ClientIndex = 0; // Owned by the host (todo: fix this) ColorRamp = pr.ColorRamp; PlayerName = pr.Name; NonCombatant = pr.NonCombatant; diff --git a/OpenRA.Mods.RA/CreateMPPlayers.cs b/OpenRA.Mods.RA/CreateMPPlayers.cs index 7fb46573e8..e0e2e869ed 100644 --- a/OpenRA.Mods.RA/CreateMPPlayers.cs +++ b/OpenRA.Mods.RA/CreateMPPlayers.cs @@ -60,12 +60,17 @@ namespace OpenRA.Mods.RA if (p.PlayerReference.Enemies.Contains(q.InternalName)) return Stance.Enemy; - // Stances set via lobby teams - var pc = GetClientForPlayer(p); - var qc = GetClientForPlayer(q); - if (pc != null && qc != null) - return pc.Team != 0 && pc.Team == qc.Team - ? Stance.Ally : Stance.Enemy; + // Hack: Map players share a ClientID with the host, so would + // otherwise take the host's team stance instead of being neutral + if (p.PlayerReference.Playable && q.PlayerReference.Playable) + { + // Stances set via lobby teams + var pc = GetClientForPlayer(p); + var qc = GetClientForPlayer(q); + if (pc != null && qc != null) + return pc.Team != 0 && pc.Team == qc.Team + ? Stance.Ally : Stance.Enemy; + } // Otherwise, default to neutral return Stance.Neutral;