From 6cf46920232adb8f4ff6a562297a8c9c541f0493 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 13 Apr 2010 20:43:11 +1200 Subject: [PATCH] tidier. --- OpenRA.Game/Widgets/PostGameWidget.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/OpenRA.Game/Widgets/PostGameWidget.cs b/OpenRA.Game/Widgets/PostGameWidget.cs index 3e997df497..53d896cd24 100644 --- a/OpenRA.Game/Widgets/PostGameWidget.cs +++ b/OpenRA.Game/Widgets/PostGameWidget.cs @@ -9,31 +9,22 @@ namespace OpenRA.Widgets { class PostGameWidget : Widget { - string text; - public override void Draw(World world) { base.Draw(world); - if (world.LocalPlayer == null) text = null; + if (world.LocalPlayer == null) return; - else if (world.players.Count > 2) /* more than just us + neutral */ + if (world.players.Count > 2) /* more than just us + neutral */ { var conds = world.Queries.WithTrait() .Where(c => c.Actor.Owner != world.NeutralPlayer); if (conds.Any(c => c.Actor.Owner == world.LocalPlayer && c.Trait.HasLost)) - text = "YOU ARE DEFEATED"; + DrawText("YOU ARE DEFEATED"); else if (conds.All(c => c.Actor.Owner == world.LocalPlayer || c.Trait.HasLost)) - text = "YOU ARE VICTORIOUS"; - else - text = null; + DrawText("YOU ARE VICTORIOUS"); } - else - text = null; - - if (text != null) - DrawText(text); } void DrawText(string s)