diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index 25ad5f708e..d3aed7a308 100755 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -118,12 +118,16 @@ namespace OpenRA.Network SetPlayerStance(world, order.Player, targetPlayer, newStance); - // automatically declare war reciprocally - if (newStance == Stance.Enemy) - SetPlayerStance(world, targetPlayer, order.Player, newStance); - Game.Debug("{0} has set diplomatic stance vs {1} to {2}".F( order.Player.PlayerName, targetPlayer.PlayerName, newStance)); + + // automatically declare war reciprocally + if (newStance == Stance.Enemy && targetPlayer.Stances[order.Player] == Stance.Ally) + { + SetPlayerStance(world, targetPlayer, order.Player, newStance); + Game.Debug("{0} has reciprocated",targetPlayer.PlayerName); + } + break; } default: @@ -141,12 +145,12 @@ namespace OpenRA.Network } } - static void SetPlayerStance(World w, Player a, Player b, Stance s) + static void SetPlayerStance(World w, Player p, Player target, Stance s) { - var oldStance = a.Stances[b]; - a.Stances[b] = s; - if (b == w.LocalPlayer) - w.WorldActor.Trait().UpdatePlayerStance(w, b, oldStance, s); + var oldStance = p.Stances[target]; + p.Stances[target] = s; + if (target == w.LocalPlayer) + w.WorldActor.Trait().UpdatePlayerStance(w, p, oldStance, s); } } } diff --git a/OpenRA.Mods.RA/Widgets/Delegates/DiplomacyDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/DiplomacyDelegate.cs index e2966827fb..eda7086398 100644 --- a/OpenRA.Mods.RA/Widgets/Delegates/DiplomacyDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/DiplomacyDelegate.cs @@ -108,7 +108,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates { Bounds = new Rectangle( margin + 2 * labelWidth + 20, y, labelWidth, 25), Id = "DIPLOMACY_PLAYER_LABEL_MY_{0}".F(p.Index), - Text = world.LocalPlayer.Stances[ pp ].ToString(), + GetText = () => world.LocalPlayer.Stances[ pp ].ToString(), }; myStance.OnMouseDown = mi => { ShowDropDown(pp, myStance); return true; };