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

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc
public void WorldLoaded(World w)
{
Players = w.players.Values.ToDictionary(p => p.InternalName);
Players = w.Players.ToDictionary(p => p.InternalName);
Actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
var b = w.Map.Bounds;
Game.MoveViewport(new int2(b.Left + b.Width/2, b.Top + b.Height/2));

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Cnc
var td = new TypeDictionary
{
new LocationInit( self.Location ),
new OwnerInit( self.World.players.Values.First(p => p.InternalName == Info.Owner) )
new OwnerInit( self.World.Players.First(p => p.InternalName == Info.Owner) )
};
if (self.HasTrait<IFacing>())

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
var itemTemplate = scrollpanel.GetWidget("PLAYER_TEMPLATE");
scrollpanel.RemoveChildren();
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))
{
Player pp = p;
var item = itemTemplate.Clone();
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
var item = ScrollItemWidget.Setup(template,
() => s == world.LocalPlayer.Stances[ pp ],
() => world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor, false)
{ TargetLocation = new int2(pp.Index, (int)s) }));
{ TargetLocation = new int2((int)s, 0), TargetString = pp.InternalName }));
item.GetWidget<LabelWidget>("LABEL").GetText = () => s.ToString();
return item;

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
widget.GetWidget("PLAYER_WIDGETS").IsVisible = () => true;
var diplomacyButton = ingameRoot.GetWidget<ButtonWidget>("DIPLOMACY_BUTTON");
var diplomacyAvailable = world.players.Values.Any(a => a != world.LocalPlayer && !a.NonCombatant);
var diplomacyAvailable = world.Players.Any(a => a != world.LocalPlayer && !a.NonCombatant);
diplomacyButton.IsDisabled = () => !diplomacyAvailable;
diplomacyButton.OnClick = () =>
{