#182 victory conditions need to know about teams

This commit is contained in:
Chris Forbes
2010-05-05 20:59:31 +12:00
parent c6ab4be268
commit 6fc230974c

View File

@@ -14,6 +14,8 @@ namespace OpenRA.Widgets
public PostGameWidget(Widget other) : base(other) { } public PostGameWidget(Widget other) : base(other) { }
public override Widget Clone() { return new PostGameWidget(this); } public override Widget Clone() { return new PostGameWidget(this); }
bool AreMutualAllies(Player a, Player b) { return a.Stances[b] == Stance.Ally && b.Stances[a] == Stance.Ally; }
public override void Draw(World world) public override void Draw(World world)
{ {
@@ -28,7 +30,7 @@ namespace OpenRA.Widgets
if (conds.Any(c => c.Actor.Owner == world.LocalPlayer && c.Trait.HasLost)) if (conds.Any(c => c.Actor.Owner == world.LocalPlayer && c.Trait.HasLost))
DrawText("YOU ARE DEFEATED"); DrawText("YOU ARE DEFEATED");
else if (conds.All(c => c.Actor.Owner == world.LocalPlayer || c.Trait.HasLost)) else if (conds.All(c => AreMutualAllies(c.Actor.Owner, world.LocalPlayer) || c.Trait.HasLost))
DrawText("YOU ARE VICTORIOUS"); DrawText("YOU ARE VICTORIOUS");
} }
} }