Use Tuple syntax
This commit is contained in:
@@ -17,7 +17,6 @@ using System.Text;
|
||||
using OpenRA.Mods.Cnc.FileFormats;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Mods.Common.UtilityCommands;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
{
|
||||
@@ -52,17 +51,17 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
"fpls", "wcrate", "scrate", "barb", "sbag",
|
||||
};
|
||||
|
||||
static Dictionary<string, Pair<byte, byte>> overlayResourceMapping = new Dictionary<string, Pair<byte, byte>>()
|
||||
static Dictionary<string, (byte Type, byte Index)> overlayResourceMapping = new Dictionary<string, (byte, byte)>()
|
||||
{
|
||||
// RA ore & crystals
|
||||
{ "gold01", new Pair<byte, byte>(1, 0) },
|
||||
{ "gold02", new Pair<byte, byte>(1, 1) },
|
||||
{ "gold03", new Pair<byte, byte>(1, 2) },
|
||||
{ "gold04", new Pair<byte, byte>(1, 3) },
|
||||
{ "gem01", new Pair<byte, byte>(2, 0) },
|
||||
{ "gem02", new Pair<byte, byte>(2, 1) },
|
||||
{ "gem03", new Pair<byte, byte>(2, 2) },
|
||||
{ "gem04", new Pair<byte, byte>(2, 3) },
|
||||
{ "gold01", (1, 0) },
|
||||
{ "gold02", (1, 1) },
|
||||
{ "gold03", (1, 2) },
|
||||
{ "gold04", (1, 3) },
|
||||
{ "gem01", (2, 0) },
|
||||
{ "gem02", (2, 1) },
|
||||
{ "gem03", (2, 2) },
|
||||
{ "gem04", (2, 3) },
|
||||
};
|
||||
|
||||
void UnpackTileData(MemoryStream ms)
|
||||
@@ -101,13 +100,13 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
for (var i = 0; i < MapSize; i++)
|
||||
{
|
||||
var o = ms.ReadUInt8();
|
||||
var res = Pair.New((byte)0, (byte)0);
|
||||
var res = (Type: (byte)0, Index: (byte)0);
|
||||
|
||||
if (o != 255 && overlayResourceMapping.ContainsKey(redAlertOverlayNames[o]))
|
||||
res = overlayResourceMapping[redAlertOverlayNames[o]];
|
||||
|
||||
var cell = new CPos(i, j);
|
||||
Map.Resources[cell] = new ResourceTile(res.First, res.Second);
|
||||
Map.Resources[cell] = new ResourceTile(res.Type, res.Index);
|
||||
|
||||
if (o != 255 && overlayActors.Contains(redAlertOverlayNames[o]))
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Mods.Common.UtilityCommands;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
{
|
||||
@@ -40,21 +39,21 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
static Dictionary<string, Pair<byte, byte>> overlayResourceMapping = new Dictionary<string, Pair<byte, byte>>()
|
||||
static Dictionary<string, (byte Type, byte Index)> overlayResourceMapping = new Dictionary<string, (byte, byte)>()
|
||||
{
|
||||
// Tiberium
|
||||
{ "ti1", new Pair<byte, byte>(1, 0) },
|
||||
{ "ti2", new Pair<byte, byte>(1, 1) },
|
||||
{ "ti3", new Pair<byte, byte>(1, 2) },
|
||||
{ "ti4", new Pair<byte, byte>(1, 3) },
|
||||
{ "ti5", new Pair<byte, byte>(1, 4) },
|
||||
{ "ti6", new Pair<byte, byte>(1, 5) },
|
||||
{ "ti7", new Pair<byte, byte>(1, 6) },
|
||||
{ "ti8", new Pair<byte, byte>(1, 7) },
|
||||
{ "ti9", new Pair<byte, byte>(1, 8) },
|
||||
{ "ti10", new Pair<byte, byte>(1, 9) },
|
||||
{ "ti11", new Pair<byte, byte>(1, 10) },
|
||||
{ "ti12", new Pair<byte, byte>(1, 11) },
|
||||
{ "ti1", (1, 0) },
|
||||
{ "ti2", (1, 1) },
|
||||
{ "ti3", (1, 2) },
|
||||
{ "ti4", (1, 3) },
|
||||
{ "ti5", (1, 4) },
|
||||
{ "ti6", (1, 5) },
|
||||
{ "ti7", (1, 6) },
|
||||
{ "ti8", (1, 7) },
|
||||
{ "ti9", (1, 8) },
|
||||
{ "ti10", (1, 9) },
|
||||
{ "ti11", (1, 10) },
|
||||
{ "ti12", (1, 11) },
|
||||
};
|
||||
|
||||
void UnpackTileData(Stream ms)
|
||||
@@ -93,12 +92,12 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
var loc = Exts.ParseIntegerInvariant(kv.Key);
|
||||
var cell = new CPos(loc % MapSize, loc / MapSize);
|
||||
|
||||
var res = Pair.New((byte)0, (byte)0);
|
||||
var res = (Type: (byte)0, Index: (byte)0);
|
||||
var type = kv.Value.ToLowerInvariant();
|
||||
if (overlayResourceMapping.ContainsKey(type))
|
||||
res = overlayResourceMapping[type];
|
||||
|
||||
Map.Resources[cell] = new ResourceTile(res.First, res.Second);
|
||||
Map.Resources[cell] = new ResourceTile(res.Type, res.Index);
|
||||
if (overlayActors.Contains(type))
|
||||
{
|
||||
var ar = new ActorReference(type)
|
||||
|
||||
Reference in New Issue
Block a user