Stylecop clean Editor
This commit is contained in:
@@ -23,7 +23,7 @@ namespace OpenRA.Editor
|
||||
public class LegacyMapImporter
|
||||
{
|
||||
// Mapping from ra overlay index to type string
|
||||
static string[] raOverlayNames =
|
||||
static string[] redAlertOverlayNames =
|
||||
{
|
||||
"sbag", "cycl", "brik", "fenc", "wood",
|
||||
"gold01", "gold02", "gold03", "gold04",
|
||||
@@ -34,73 +34,77 @@ namespace OpenRA.Editor
|
||||
|
||||
static Dictionary<string, Pair<byte, byte>> overlayResourceMapping = new Dictionary<string, Pair<byte, byte>>()
|
||||
{
|
||||
// RA Gems, Gold
|
||||
{ "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) },
|
||||
// RA Gold & Gems
|
||||
{ "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) },
|
||||
|
||||
{ "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) },
|
||||
|
||||
// cnc 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) },
|
||||
// CnC 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) },
|
||||
};
|
||||
|
||||
static Dictionary<string, string> overlayActorMapping = new Dictionary<string, string>() {
|
||||
// Fences
|
||||
{"sbag","sbag"},
|
||||
{"cycl","cycl"},
|
||||
{"brik","brik"},
|
||||
{"fenc","fenc"},
|
||||
{"wood","wood"},
|
||||
{ "sbag", "sbag" },
|
||||
{ "cycl", "cycl" },
|
||||
{ "brik", "brik" },
|
||||
{ "fenc", "fenc" },
|
||||
{ "wood", "wood" },
|
||||
|
||||
// Fields
|
||||
{"v12","v12"},
|
||||
{"v13","v13"},
|
||||
{"v14","v14"},
|
||||
{"v15","v15"},
|
||||
{"v16","v16"},
|
||||
{"v17","v17"},
|
||||
{"v18","v18"},
|
||||
{ "v12", "v12" },
|
||||
{ "v13", "v13" },
|
||||
{ "v14", "v14" },
|
||||
{ "v15", "v15" },
|
||||
{ "v16", "v16" },
|
||||
{ "v17", "v17" },
|
||||
{ "v18", "v18" },
|
||||
|
||||
// Crates
|
||||
// {"wcrate","crate"},
|
||||
// {"scrate","crate"},
|
||||
// { "wcrate", "crate" },
|
||||
// { "scrate", "crate" },
|
||||
};
|
||||
|
||||
// TODO: fix this -- will have bitrotted pretty badly.
|
||||
static Dictionary<string, HSLColor> namedColorMapping = new Dictionary<string, HSLColor>()
|
||||
{
|
||||
{ "gold", HSLColor.FromRGB(246,214,121) },
|
||||
{ "blue", HSLColor.FromRGB(226,230,246) },
|
||||
{ "red", HSLColor.FromRGB(255,20,0) },
|
||||
{ "neutral", HSLColor.FromRGB(238,238,238) },
|
||||
{ "orange", HSLColor.FromRGB(255,230,149) },
|
||||
{ "teal", HSLColor.FromRGB(93,194,165) },
|
||||
{ "salmon", HSLColor.FromRGB(210,153,125) },
|
||||
{ "green", HSLColor.FromRGB(160,240,140) },
|
||||
{ "white", HSLColor.FromRGB(255,255,255) },
|
||||
{ "black", HSLColor.FromRGB(80,80,80) },
|
||||
{ "gold", HSLColor.FromRGB(246, 214, 121) },
|
||||
{ "blue", HSLColor.FromRGB(226, 230, 246) },
|
||||
{ "red", HSLColor.FromRGB(255, 20, 0) },
|
||||
{ "neutral", HSLColor.FromRGB(238, 238, 238) },
|
||||
{ "orange", HSLColor.FromRGB(255, 230, 149) },
|
||||
{ "teal", HSLColor.FromRGB(93, 194, 165) },
|
||||
{ "salmon", HSLColor.FromRGB(210, 153, 125) },
|
||||
{ "green", HSLColor.FromRGB(160, 240, 140) },
|
||||
{ "white", HSLColor.FromRGB(255, 255, 255) },
|
||||
{ "black", HSLColor.FromRGB(80, 80, 80) },
|
||||
};
|
||||
|
||||
int MapSize;
|
||||
int ActorCount = 0;
|
||||
Map Map = new Map();
|
||||
List<string> Players = new List<string>();
|
||||
static string Truncate(string s, int maxLength)
|
||||
{
|
||||
return s.Length <= maxLength ? s : s.Substring(0, maxLength);
|
||||
}
|
||||
|
||||
int mapSize;
|
||||
int actorCount = 0;
|
||||
Map map = new Map();
|
||||
List<string> players = new List<string>();
|
||||
Action<string> errorHandler;
|
||||
|
||||
LegacyMapImporter(string filename, Action<string> errorHandler)
|
||||
@@ -112,36 +116,35 @@ namespace OpenRA.Editor
|
||||
public static Map Import(string filename, Action<string> errorHandler)
|
||||
{
|
||||
var converter = new LegacyMapImporter(filename, errorHandler);
|
||||
return converter.Map;
|
||||
return converter.map;
|
||||
}
|
||||
|
||||
enum IniMapFormat { RedAlert = 3, /* otherwise, cnc (2 variants exist, we don't care to differentiate) */ };
|
||||
enum IniMapFormat { RedAlert = 3 } // otherwise, cnc (2 variants exist, we don't care to differentiate)
|
||||
|
||||
public void ConvertIniMap(string iniFile)
|
||||
{
|
||||
|
||||
var file = new IniFile(FileSystem.Open(iniFile));
|
||||
var basic = file.GetSection("Basic");
|
||||
var map = file.GetSection("Map");
|
||||
var mapSection = file.GetSection("Map");
|
||||
var legacyMapFormat = (IniMapFormat)int.Parse(basic.GetValue("NewINIFormat", "0"));
|
||||
var XOffset = int.Parse(map.GetValue("X", "0"));
|
||||
var YOffset = int.Parse(map.GetValue("Y", "0"));
|
||||
var Width = int.Parse(map.GetValue("Width", "0"));
|
||||
var Height = int.Parse(map.GetValue("Height", "0"));
|
||||
MapSize = (legacyMapFormat == IniMapFormat.RedAlert) ? 128 : 64;
|
||||
var offsetX = int.Parse(mapSection.GetValue("X", "0"));
|
||||
var offsetY = int.Parse(mapSection.GetValue("Y", "0"));
|
||||
var width = int.Parse(mapSection.GetValue("Width", "0"));
|
||||
var height = int.Parse(mapSection.GetValue("Height", "0"));
|
||||
mapSize = (legacyMapFormat == IniMapFormat.RedAlert) ? 128 : 64;
|
||||
|
||||
Map.Title = basic.GetValue("Name", "(null)");
|
||||
Map.Author = "Westwood Studios";
|
||||
Map.Tileset = Truncate(map.GetValue("Theater", "TEMPERAT"), 8);
|
||||
Map.MapSize.X = MapSize;
|
||||
Map.MapSize.Y = MapSize;
|
||||
Map.Bounds = Rectangle.FromLTRB(XOffset, YOffset, XOffset + Width, YOffset + Height);
|
||||
Map.Selectable = true;
|
||||
map.Title = basic.GetValue("Name", "(null)");
|
||||
map.Author = "Westwood Studios";
|
||||
map.Tileset = Truncate(mapSection.GetValue("Theater", "TEMPERAT"), 8);
|
||||
map.MapSize.X = mapSize;
|
||||
map.MapSize.Y = mapSize;
|
||||
map.Bounds = Rectangle.FromLTRB(offsetX, offsetY, offsetX + width, offsetY + height);
|
||||
map.Selectable = true;
|
||||
|
||||
Map.Smudges = Lazy.New(() => new List<SmudgeReference>());
|
||||
Map.Actors = Lazy.New(() => new Dictionary<string, ActorReference>());
|
||||
Map.MapResources = Lazy.New(() => new TileReference<byte, byte>[MapSize, MapSize]);
|
||||
Map.MapTiles = Lazy.New(() => new TileReference<ushort, byte>[MapSize, MapSize]);
|
||||
map.Smudges = Lazy.New(() => new List<SmudgeReference>());
|
||||
map.Actors = Lazy.New(() => new Dictionary<string, ActorReference>());
|
||||
map.MapResources = Lazy.New(() => new TileReference<byte, byte>[mapSize, mapSize]);
|
||||
map.MapTiles = Lazy.New(() => new TileReference<ushort, byte>[mapSize, mapSize]);
|
||||
|
||||
if (legacyMapFormat == IniMapFormat.RedAlert)
|
||||
{
|
||||
@@ -149,8 +152,9 @@ namespace OpenRA.Editor
|
||||
UnpackRAOverlayData(ReadPackedSection(file.GetSection("OverlayPack")));
|
||||
ReadRATrees(file);
|
||||
}
|
||||
else // CNC
|
||||
else
|
||||
{
|
||||
// CnC
|
||||
UnpackCncTileData(FileSystem.Open(iniFile.Substring(0, iniFile.Length - 4) + ".bin"));
|
||||
ReadCncOverlay(file);
|
||||
ReadCncTrees(file);
|
||||
@@ -161,25 +165,23 @@ namespace OpenRA.Editor
|
||||
LoadActors(file, "INFANTRY");
|
||||
LoadSmudges(file, "SMUDGE");
|
||||
|
||||
foreach (var p in Players)
|
||||
LoadPlayer(file, p, (legacyMapFormat == IniMapFormat.RedAlert));
|
||||
foreach (var p in players)
|
||||
LoadPlayer(file, p, legacyMapFormat == IniMapFormat.RedAlert);
|
||||
|
||||
var wps = file.GetSection("Waypoints")
|
||||
.Where(kv => int.Parse(kv.Value) > 0)
|
||||
.Select(kv => Pair.New(int.Parse(kv.Key),
|
||||
LocationFromMapOffset(int.Parse(kv.Value), MapSize)))
|
||||
LocationFromMapOffset(int.Parse(kv.Value), mapSize)))
|
||||
.ToArray();
|
||||
|
||||
|
||||
// Add waypoint actors
|
||||
foreach( var kv in wps )
|
||||
foreach (var kv in wps)
|
||||
{
|
||||
var a = new ActorReference("waypoint");
|
||||
a.Add(new LocationInit((CPos)kv.Second));
|
||||
a.Add(new OwnerInit("Neutral"));
|
||||
Map.Actors.Value.Add("waypoint" + kv.First, a);
|
||||
map.Actors.Value.Add("waypoint" + kv.First, a);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int2 LocationFromMapOffset(int offset, int mapSize)
|
||||
@@ -190,7 +192,7 @@ namespace OpenRA.Editor
|
||||
static MemoryStream ReadPackedSection(IniSection mapPackSection)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
for (int i = 1; ; i++)
|
||||
for (int i = 1;; i++)
|
||||
{
|
||||
var line = mapPackSection.GetValue(i.ToString(), null);
|
||||
if (line == null)
|
||||
@@ -246,38 +248,38 @@ namespace OpenRA.Editor
|
||||
|
||||
void UnpackRATileData(MemoryStream ms)
|
||||
{
|
||||
for (int i = 0; i < MapSize; i++)
|
||||
for (int j = 0; j < MapSize; j++)
|
||||
Map.MapTiles.Value[i, j] = new TileReference<ushort, byte>();
|
||||
for (int i = 0; i < mapSize; i++)
|
||||
for (int j = 0; j < mapSize; j++)
|
||||
map.MapTiles.Value[i, j] = new TileReference<ushort, byte>();
|
||||
|
||||
for (int j = 0; j < MapSize; j++)
|
||||
for (int i = 0; i < MapSize; i++)
|
||||
Map.MapTiles.Value[i, j].type = ReadWord(ms);
|
||||
for (int j = 0; j < mapSize; j++)
|
||||
for (int i = 0; i < mapSize; i++)
|
||||
map.MapTiles.Value[i, j].type = ReadWord(ms);
|
||||
|
||||
for (int j = 0; j < MapSize; j++)
|
||||
for (int i = 0; i < MapSize; i++)
|
||||
Map.MapTiles.Value[i, j].index = ReadByte(ms);
|
||||
for (int j = 0; j < mapSize; j++)
|
||||
for (int i = 0; i < mapSize; i++)
|
||||
map.MapTiles.Value[i, j].index = ReadByte(ms);
|
||||
}
|
||||
|
||||
void UnpackRAOverlayData(MemoryStream ms)
|
||||
{
|
||||
for (int j = 0; j < MapSize; j++)
|
||||
for (int i = 0; i < MapSize; i++)
|
||||
for (int j = 0; j < mapSize; j++)
|
||||
for (int i = 0; i < mapSize; i++)
|
||||
{
|
||||
byte o = ReadByte(ms);
|
||||
var res = Pair.New((byte)0, (byte)0);
|
||||
|
||||
if (o != 255 && overlayResourceMapping.ContainsKey(raOverlayNames[o]))
|
||||
res = overlayResourceMapping[raOverlayNames[o]];
|
||||
if (o != 255 && overlayResourceMapping.ContainsKey(redAlertOverlayNames[o]))
|
||||
res = overlayResourceMapping[redAlertOverlayNames[o]];
|
||||
|
||||
Map.MapResources.Value[i, j] = new TileReference<byte, byte>(res.First, res.Second);
|
||||
map.MapResources.Value[i, j] = new TileReference<byte, byte>(res.First, res.Second);
|
||||
|
||||
if (o != 255 && overlayActorMapping.ContainsKey(raOverlayNames[o]))
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
new ActorReference(overlayActorMapping[raOverlayNames[o]])
|
||||
if (o != 255 && overlayActorMapping.ContainsKey(redAlertOverlayNames[o]))
|
||||
map.Actors.Value.Add("Actor" + actorCount++,
|
||||
new ActorReference(overlayActorMapping[redAlertOverlayNames[o]])
|
||||
{
|
||||
new LocationInit( new CPos(i, j) ),
|
||||
new OwnerInit( "Neutral" )
|
||||
new LocationInit(new CPos(i, j)),
|
||||
new OwnerInit("Neutral")
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -291,10 +293,10 @@ namespace OpenRA.Editor
|
||||
foreach (KeyValuePair<string, string> kv in terrain)
|
||||
{
|
||||
var loc = int.Parse(kv.Key);
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
map.Actors.Value.Add("Actor" + actorCount++,
|
||||
new ActorReference(kv.Value.ToLowerInvariant())
|
||||
{
|
||||
new LocationInit(new CPos(loc % MapSize, loc / MapSize)),
|
||||
new LocationInit(new CPos(loc % mapSize, loc / mapSize)),
|
||||
new OwnerInit("Neutral")
|
||||
});
|
||||
}
|
||||
@@ -302,15 +304,15 @@ namespace OpenRA.Editor
|
||||
|
||||
void UnpackCncTileData(Stream ms)
|
||||
{
|
||||
for (int i = 0; i < MapSize; i++)
|
||||
for (int j = 0; j < MapSize; j++)
|
||||
Map.MapTiles.Value[i, j] = new TileReference<ushort, byte>();
|
||||
for (int i = 0; i < mapSize; i++)
|
||||
for (int j = 0; j < mapSize; j++)
|
||||
map.MapTiles.Value[i, j] = new TileReference<ushort, byte>();
|
||||
|
||||
for (int j = 0; j < MapSize; j++)
|
||||
for (int i = 0; i < MapSize; i++)
|
||||
for (int j = 0; j < mapSize; j++)
|
||||
for (int i = 0; i < mapSize; i++)
|
||||
{
|
||||
Map.MapTiles.Value[i, j].type = ReadByte(ms);
|
||||
Map.MapTiles.Value[i, j].index = ReadByte(ms);
|
||||
map.MapTiles.Value[i, j].type = ReadByte(ms);
|
||||
map.MapTiles.Value[i, j].index = ReadByte(ms);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,16 +325,16 @@ namespace OpenRA.Editor
|
||||
foreach (KeyValuePair<string, string> kv in overlay)
|
||||
{
|
||||
var loc = int.Parse(kv.Key);
|
||||
var cell = new CPos(loc % MapSize, loc / MapSize);
|
||||
var cell = new CPos(loc % mapSize, loc / mapSize);
|
||||
|
||||
var res = Pair.New((byte)0, (byte)0);
|
||||
if (overlayResourceMapping.ContainsKey(kv.Value.ToLower()))
|
||||
res = overlayResourceMapping[kv.Value.ToLower()];
|
||||
|
||||
Map.MapResources.Value[cell.X, cell.Y] = new TileReference<byte, byte>(res.First, res.Second);
|
||||
map.MapResources.Value[cell.X, cell.Y] = new TileReference<byte, byte>(res.First, res.Second);
|
||||
|
||||
if (overlayActorMapping.ContainsKey(kv.Value.ToLower()))
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
map.Actors.Value.Add("Actor" + actorCount++,
|
||||
new ActorReference(overlayActorMapping[kv.Value.ToLower()])
|
||||
{
|
||||
new LocationInit(cell),
|
||||
@@ -350,10 +352,10 @@ namespace OpenRA.Editor
|
||||
foreach (KeyValuePair<string, string> kv in terrain)
|
||||
{
|
||||
var loc = int.Parse(kv.Key);
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
map.Actors.Value.Add("Actor" + actorCount++,
|
||||
new ActorReference(kv.Value.Split(',')[0].ToLowerInvariant())
|
||||
{
|
||||
new LocationInit(new CPos(loc % MapSize, loc / MapSize)),
|
||||
new LocationInit(new CPos(loc % mapSize, loc / mapSize)),
|
||||
new OwnerInit("Neutral")
|
||||
});
|
||||
}
|
||||
@@ -363,26 +365,24 @@ namespace OpenRA.Editor
|
||||
{
|
||||
foreach (var s in file.GetSection(section, true))
|
||||
{
|
||||
//Structures: num=owner,type,health,location,turret-facing,trigger
|
||||
//Units: num=owner,type,health,location,facing,action,trigger
|
||||
//Infantry: num=owner,type,health,location,subcell,action,facing,trigger
|
||||
|
||||
// Structures: num=owner,type,health,location,turret-facing,trigger
|
||||
// Units: num=owner,type,health,location,facing,action,trigger
|
||||
// Infantry: num=owner,type,health,location,subcell,action,facing,trigger
|
||||
try
|
||||
{
|
||||
|
||||
var parts = s.Value.Split(',');
|
||||
var loc = int.Parse(parts[3]);
|
||||
if (parts[0] == "")
|
||||
parts[0] = "Neutral";
|
||||
|
||||
if (!Players.Contains(parts[0]))
|
||||
Players.Add(parts[0]);
|
||||
if (!players.Contains(parts[0]))
|
||||
players.Add(parts[0]);
|
||||
|
||||
var actor = new ActorReference(parts[1].ToLowerInvariant())
|
||||
{
|
||||
new LocationInit(new CPos(loc % MapSize, loc / MapSize)),
|
||||
new LocationInit(new CPos(loc % mapSize, loc / mapSize)),
|
||||
new OwnerInit(parts[0]),
|
||||
new HealthInit(float.Parse(parts[2], NumberFormatInfo.InvariantInfo)/256),
|
||||
new HealthInit(float.Parse(parts[2], NumberFormatInfo.InvariantInfo) / 256),
|
||||
new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])),
|
||||
};
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace OpenRA.Editor
|
||||
if (!Rules.Info.ContainsKey(parts[1].ToLowerInvariant()))
|
||||
errorHandler("Ignoring unknown actor type: `{0}`".F(parts[1].ToLowerInvariant()));
|
||||
else
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++, actor);
|
||||
map.Actors.Value.Add("Actor" + actorCount++, actor);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -405,10 +405,10 @@ namespace OpenRA.Editor
|
||||
{
|
||||
foreach (var s in file.GetSection(section, true))
|
||||
{
|
||||
//loc=type,loc,depth
|
||||
// loc=type,loc,depth
|
||||
var parts = s.Value.Split(',');
|
||||
var loc = int.Parse(parts[1]);
|
||||
Map.Smudges.Value.Add(new SmudgeReference(parts[0].ToLowerInvariant(), new int2(loc % MapSize, loc / MapSize), int.Parse(parts[2])));
|
||||
map.Smudges.Value.Add(new SmudgeReference(parts[0].ToLowerInvariant(), new int2(loc % mapSize, loc / mapSize), int.Parse(parts[2])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace OpenRA.Editor
|
||||
break;
|
||||
case "Greece":
|
||||
case "GoodGuy":
|
||||
c = isRA? "blue" : "gold";
|
||||
c = isRA ? "blue" : "gold";
|
||||
race = isRA ? "allies" : "gdi";
|
||||
break;
|
||||
case "USSR":
|
||||
@@ -469,28 +469,23 @@ namespace OpenRA.Editor
|
||||
Color = namedColorMapping[c]
|
||||
};
|
||||
|
||||
var neutral = new [] {"Neutral"};
|
||||
var neutral = new[] { "Neutral" };
|
||||
foreach (var s in file.GetSection(section, true))
|
||||
{
|
||||
Console.WriteLine(s.Key);
|
||||
switch(s.Key)
|
||||
switch (s.Key)
|
||||
{
|
||||
case "Credits":
|
||||
pr.InitialCash = int.Parse(s.Value);
|
||||
break;
|
||||
case "Allies":
|
||||
pr.Allies = s.Value.Split(',').Intersect(Players).Except(neutral).ToArray();
|
||||
pr.Enemies = s.Value.Split(',').SymmetricDifference(Players).Except(neutral).ToArray();
|
||||
pr.Allies = s.Value.Split(',').Intersect(players).Except(neutral).ToArray();
|
||||
pr.Enemies = s.Value.Split(',').SymmetricDifference(players).Except(neutral).ToArray();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Map.Players.Add(section, pr);
|
||||
}
|
||||
|
||||
static string Truncate(string s, int maxLength)
|
||||
{
|
||||
return s.Length <= maxLength ? s : s.Substring(0, maxLength);
|
||||
map.Players.Add(section, pr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user