more general tidying
This commit is contained in:
@@ -189,27 +189,27 @@ namespace OpenRA.Editor
|
||||
|
||||
static MemoryStream ReadPackedSection(IniSection mapPackSection)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
for (int i = 1; ; i++)
|
||||
{
|
||||
string line = mapPackSection.GetValue(i.ToString(), null);
|
||||
var line = mapPackSection.GetValue(i.ToString(), null);
|
||||
if (line == null)
|
||||
break;
|
||||
|
||||
sb.Append(line.Trim());
|
||||
}
|
||||
|
||||
byte[] data = Convert.FromBase64String(sb.ToString());
|
||||
List<byte[]> chunks = new List<byte[]>();
|
||||
BinaryReader reader = new BinaryReader(new MemoryStream(data));
|
||||
var data = Convert.FromBase64String(sb.ToString());
|
||||
var chunks = new List<byte[]>();
|
||||
var reader = new BinaryReader(new MemoryStream(data));
|
||||
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
uint length = reader.ReadUInt32() & 0xdfffffff;
|
||||
byte[] dest = new byte[8192];
|
||||
byte[] src = reader.ReadBytes((int)length);
|
||||
var length = reader.ReadUInt32() & 0xdfffffff;
|
||||
var dest = new byte[8192];
|
||||
var src = reader.ReadBytes((int)length);
|
||||
|
||||
/*int actualLength =*/
|
||||
Format80.DecodeInto(src, dest);
|
||||
@@ -219,8 +219,8 @@ namespace OpenRA.Editor
|
||||
}
|
||||
catch (EndOfStreamException) { }
|
||||
|
||||
MemoryStream ms = new MemoryStream();
|
||||
foreach (byte[] chunk in chunks)
|
||||
var ms = new MemoryStream();
|
||||
foreach (var chunk in chunks)
|
||||
ms.Write(chunk, 0, chunk.Length);
|
||||
|
||||
ms.Position = 0;
|
||||
@@ -284,7 +284,7 @@ namespace OpenRA.Editor
|
||||
|
||||
void ReadRATrees(IniFile file)
|
||||
{
|
||||
IniSection terrain = file.GetSection("TERRAIN", true);
|
||||
var terrain = file.GetSection("TERRAIN", true);
|
||||
if (terrain == null)
|
||||
return;
|
||||
|
||||
@@ -316,14 +316,14 @@ namespace OpenRA.Editor
|
||||
|
||||
void ReadCncOverlay(IniFile file)
|
||||
{
|
||||
IniSection overlay = file.GetSection("OVERLAY", true);
|
||||
var overlay = file.GetSection("OVERLAY", true);
|
||||
if (overlay == null)
|
||||
return;
|
||||
|
||||
foreach (KeyValuePair<string, string> kv in overlay)
|
||||
{
|
||||
var loc = int.Parse(kv.Key);
|
||||
int2 cell = new int2(loc % MapSize, loc / MapSize);
|
||||
var cell = new int2(loc % MapSize, loc / MapSize);
|
||||
|
||||
var res = Pair.New((byte)0, (byte)0);
|
||||
if (overlayResourceMapping.ContainsKey(kv.Value.ToLower()))
|
||||
@@ -343,7 +343,7 @@ namespace OpenRA.Editor
|
||||
|
||||
void ReadCncTrees(IniFile file)
|
||||
{
|
||||
IniSection terrain = file.GetSection("TERRAIN", true);
|
||||
var terrain = file.GetSection("TERRAIN", true);
|
||||
if (terrain == null)
|
||||
return;
|
||||
|
||||
@@ -375,7 +375,6 @@ namespace OpenRA.Editor
|
||||
if (parts[0] == "")
|
||||
parts[0] = "Neutral";
|
||||
|
||||
|
||||
if (!Players.Contains(parts[0]))
|
||||
Players.Add(parts[0]);
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ namespace OpenRA.FileFormats
|
||||
H = h; S = s; L = l; R = r;
|
||||
}
|
||||
|
||||
public static readonly ColorRamp Empty = new ColorRamp(0,0,0,0);
|
||||
|
||||
/* returns a color along the Lum ramp */
|
||||
public Color GetColor( float t )
|
||||
{
|
||||
@@ -35,7 +33,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
|
||||
// hk is hue in the range [0,1] instead of [0,360]
|
||||
public static Color ColorFromHSL(float hk, float s, float l)
|
||||
static Color ColorFromHSL(float hk, float s, float l)
|
||||
{
|
||||
// Convert from HSL to RGB
|
||||
var q = (l < 0.5f) ? l * (1 + s) : l + s - (l * s);
|
||||
|
||||
@@ -56,16 +56,9 @@ namespace OpenRA
|
||||
[FieldLoader.Ignore] public Dictionary<string, PlayerReference> Players = new Dictionary<string, PlayerReference>();
|
||||
[FieldLoader.Ignore] public Lazy<List<SmudgeReference>> Smudges;
|
||||
|
||||
// Rules overrides
|
||||
[FieldLoader.Ignore] public List<MiniYamlNode> Rules = new List<MiniYamlNode>();
|
||||
|
||||
// Sequences overrides
|
||||
[FieldLoader.Ignore] public List<MiniYamlNode> Sequences = new List<MiniYamlNode>();
|
||||
|
||||
// Weapon overrides
|
||||
[FieldLoader.Ignore] public List<MiniYamlNode> Weapons = new List<MiniYamlNode>();
|
||||
|
||||
// Voices overrides
|
||||
[FieldLoader.Ignore] public List<MiniYamlNode> Voices = new List<MiniYamlNode>();
|
||||
|
||||
// Binary map data
|
||||
@@ -76,10 +69,7 @@ namespace OpenRA
|
||||
[FieldLoader.Ignore] public Lazy<TileReference<byte, byte>[,]> MapResources;
|
||||
[FieldLoader.Ignore] public string [,] CustomTerrain;
|
||||
|
||||
public Map()
|
||||
{
|
||||
// Do nothing; not a valid map (editor hack)
|
||||
}
|
||||
public Map() {} /* doesn't really produce a valid map, but enough for loading a mod */
|
||||
|
||||
public static Map FromTileset(string tileset)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user