From 426467a38fd6729c7c13864ef081e4ffc5a59b99 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 11 May 2013 18:34:16 +1200 Subject: [PATCH] Revert "Players and bots surrender on disconnect." This reverts commit 500c24fbaf942159c0adb7a37d1828f34a4c6267. --- OpenRA.Mods.RA/ConquestVictoryConditions.cs | 27 +++------------------ 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/OpenRA.Mods.RA/ConquestVictoryConditions.cs b/OpenRA.Mods.RA/ConquestVictoryConditions.cs index d183cb051b..f37020a031 100644 --- a/OpenRA.Mods.RA/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.RA/ConquestVictoryConditions.cs @@ -10,7 +10,6 @@ using System.Linq; using OpenRA.FileFormats; -using OpenRA.Network; using OpenRA.Traits; namespace OpenRA.Mods.RA @@ -32,29 +31,12 @@ namespace OpenRA.Mods.RA Info = info; } - Session.Client HumanClient(Player p) - { - var client = p.World.LobbyInfo.ClientWithIndex(p.ClientIndex); - if (client != null && client.Bot != null) - return p.World.LobbyInfo.ClientWithIndex(client.BotControllerClientIndex); - return client; - } - public void Tick(Actor self) { - if (self.Owner.NonCombatant) - return; - - // Surrender when the controlling player disconnects - var client = HumanClient(self.Owner); - if (client != null && client.State == Session.ClientState.Disconnected) - Lose(self); - - if (self.Owner.WinState != WinState.Undefined) - return; + if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant) return; var hasAnything = self.World.ActorsWithTrait() - .Any(a => a.Actor.Owner == self.Owner); + .Any( a => a.Actor.Owner == self.Owner ); if (!hasAnything && !self.Owner.NonCombatant) Lose(self); @@ -62,10 +44,9 @@ namespace OpenRA.Mods.RA var others = self.World.Players.Where( p => !p.NonCombatant && p != self.Owner && p.Stances[self.Owner] != Stance.Ally ); - if (others.Count() == 0) - return; + if (others.Count() == 0) return; - if (others.All(p => p.WinState == WinState.Lost)) + if(others.All(p => p.WinState == WinState.Lost)) Win(self); }