Use Tuple syntax
This commit is contained in:
@@ -359,20 +359,20 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
foreach (var c in ios.OccupiedCells())
|
||||
{
|
||||
var uv = c.First.ToMPos(map);
|
||||
var uv = c.Cell.ToMPos(map);
|
||||
if (!influence.Contains(uv))
|
||||
continue;
|
||||
|
||||
var layer = c.First.Layer == 0 ? influence : customInfluence[c.First.Layer];
|
||||
layer[uv] = new InfluenceNode { Next = layer[uv], SubCell = c.Second, Actor = self };
|
||||
var layer = c.Cell.Layer == 0 ? influence : customInfluence[c.Cell.Layer];
|
||||
layer[uv] = new InfluenceNode { Next = layer[uv], SubCell = c.SubCell, Actor = self };
|
||||
|
||||
List<CellTrigger> triggers;
|
||||
if (cellTriggerInfluence.TryGetValue(c.First, out triggers))
|
||||
if (cellTriggerInfluence.TryGetValue(c.Cell, out triggers))
|
||||
foreach (var t in triggers)
|
||||
t.Dirty = true;
|
||||
|
||||
if (CellUpdated != null)
|
||||
CellUpdated(c.First);
|
||||
CellUpdated(c.Cell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,22 +380,22 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
foreach (var c in ios.OccupiedCells())
|
||||
{
|
||||
var uv = c.First.ToMPos(map);
|
||||
var uv = c.Cell.ToMPos(map);
|
||||
if (!influence.Contains(uv))
|
||||
continue;
|
||||
|
||||
var layer = c.First.Layer == 0 ? influence : customInfluence[c.First.Layer];
|
||||
var layer = c.Cell.Layer == 0 ? influence : customInfluence[c.Cell.Layer];
|
||||
var temp = layer[uv];
|
||||
RemoveInfluenceInner(ref temp, self);
|
||||
layer[uv] = temp;
|
||||
|
||||
List<CellTrigger> triggers;
|
||||
if (cellTriggerInfluence.TryGetValue(c.First, out triggers))
|
||||
if (cellTriggerInfluence.TryGetValue(c.Cell, out triggers))
|
||||
foreach (var t in triggers)
|
||||
t.Dirty = true;
|
||||
|
||||
if (CellUpdated != null)
|
||||
CellUpdated(c.First);
|
||||
CellUpdated(c.Cell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
foreach (var c in ios.OccupiedCells())
|
||||
CellUpdated(c.First);
|
||||
CellUpdated(c.Cell);
|
||||
}
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
|
||||
@@ -315,11 +315,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public void PopulateRadarSignatureCells(Actor self, List<Pair<CPos, Color>> destinationBuffer)
|
||||
public void PopulateRadarSignatureCells(Actor self, List<(CPos Cell, Color Color)> destinationBuffer)
|
||||
{
|
||||
foreach (var previewsForCell in cellMap)
|
||||
foreach (var preview in previewsForCell.Value)
|
||||
destinationBuffer.Add(Pair.New(previewsForCell.Key, preview.RadarColor));
|
||||
destinationBuffer.Add((previewsForCell.Key, preview.RadarColor));
|
||||
}
|
||||
|
||||
public EditorActorPreview this[string id]
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
class LegacyBridgeLayer : IWorldLoaded
|
||||
{
|
||||
readonly LegacyBridgeLayerInfo info;
|
||||
readonly Dictionary<ushort, Pair<string, int>> bridgeTypes = new Dictionary<ushort, Pair<string, int>>();
|
||||
readonly Dictionary<ushort, (string Template, int Health)> bridgeTypes = new Dictionary<ushort, (string, int)>();
|
||||
|
||||
CellLayer<Bridge> bridges;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var bi = w.Map.Rules.Actors[bridge].TraitInfo<BridgeInfo>();
|
||||
foreach (var template in bi.Templates)
|
||||
bridgeTypes.Add(template.First, Pair.New(bridge, template.Second));
|
||||
bridgeTypes.Add(template.Template, (bridge, template.Health));
|
||||
}
|
||||
|
||||
// Take all templates to overlay from the map
|
||||
@@ -73,11 +73,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var nj = cell.Y - index / template.Size.X;
|
||||
|
||||
// Create a new actor for this bridge and keep track of which subtiles this bridge includes
|
||||
var bridge = w.CreateActor(bridgeTypes[tile].First, new TypeDictionary
|
||||
var bridge = w.CreateActor(bridgeTypes[tile].Template, new TypeDictionary
|
||||
{
|
||||
new LocationInit(new CPos(ni, nj)),
|
||||
new OwnerInit(w.WorldActor.Owner),
|
||||
new HealthInit(bridgeTypes[tile].Second, true),
|
||||
new HealthInit(bridgeTypes[tile].Health, true),
|
||||
}).Trait<Bridge>();
|
||||
|
||||
var subTiles = new Dictionary<CPos, byte>();
|
||||
|
||||
@@ -133,8 +133,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var n = taken.Count == 0 || !separateTeamSpawns
|
||||
? world.SharedRandom.Next(available.Count)
|
||||
: available // pick the most distant spawnpoint from everyone else
|
||||
.Select((k, i) => Pair.New(k, i))
|
||||
.MaxBy(a => taken.Sum(t => (t - a.First).LengthSquared)).Second;
|
||||
.Select((k, i) => (Cell: k, Index: i))
|
||||
.MaxBy(a => taken.Sum(t => (t - a.Cell).LengthSquared)).Index;
|
||||
|
||||
var sp = available[n];
|
||||
available.RemoveAt(n);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Allow resource to spawn on ramp tiles.")]
|
||||
public readonly bool AllowOnRamps = false;
|
||||
|
||||
void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<Pair<MPos, Color>> destinationBuffer)
|
||||
void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos, Color)> destinationBuffer)
|
||||
{
|
||||
var tileSet = map.Rules.TileSet;
|
||||
var color = tileSet[tileSet.GetTerrainIndex(TerrainType)].Color;
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var cell = new MPos(i, j);
|
||||
if (map.Resources[cell].Type == ResourceType)
|
||||
destinationBuffer.Add(new Pair<MPos, Color>(cell, color));
|
||||
destinationBuffer.Add((cell, color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user