Remove obsolete Player index cruft

This commit is contained in:
Paul Chote
2011-06-17 22:17:03 +12:00
parent bcbd18bb52
commit 532bd42aed
20 changed files with 49 additions and 64 deletions

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
return true;
};
validPlayers = world.players.Values.Where(a => a != world.LocalPlayer && !a.NonCombatant).Count();
validPlayers = world.Players.Where(a => a != world.LocalPlayer && !a.NonCombatant).Count();
diplomacy.IsVisible = () => (validPlayers > 0);
}
@@ -79,13 +79,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
y += 35;
foreach (var p in world.players.Values.Where(a => a != world.LocalPlayer && !a.NonCombatant))
foreach (var p in world.Players.Where(a => a != world.LocalPlayer && !a.NonCombatant))
{
var pp = p;
var label = new LabelWidget
{
Bounds = new Rectangle(margin, y, labelWidth, 25),
Id = "DIPLOMACY_PLAYER_LABEL_{0}".F(p.Index),
Text = p.PlayerName,
Align = LabelWidget.TextAlign.Left,
Font = "Bold",
@@ -97,7 +96,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var theirStance = new LabelWidget
{
Bounds = new Rectangle( margin + labelWidth + 10, y, labelWidth, 25),
Id = "DIPLOMACY_PLAYER_LABEL_THEIR_{0}".F(p.Index),
Text = p.PlayerName,
Align = LabelWidget.TextAlign.Left,
@@ -110,7 +108,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var myStance = new DropDownButtonWidget
{
Bounds = new Rectangle( margin + 2 * labelWidth + 20, y, labelWidth, 25),
Id = "DIPLOMACY_PLAYER_LABEL_MY_{0}".F(p.Index),
GetText = () => world.LocalPlayer.Stances[ pp ].ToString(),
};
@@ -145,7 +142,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
return; // team changes are banned
world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor,
false) { TargetLocation = new int2(p.Index, (int)ss) });
false) { TargetLocation = new int2((int)ss, 0), TargetString = p.InternalName });
bw.Text = ss.ToString();
}

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Widgets
if (!IsVisible()) return;
int2 offset = int2.Zero;
var svc = world.players.Select(p => p.Value.PlayerActor.TraitOrDefault<StrategicVictoryConditions>()).FirstOrDefault();
var svc = world.Players.Select(p => p.PlayerActor.TraitOrDefault<StrategicVictoryConditions>()).FirstOrDefault();
var totalWidth = (svc.Total + svc.TotalCritical) * 32;
int curX = -(totalWidth / 2);
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA.Widgets
int shortest = int.MaxValue;
Player shortestPlayer = null;
foreach (var p in world.players.Select(p => p.Value).Where(p => !p.NonCombatant))
foreach (var p in world.Players.Where(p => !p.NonCombatant))
{
var svc = p.PlayerActor.Trait<StrategicVictoryConditions>();