@@ -15,7 +15,6 @@ using System.IO;
|
||||
using System.Media;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA;
|
||||
|
||||
namespace OpenRA.CrashDialog
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
{
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
using SGraphics = System.Drawing.Graphics;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
using SGraphics = System.Drawing.Graphics;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
|
||||
@@ -637,9 +637,9 @@ namespace OpenRA.Editor
|
||||
|
||||
public int CalculateTotalResource()
|
||||
{
|
||||
int totalResource = 0;
|
||||
for (int i = 0; i < surface1.Map.MapSize.X; i++)
|
||||
for (int j = 0; j < surface1.Map.MapSize.Y; j++)
|
||||
var totalResource = 0;
|
||||
for (var i = 0; i < surface1.Map.MapSize.X; i++)
|
||||
for (var j = 0; j < surface1.Map.MapSize.Y; j++)
|
||||
{
|
||||
if (surface1.Map.MapResources.Value[i, j].Type != 0)
|
||||
totalResource += GetResourceValue(i, j);
|
||||
@@ -650,7 +650,7 @@ namespace OpenRA.Editor
|
||||
|
||||
int GetAdjecentCellsWith(int resourceType, int x, int y)
|
||||
{
|
||||
int sum = 0;
|
||||
var sum = 0;
|
||||
for (var u = -1; u < 2; u++)
|
||||
for (var v = -1; v < 2; v++)
|
||||
{
|
||||
@@ -665,15 +665,15 @@ namespace OpenRA.Editor
|
||||
|
||||
int GetResourceValue(int x, int y)
|
||||
{
|
||||
int imageLength = 0;
|
||||
var imageLength = 0;
|
||||
int type = surface1.Map.MapResources.Value[x, y].Type;
|
||||
var template = surface1.ResourceTemplates.FirstOrDefault(a => a.Value.Info.ResourceType == type).Value;
|
||||
if (type == 1)
|
||||
imageLength = 12;
|
||||
else if (type == 2)
|
||||
imageLength = 3;
|
||||
int density = (GetAdjecentCellsWith(type, x, y) * imageLength - 1) / 9;
|
||||
int value = template.Info.ValuePerUnit;
|
||||
var density = (GetAdjecentCellsWith(type, x, y) * imageLength - 1) / 9;
|
||||
var value = template.Info.ValuePerUnit;
|
||||
return density * value;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Editor
|
||||
|
||||
foreach (var map in MapCache.FindMapsIn(MapFolderPath))
|
||||
{
|
||||
ListViewItem map1 = new ListViewItem();
|
||||
var map1 = new ListViewItem();
|
||||
map1.Tag = map;
|
||||
map1.Text = Path.GetFileNameWithoutExtension(map);
|
||||
map1.ImageIndex = 0;
|
||||
|
||||
@@ -10,10 +10,7 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
{
|
||||
|
||||
@@ -8,14 +8,12 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
@@ -35,7 +33,7 @@ namespace OpenRA.Editor
|
||||
|
||||
unsafe
|
||||
{
|
||||
byte* q = (byte*)data.Scan0.ToPointer();
|
||||
var q = (byte*)data.Scan0.ToPointer();
|
||||
var stride2 = data.Stride;
|
||||
|
||||
for (var i = 0; i < frame.Size.Width; i++)
|
||||
@@ -94,7 +92,7 @@ namespace OpenRA.Editor
|
||||
|
||||
unsafe
|
||||
{
|
||||
byte* q = (byte*)data.Scan0.ToPointer();
|
||||
var q = (byte*)data.Scan0.ToPointer();
|
||||
var stride = data.Stride;
|
||||
|
||||
for (var i = 0; i < frame.Size.Width; i++)
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
using SGraphics = System.Drawing.Graphics;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
|
||||
@@ -14,7 +14,6 @@ using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
@@ -266,7 +265,7 @@ namespace OpenRA.Editor
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* p = (int*)data.Scan0.ToPointer();
|
||||
var p = (int*)data.Scan0.ToPointer();
|
||||
var stride = data.Stride >> 2;
|
||||
|
||||
for (var i = 0; i < ChunkSize; i++)
|
||||
@@ -286,7 +285,7 @@ namespace OpenRA.Editor
|
||||
var srcdata = resourceImage.LockBits(resourceImage.Bounds(),
|
||||
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
|
||||
|
||||
int* q = (int*)srcdata.Scan0.ToPointer();
|
||||
var q = (int*)srcdata.Scan0.ToPointer();
|
||||
var srcstride = srcdata.Stride >> 2;
|
||||
|
||||
for (var x = 0; x < TileSetRenderer.TileSize; x++)
|
||||
@@ -345,10 +344,10 @@ namespace OpenRA.Editor
|
||||
float2 GetDrawPosition(CPos location, Bitmap bmp, bool centered)
|
||||
{
|
||||
float offsetX = centered ? bmp.Width / 2 - TileSetRenderer.TileSize / 2 : 0;
|
||||
float drawX = TileSetRenderer.TileSize * location.X * Zoom + Offset.X - offsetX;
|
||||
var drawX = TileSetRenderer.TileSize * location.X * Zoom + Offset.X - offsetX;
|
||||
|
||||
float offsetY = centered ? bmp.Height / 2 - TileSetRenderer.TileSize / 2 : 0;
|
||||
float drawY = TileSetRenderer.TileSize * location.Y * Zoom + Offset.Y - offsetY;
|
||||
var drawY = TileSetRenderer.TileSize * location.Y * Zoom + Offset.Y - offsetY;
|
||||
|
||||
return new float2(drawX, drawY);
|
||||
}
|
||||
@@ -418,8 +417,8 @@ namespace OpenRA.Editor
|
||||
|
||||
var drawX = TileSetRenderer.TileSize * (float)ChunkSize * (float)x.X * Zoom + Offset.X;
|
||||
var drawY = TileSetRenderer.TileSize * (float)ChunkSize * (float)x.Y * Zoom + Offset.Y;
|
||||
RectangleF sourceRect = new RectangleF(0, 0, bmp.Width, bmp.Height);
|
||||
RectangleF destRect = new RectangleF(drawX, drawY, bmp.Width * Zoom, bmp.Height * Zoom);
|
||||
var sourceRect = new RectangleF(0, 0, bmp.Width, bmp.Height);
|
||||
var destRect = new RectangleF(drawX, drawY, bmp.Width * Zoom, bmp.Height * Zoom);
|
||||
e.Graphics.DrawImage(bmp, destRect, sourceRect, GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
@@ -468,20 +467,20 @@ namespace OpenRA.Editor
|
||||
|
||||
if (ShowRuler && Zoom > 0.2)
|
||||
{
|
||||
for (int i = Map.Bounds.Left; i <= Map.Bounds.Right; i += 8)
|
||||
for (var i = Map.Bounds.Left; i <= Map.Bounds.Right; i += 8)
|
||||
{
|
||||
if (i % 8 == 0)
|
||||
{
|
||||
PointF point = new PointF(i * TileSetRenderer.TileSize * Zoom + Offset.X, (Map.Bounds.Top - 8) * TileSetRenderer.TileSize * Zoom + Offset.Y);
|
||||
var point = new PointF(i * TileSetRenderer.TileSize * Zoom + Offset.X, (Map.Bounds.Top - 8) * TileSetRenderer.TileSize * Zoom + Offset.Y);
|
||||
e.Graphics.DrawString((i - Map.Bounds.Left).ToString(), MarkerFont, TextBrush, point);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = Map.Bounds.Top; i <= Map.Bounds.Bottom; i += 8)
|
||||
for (var i = Map.Bounds.Top; i <= Map.Bounds.Bottom; i += 8)
|
||||
{
|
||||
if (i % 8 == 0)
|
||||
{
|
||||
PointF point = new PointF((Map.Bounds.Left - 8) * TileSetRenderer.TileSize * Zoom + Offset.X, i * TileSetRenderer.TileSize * Zoom + Offset.Y);
|
||||
var point = new PointF((Map.Bounds.Left - 8) * TileSetRenderer.TileSize * Zoom + Offset.X, i * TileSetRenderer.TileSize * Zoom + Offset.Y);
|
||||
e.Graphics.DrawString((i - Map.Bounds.Left).ToString(), MarkerFont, TextBrush, point);
|
||||
}
|
||||
}
|
||||
@@ -506,15 +505,15 @@ namespace OpenRA.Editor
|
||||
|
||||
if (start == end) return;
|
||||
|
||||
int width = Math.Abs((start - end).X);
|
||||
int height = Math.Abs((start - end).Y);
|
||||
var width = Math.Abs((start - end).X);
|
||||
var height = Math.Abs((start - end).Y);
|
||||
|
||||
TileSelection = new TileReference<ushort, byte>[width, height];
|
||||
ResourceSelection = new TileReference<byte, byte>[width, height];
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
for (var x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
for (var y = 0; y < height; y++)
|
||||
{
|
||||
// TODO: crash prevention
|
||||
TileSelection[x, y] = Map.MapTiles.Value[start.X + x, start.Y + y];
|
||||
@@ -529,9 +528,9 @@ namespace OpenRA.Editor
|
||||
var width = Math.Abs((SelectionStart - SelectionEnd).X);
|
||||
var height = Math.Abs((SelectionStart - SelectionEnd).Y);
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
for (var x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
for (var y = 0; y < height; y++)
|
||||
{
|
||||
var mapX = loc.X + x;
|
||||
var mapY = loc.Y + y;
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
@@ -172,8 +172,8 @@ namespace OpenRA
|
||||
u = selector(t);
|
||||
while (e.MoveNext())
|
||||
{
|
||||
T nextT = e.Current;
|
||||
U nextU = selector(nextT);
|
||||
var nextT = e.Current;
|
||||
var nextU = selector(nextT);
|
||||
if (comparer.Compare(nextU, u) * modifier < 0)
|
||||
{
|
||||
t = nextT;
|
||||
@@ -228,8 +228,8 @@ namespace OpenRA
|
||||
var d = new Dictionary<TKey, TElement>();
|
||||
foreach (var item in source)
|
||||
{
|
||||
TKey key = keySelector(item);
|
||||
TElement element = elementSelector(item);
|
||||
var key = keySelector(item);
|
||||
var element = elementSelector(item);
|
||||
|
||||
// Check for a key conflict:
|
||||
if (d.ContainsKey(key))
|
||||
@@ -274,8 +274,8 @@ namespace OpenRA
|
||||
|
||||
public static T[] MakeArray<T>(int count, Func<int, T> f)
|
||||
{
|
||||
T[] result = new T[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
var result = new T[count];
|
||||
for (var i = 0; i < count; i++)
|
||||
result[i] = f(i);
|
||||
|
||||
return result;
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace OpenRA
|
||||
var parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
var ret = Array.CreateInstance(fieldType.GetElementType(), parts.Length);
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
for (var i = 0; i < parts.Length; i++)
|
||||
ret.SetValue(GetValue(fieldName, fieldType.GetElementType(), parts[i].Trim(), field), i);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace OpenRA.FileFormats
|
||||
while (dataSize > 0)
|
||||
{
|
||||
var chunk = Chunk.Read(s);
|
||||
for (int n = 0; n < chunk.CompressedSize; n++)
|
||||
for (var n = 0; n < chunk.CompressedSize; n++)
|
||||
{
|
||||
var b = s.ReadUInt8();
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace OpenRA.FileFormats
|
||||
// Magic number for "done"
|
||||
if (len == 519)
|
||||
{
|
||||
for (int i = 0; i < next; i++)
|
||||
for (var i = 0; i < next; i++)
|
||||
ms.WriteByte(outBuffer[i]);
|
||||
break;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ namespace OpenRA.FileFormats
|
||||
// Flush window to outstream
|
||||
if (next == MAXWIN)
|
||||
{
|
||||
for (int i = 0; i < next; i++)
|
||||
for (var i = 0; i < next; i++)
|
||||
ms.WriteByte(outBuffer[i]);
|
||||
next = 0;
|
||||
first = false;
|
||||
@@ -149,7 +149,7 @@ namespace OpenRA.FileFormats
|
||||
outBuffer[next++] = (byte)symbol;
|
||||
if (next == MAXWIN)
|
||||
{
|
||||
for (int i = 0; i < next; i++)
|
||||
for (var i = 0; i < next; i++)
|
||||
ms.WriteByte(outBuffer[i]);
|
||||
next = 0;
|
||||
first = false;
|
||||
@@ -236,7 +236,7 @@ namespace OpenRA.FileFormats
|
||||
var s = 0; // current symbol
|
||||
|
||||
// convert compact repeat counts into symbol bit length list
|
||||
foreach (byte code in rep)
|
||||
foreach (var code in rep)
|
||||
{
|
||||
var num = (code >> 4) + 1; // Number of codes (top four bits plus 1)
|
||||
var len = (byte)(code & 15); // Code length (low four bits)
|
||||
@@ -250,7 +250,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// count number of codes of each length
|
||||
Count = new short[Blast.MAXBITS + 1];
|
||||
for (int i = 0; i < n; i++)
|
||||
for (var i = 0; i < n; i++)
|
||||
Count[length[i]]++;
|
||||
|
||||
// no codes!
|
||||
@@ -259,7 +259,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// check for an over-subscribed or incomplete set of lengths
|
||||
var left = 1; // one possible code of zero length
|
||||
for (int len = 1; len <= Blast.MAXBITS; len++)
|
||||
for (var len = 1; len <= Blast.MAXBITS; len++)
|
||||
{
|
||||
left <<= 1; // one more bit, double codes left
|
||||
left -= Count[len]; // deduct count from possible codes
|
||||
@@ -269,7 +269,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// generate offsets into symbol table for each length for sorting
|
||||
var offs = new short[Blast.MAXBITS + 1];
|
||||
for (int len = 1; len < Blast.MAXBITS; len++)
|
||||
for (var len = 1; len < Blast.MAXBITS; len++)
|
||||
offs[len + 1] = (short)(offs[len] + Count[len]);
|
||||
|
||||
// put symbols in table sorted by length, by symbol order within each length
|
||||
|
||||
@@ -26,15 +26,15 @@ namespace OpenRA.FileFormats
|
||||
|
||||
uint l = 0, r = 0;
|
||||
|
||||
for (int i = 0; i < 18; )
|
||||
for (var i = 0; i < 18; )
|
||||
{
|
||||
Encrypt(ref l, ref r);
|
||||
m_p[i++] = l;
|
||||
m_p[i++] = r;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int j = 0; j < 256; )
|
||||
for (var i = 0; i < 4; ++i)
|
||||
for (var j = 0; j < 256; )
|
||||
{
|
||||
Encrypt(ref l, ref r);
|
||||
m_s[i, j++] = l;
|
||||
@@ -49,14 +49,14 @@ namespace OpenRA.FileFormats
|
||||
|
||||
static uint[] RunCipher(uint[] data, CipherFunc f)
|
||||
{
|
||||
uint[] result = new uint[data.Length];
|
||||
var result = new uint[data.Length];
|
||||
|
||||
int size = data.Length / 2;
|
||||
int i = 0;
|
||||
var size = data.Length / 2;
|
||||
var i = 0;
|
||||
while (size-- > 0)
|
||||
{
|
||||
uint a = SwapBytes(data[i]);
|
||||
uint b = SwapBytes(data[i+1]);
|
||||
var a = SwapBytes(data[i]);
|
||||
var b = SwapBytes(data[i+1]);
|
||||
|
||||
f(ref a, ref b);
|
||||
|
||||
@@ -72,8 +72,8 @@ namespace OpenRA.FileFormats
|
||||
uint _a = a, _b = b;
|
||||
_a ^= m_p[0];
|
||||
|
||||
bool x = false;
|
||||
for( int i = 1; i <= 16; i++, x ^= true)
|
||||
var x = false;
|
||||
for( var i = 1; i <= 16; i++, x ^= true)
|
||||
{
|
||||
if (x)
|
||||
Round(ref _a, _b, i);
|
||||
@@ -91,8 +91,8 @@ namespace OpenRA.FileFormats
|
||||
uint _a = a, _b = b;
|
||||
_a ^= m_p[17];
|
||||
|
||||
bool x = false;
|
||||
for (int i = 16; i >= 1; i--, x ^= true)
|
||||
var x = false;
|
||||
for (var i = 16; i >= 1; i--, x ^= true)
|
||||
{
|
||||
if (x)
|
||||
Round(ref _a, _b, i);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
static void init_bignum(uint[] n, uint val, uint len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) n[i] = 0;
|
||||
for (var i = 0; i < len; i++) n[i] = 0;
|
||||
n[0] = val;
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
fixed (uint* _pn = &n[0])
|
||||
{
|
||||
byte* pn = (byte*)_pn;
|
||||
uint i = blen * 4;
|
||||
var pn = (byte*)_pn;
|
||||
var i = blen * 4;
|
||||
for (; i > klen; i--) pn[i - 1] = (byte)sign;
|
||||
for (; i > 0; i--) pn[i - 1] = key[klen - i];
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.FileFormats
|
||||
uint keylen;
|
||||
int i;
|
||||
|
||||
int j = 0;
|
||||
var j = 0;
|
||||
|
||||
if (key[j] != 2) return;
|
||||
j++;
|
||||
@@ -118,7 +118,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
uint len_predata()
|
||||
{
|
||||
uint a = (pubkey.len - 1) / 8;
|
||||
var a = (pubkey.len - 1) / 8;
|
||||
return (55 / a + 1) * (a + 1);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
static void shr_bignum(uint[] n, int bits, int len)
|
||||
{
|
||||
int i; int i2 = bits / 32;
|
||||
int i; var i2 = bits / 32;
|
||||
|
||||
if (i2 > 0)
|
||||
{
|
||||
@@ -183,9 +183,9 @@ namespace OpenRA.FileFormats
|
||||
fixed (uint* _ps2 = &src2[0])
|
||||
fixed (uint* _pd = &dest[0])
|
||||
{
|
||||
ushort* ps1 = (ushort*)_ps1;
|
||||
ushort* ps2 = (ushort*)_ps2;
|
||||
ushort* pd = (ushort*)_pd;
|
||||
var ps1 = (ushort*)_ps1;
|
||||
var ps2 = (ushort*)_ps2;
|
||||
var pd = (ushort*)_pd;
|
||||
|
||||
while (--len != -1)
|
||||
{
|
||||
@@ -205,9 +205,9 @@ namespace OpenRA.FileFormats
|
||||
|
||||
len += len;
|
||||
|
||||
ushort* ps1 = (ushort*)src1;
|
||||
ushort* ps2 = (ushort*)src2;
|
||||
ushort* pd = (ushort*)dest;
|
||||
var ps1 = (ushort*)src1;
|
||||
var ps2 = (ushort*)src2;
|
||||
var pd = (ushort*)dest;
|
||||
|
||||
while (--len != -1)
|
||||
{
|
||||
@@ -222,11 +222,11 @@ namespace OpenRA.FileFormats
|
||||
|
||||
static void inv_bignum(uint[] n1, uint[] n2, uint len)
|
||||
{
|
||||
uint[] n_tmp = new uint[64];
|
||||
var n_tmp = new uint[64];
|
||||
uint n2_bytelen, bit;
|
||||
int n2_bitlen;
|
||||
|
||||
int j = 0;
|
||||
var j = 0;
|
||||
|
||||
init_bignum(n_tmp, 0, len);
|
||||
init_bignum(n1, 0, len);
|
||||
@@ -257,7 +257,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
static void inc_bignum(uint[] n, uint len)
|
||||
{
|
||||
int i = 0;
|
||||
var i = 0;
|
||||
while ((++n[i] == 0) && (--len > 0)) i++;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
fixed (uint* _pn2 = &n2[0])
|
||||
{
|
||||
ushort* pn2 = (ushort*)_pn2;
|
||||
var pn2 = (ushort*)_pn2;
|
||||
|
||||
tmp = 0;
|
||||
for (i = 0; i < len; i++)
|
||||
@@ -314,8 +314,8 @@ namespace OpenRA.FileFormats
|
||||
fixed( uint * _psrc2 = &src2[0] )
|
||||
fixed(uint* _pdest = &dest[0])
|
||||
{
|
||||
ushort* psrc2 = (ushort*)_psrc2;
|
||||
ushort* pdest = (ushort*)_pdest;
|
||||
var psrc2 = (ushort*)_psrc2;
|
||||
var pdest = (ushort*)_pdest;
|
||||
|
||||
init_bignum(dest, 0, len * 2);
|
||||
for (i = 0; i < len * 2; i++)
|
||||
@@ -338,8 +338,8 @@ namespace OpenRA.FileFormats
|
||||
|
||||
unsafe uint get_mulword(uint* n)
|
||||
{
|
||||
ushort* wn = (ushort*)n;
|
||||
uint i = (uint)((((((((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_lo + 0x10000) >> 1)
|
||||
var wn = (ushort*)n;
|
||||
var i = (uint)((((((((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_lo + 0x10000) >> 1)
|
||||
+ (((*(wn - 2) ^ 0xffff) * glob1_hi_inv_hi + glob1_hi_inv_hi) >> 1) + 1)
|
||||
>> 16) + ((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_hi) >> 1) +
|
||||
(((*wn ^ 0xffff) * glob1_hi_inv_lo) >> 1) + 1) >> 14) + glob1_hi_inv_hi
|
||||
@@ -350,7 +350,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
static void dec_bignum(uint[] n, uint len)
|
||||
{
|
||||
int i = 0;
|
||||
var i = 0;
|
||||
while ((--n[i] == 0xffffffff) && (--len > 0))
|
||||
i++;
|
||||
}
|
||||
@@ -371,12 +371,12 @@ namespace OpenRA.FileFormats
|
||||
inc_bignum(glob2, len * 2 + 1);
|
||||
neg_bignum(glob2, len * 2 + 1);
|
||||
len_diff = g2_len_x2 + 1 - glob1_len_x2;
|
||||
ushort* esi = ((ushort*)g2) + (1 + g2_len_x2 - glob1_len_x2);
|
||||
ushort* edi = ((ushort*)g2) + (g2_len_x2 + 1);
|
||||
var esi = ((ushort*)g2) + (1 + g2_len_x2 - glob1_len_x2);
|
||||
var edi = ((ushort*)g2) + (g2_len_x2 + 1);
|
||||
for (; len_diff != 0; len_diff--)
|
||||
{
|
||||
edi--;
|
||||
uint tmp = get_mulword((uint*)edi);
|
||||
var tmp = get_mulword((uint*)edi);
|
||||
esi--;
|
||||
if (tmp > 0)
|
||||
{
|
||||
@@ -410,7 +410,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
void calc_a_key(uint[] n1, uint[] n2, uint[] n3, uint[] n4, uint len)
|
||||
{
|
||||
uint[] n_tmp = new uint[64];
|
||||
var n_tmp = new uint[64];
|
||||
uint n3_len, n4_len;
|
||||
int n3_bitlen;
|
||||
uint bit_mask;
|
||||
@@ -419,7 +419,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
fixed (uint* _pn3 = &n3[0])
|
||||
{
|
||||
uint* pn3 = _pn3;
|
||||
var pn3 = _pn3;
|
||||
|
||||
init_bignum(n1, 1, len);
|
||||
n4_len = len_bignum(n4, len);
|
||||
@@ -457,10 +457,10 @@ namespace OpenRA.FileFormats
|
||||
|
||||
unsafe void process_predata(byte* pre, uint pre_len, byte *buf)
|
||||
{
|
||||
uint[] n2 = new uint[64];
|
||||
uint[] n3 = new uint[64];
|
||||
var n2 = new uint[64];
|
||||
var n3 = new uint[64];
|
||||
|
||||
uint a = (pubkey.len - 1) / 8;
|
||||
var a = (pubkey.len - 1) / 8;
|
||||
while (a + 1 <= pre_len)
|
||||
{
|
||||
init_bignum(n2, 0, 64);
|
||||
@@ -480,7 +480,7 @@ namespace OpenRA.FileFormats
|
||||
public byte[] DecryptKey(byte[] src)
|
||||
{
|
||||
init_pubkey();
|
||||
byte[] dest = new byte[256];
|
||||
var dest = new byte[256];
|
||||
|
||||
unsafe
|
||||
{
|
||||
|
||||
@@ -98,8 +98,8 @@ namespace OpenRA.FileFormats
|
||||
/// </returns>
|
||||
public static uint Calculate(byte[] data, uint polynomial)
|
||||
{
|
||||
uint crc = polynomial;
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
var crc = polynomial;
|
||||
for (var i = 0; i < data.Length; i++)
|
||||
crc = (crc >> 8) ^ lookUp[(crc & 0xFF) ^ data[i]];
|
||||
crc ^= polynomial;
|
||||
return crc;
|
||||
@@ -119,8 +119,8 @@ namespace OpenRA.FileFormats
|
||||
/// <returns>The calculated checksum.</returns>
|
||||
public static unsafe uint Calculate(byte* data, uint len, uint polynomial)
|
||||
{
|
||||
uint crc = polynomial;
|
||||
for (int i = 0; i < len; i++)
|
||||
var crc = polynomial;
|
||||
for (var i = 0; i < len; i++)
|
||||
crc = (crc >> 8) ^ lookUp[(crc & 0xFF) ^ *data++];
|
||||
crc ^= polynomial;
|
||||
return crc;
|
||||
|
||||
@@ -15,32 +15,32 @@ namespace OpenRA.FileFormats
|
||||
public static int DecodeInto(byte[] src, byte[] dest, int srcOffset)
|
||||
{
|
||||
var ctx = new FastByteReader(src, srcOffset);
|
||||
int destIndex = 0;
|
||||
var destIndex = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
byte i = ctx.ReadByte();
|
||||
var i = ctx.ReadByte();
|
||||
if ((i & 0x80) == 0)
|
||||
{
|
||||
int count = i & 0x7F;
|
||||
var count = i & 0x7F;
|
||||
if (count == 0)
|
||||
{
|
||||
// case 6
|
||||
count = ctx.ReadByte();
|
||||
byte value = ctx.ReadByte();
|
||||
for (int end = destIndex + count; destIndex < end; destIndex++)
|
||||
var value = ctx.ReadByte();
|
||||
for (var end = destIndex + count; destIndex < end; destIndex++)
|
||||
dest[destIndex] ^= value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// case 5
|
||||
for (int end = destIndex + count; destIndex < end; destIndex++)
|
||||
for (var end = destIndex + count; destIndex < end; destIndex++)
|
||||
dest[destIndex] ^= ctx.ReadByte();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int count = i & 0x7F;
|
||||
var count = i & 0x7F;
|
||||
if (count == 0)
|
||||
{
|
||||
count = ctx.ReadWord();
|
||||
@@ -55,14 +55,14 @@ namespace OpenRA.FileFormats
|
||||
else if ((count & 0x4000) == 0)
|
||||
{
|
||||
// case 3
|
||||
for (int end = destIndex + (count & 0x3FFF); destIndex < end; destIndex++)
|
||||
for (var end = destIndex + (count & 0x3FFF); destIndex < end; destIndex++)
|
||||
dest[destIndex] ^= ctx.ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
// case 4
|
||||
byte value = ctx.ReadByte();
|
||||
for (int end = destIndex + (count & 0x3FFF); destIndex < end; destIndex++)
|
||||
var value = ctx.ReadByte();
|
||||
for (var end = destIndex + (count & 0x3FFF); destIndex < end; destIndex++)
|
||||
dest[destIndex] ^= value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public void Load(Stream s)
|
||||
{
|
||||
StreamReader reader = new StreamReader(s);
|
||||
var reader = new StreamReader(s);
|
||||
IniSection currentSection = null;
|
||||
|
||||
while (!reader.EndOfStream)
|
||||
@@ -55,10 +55,10 @@ namespace OpenRA.FileFormats
|
||||
|
||||
IniSection ProcessSection(string line)
|
||||
{
|
||||
Match m = sectionPattern.Match(line);
|
||||
var m = sectionPattern.Match(line);
|
||||
if (!m.Success)
|
||||
return null;
|
||||
string sectionName = m.Groups[1].Value.ToLowerInvariant();
|
||||
var sectionName = m.Groups[1].Value.ToLowerInvariant();
|
||||
|
||||
IniSection ret;
|
||||
if (!sections.TryGetValue(sectionName, out ret))
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
var key = line;
|
||||
var value = "";
|
||||
int eq = line.IndexOf('=');
|
||||
var eq = line.IndexOf('=');
|
||||
if (eq >= 0)
|
||||
{
|
||||
key = line.Substring(0, eq);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
Bitmap bitmap = null;
|
||||
Color[] palette = null;
|
||||
List<byte> data = new List<byte>();
|
||||
var data = new List<byte>();
|
||||
|
||||
for (; ; )
|
||||
{
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.FileFormats
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.FileFormats
|
||||
{
|
||||
@@ -47,7 +46,7 @@ namespace OpenRA.FileFormats
|
||||
throw new NotSupportedException("Metadata version {0} is not supported".F(version));
|
||||
|
||||
// Read game info (max 100K limit as a safeguard against corrupted files)
|
||||
string data = fs.ReadString(Encoding.UTF8, 1024 * 100);
|
||||
var data = fs.ReadString(Encoding.UTF8, 1024 * 100);
|
||||
GameInfo = GameInformation.Deserialize(data);
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ namespace OpenRA.FileFormats
|
||||
writer.Write(MetaVersion);
|
||||
|
||||
// Write data
|
||||
int dataLength = 0;
|
||||
var dataLength = 0;
|
||||
{
|
||||
// Write lobby info data
|
||||
writer.Flush();
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.FileFormats
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.FileFormats
|
||||
@@ -36,7 +35,7 @@ namespace OpenRA.FileFormats
|
||||
var indexStart = s.ReadInt32();
|
||||
|
||||
s.Position = indexStart;
|
||||
foreach (byte b in s.ReadBytes(indexEnd - indexStart))
|
||||
foreach (var b in s.ReadBytes(indexEnd - indexStart))
|
||||
{
|
||||
if (b != 255)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace OpenRA.FileFormats
|
||||
var indexStart = s.ReadInt32();
|
||||
|
||||
s.Position = indexStart;
|
||||
foreach (byte b in s.ReadBytes(indexEnd - indexStart))
|
||||
foreach (var b in s.ReadBytes(indexEnd - indexStart))
|
||||
{
|
||||
if (b != 255)
|
||||
{
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.FileFormats
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// Frame offsets
|
||||
offsets = new UInt32[Frames];
|
||||
for (int i = 0; i < Frames; i++)
|
||||
for (var i = 0; i < Frames; i++)
|
||||
{
|
||||
offsets[i] = stream.ReadUInt32();
|
||||
if (offsets[i] > 0x40000000)
|
||||
@@ -125,7 +125,7 @@ namespace OpenRA.FileFormats
|
||||
var ms = new MemoryStream();
|
||||
var adpcmIndex = 0;
|
||||
|
||||
bool compressed = false;
|
||||
var compressed = false;
|
||||
for (var i = 0; i < Frames; i++)
|
||||
{
|
||||
stream.Seek(offsets[i], SeekOrigin.Begin);
|
||||
@@ -201,7 +201,7 @@ namespace OpenRA.FileFormats
|
||||
// Chunks are aligned on even bytes; may be padded with a single null
|
||||
if (s.Peek() == 0) s.ReadByte();
|
||||
var type = s.ReadASCII(4);
|
||||
int subchunkLength = (int)int2.Swap(s.ReadUInt32());
|
||||
var subchunkLength = (int)int2.Swap(s.ReadUInt32());
|
||||
|
||||
switch(type)
|
||||
{
|
||||
@@ -235,11 +235,11 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// Palette
|
||||
case "CPL0":
|
||||
for (int i = 0; i < numColors; i++)
|
||||
for (var i = 0; i < numColors; i++)
|
||||
{
|
||||
byte r = (byte)(s.ReadUInt8() << 2);
|
||||
byte g = (byte)(s.ReadUInt8() << 2);
|
||||
byte b = (byte)(s.ReadUInt8() << 2);
|
||||
var r = (byte)(s.ReadUInt8() << 2);
|
||||
var g = (byte)(s.ReadUInt8() << 2);
|
||||
var b = (byte)(s.ReadUInt8() << 2);
|
||||
palette[i] = (uint)((255 << 24) | (r << 16) | (g << 8) | b);
|
||||
}
|
||||
break;
|
||||
@@ -269,7 +269,7 @@ namespace OpenRA.FileFormats
|
||||
for (var i = 0; i < blockWidth; i++)
|
||||
{
|
||||
var cbfi = (mod*256 + px)*8 + j*blockWidth + i;
|
||||
byte color = (mod == 0x0f) ? px : cbf[cbfi];
|
||||
var color = (mod == 0x0f) ? px : cbf[cbfi];
|
||||
frameData[y*blockHeight + j, x*blockWidth + i] = palette[color];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ namespace OpenRA.FileFormats
|
||||
|
||||
s.Seek(dataStart + colStart[i], SeekOrigin.Begin);
|
||||
|
||||
byte x = (byte)(i % l.Size[0]);
|
||||
byte y = (byte)(i / l.Size[0]);
|
||||
var x = (byte)(i % l.Size[0]);
|
||||
var y = (byte)(i / l.Size[0]);
|
||||
byte z = 0;
|
||||
l.VoxelMap[x,y] = new Dictionary<byte, VxlElement>();
|
||||
do
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace OpenRA.FileSystem
|
||||
s = GlobalFileSystem.Open(filename);
|
||||
|
||||
// Parse package header
|
||||
BinaryReader reader = new BinaryReader(s);
|
||||
uint signature = reader.ReadUInt32();
|
||||
var reader = new BinaryReader(s);
|
||||
var signature = reader.ReadUInt32();
|
||||
if (signature != 0x8C655D13)
|
||||
throw new InvalidDataException("Not an Installshield package");
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.FileSystem
|
||||
|
||||
// Parse the directory list
|
||||
s.Seek(TOCAddress, SeekOrigin.Begin);
|
||||
BinaryReader TOCreader = new BinaryReader(s);
|
||||
var TOCreader = new BinaryReader(s);
|
||||
|
||||
var fileCountInDirs = new List<uint>();
|
||||
// Parse directories
|
||||
|
||||
@@ -64,10 +64,10 @@ namespace OpenRA.FileSystem
|
||||
if (name.Length % 4 != 0)
|
||||
name = name.PadRight(name.Length + (4 - name.Length % 4), '\0');
|
||||
|
||||
MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(name));
|
||||
BinaryReader reader = new BinaryReader(ms);
|
||||
var ms = new MemoryStream(Encoding.ASCII.GetBytes(name));
|
||||
var reader = new BinaryReader(ms);
|
||||
|
||||
int len = name.Length >> 2;
|
||||
var len = name.Length >> 2;
|
||||
uint result = 0;
|
||||
|
||||
while (len-- != 0)
|
||||
@@ -80,11 +80,11 @@ namespace OpenRA.FileSystem
|
||||
{
|
||||
name = name.ToUpperInvariant();
|
||||
var l = name.Length;
|
||||
int a = l >> 2;
|
||||
var a = l >> 2;
|
||||
if ((l & 3) != 0)
|
||||
{
|
||||
name += (char)(l - (a << 2));
|
||||
int i = 3 - (l & 3);
|
||||
var i = 3 - (l & 3);
|
||||
while (i-- != 0)
|
||||
name += name[a << 2];
|
||||
}
|
||||
@@ -99,9 +99,9 @@ namespace OpenRA.FileSystem
|
||||
|
||||
public static void AddStandardName(string s)
|
||||
{
|
||||
uint hash = HashFilename(s, PackageHashType.Classic); // RA1 and TD
|
||||
var hash = HashFilename(s, PackageHashType.Classic); // RA1 and TD
|
||||
Names.Add(hash, s);
|
||||
uint crcHash = HashFilename(s, PackageHashType.CRC32); // TS
|
||||
var crcHash = HashFilename(s, PackageHashType.CRC32); // TS
|
||||
Names.Add(crcHash, s);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
@@ -17,7 +16,6 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using OpenRA.FileSystem;
|
||||
using MaxMind.GeoIP2;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -90,7 +89,7 @@ namespace OpenRA
|
||||
{
|
||||
var ret = new List<ITraitInfo>();
|
||||
var t = Traits.WithInterface<ITraitInfo>().ToList();
|
||||
int index = 0;
|
||||
var index = 0;
|
||||
while (t.Count != 0)
|
||||
{
|
||||
var prereqs = PrerequisitesOf(t[index]);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Support;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.GameRules
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.GameRules
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
public class CursorSequence
|
||||
|
||||
@@ -44,13 +44,13 @@ namespace OpenRA.Graphics
|
||||
float[] trgb = { h + 1 / 3.0f, h, h - 1 / 3.0f };
|
||||
float[] rgb = { 0, 0, 0 };
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (var k = 0; k < 3; k++)
|
||||
{
|
||||
while (trgb[k] < 0) trgb[k] += 1.0f;
|
||||
while (trgb[k] > 1) trgb[k] -= 1.0f;
|
||||
}
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (var k = 0; k < 3; k++)
|
||||
{
|
||||
if (trgb[k] < 1 / 6.0f) { rgb[k] = p + ((q - p) * 6 * trgb[k]); }
|
||||
else if (trgb[k] >= 1 / 6.0f && trgb[k] < 0.5) { rgb[k] = q; }
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -36,7 +35,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* c = (int*)bitmapData.Scan0;
|
||||
var c = (int*)bitmapData.Scan0;
|
||||
|
||||
for (var x = 0; x < map.Bounds.Width; x++)
|
||||
for (var y = 0; y < map.Bounds.Height; y++)
|
||||
@@ -57,14 +56,14 @@ namespace OpenRA.Graphics
|
||||
// in a world use AddCustomTerrain instead
|
||||
static Bitmap AddStaticResources(TileSet tileset, Map map, Ruleset resourceRules, Bitmap terrainBitmap)
|
||||
{
|
||||
Bitmap terrain = new Bitmap(terrainBitmap);
|
||||
var terrain = new Bitmap(terrainBitmap);
|
||||
|
||||
var bitmapData = terrain.LockBits(terrain.Bounds(),
|
||||
ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* c = (int*)bitmapData.Scan0;
|
||||
var c = (int*)bitmapData.Scan0;
|
||||
|
||||
for (var x = 0; x < map.Bounds.Width; x++)
|
||||
for (var y = 0; y < map.Bounds.Height; y++)
|
||||
@@ -99,7 +98,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* c = (int*)bitmapData.Scan0;
|
||||
var c = (int*)bitmapData.Scan0;
|
||||
|
||||
for (var x = 0; x < map.Bounds.Width; x++)
|
||||
for (var y = 0; y < map.Bounds.Height; y++)
|
||||
@@ -127,7 +126,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* c = (int*)bitmapData.Scan0;
|
||||
var c = (int*)bitmapData.Scan0;
|
||||
|
||||
foreach (var t in world.ActorsWithTrait<IRadarSignature>())
|
||||
{
|
||||
@@ -161,7 +160,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* c = (int*)bitmapData.Scan0;
|
||||
var c = (int*)bitmapData.Scan0;
|
||||
|
||||
for (var x = 0; x < map.Bounds.Width; x++)
|
||||
for (var y = 0; y < map.Bounds.Height; y++)
|
||||
@@ -185,7 +184,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
public static Bitmap RenderMapPreview(TileSet tileset, Map map, Ruleset resourceRules, bool actualSize)
|
||||
{
|
||||
Bitmap terrain = TerrainBitmap(tileset, map, actualSize);
|
||||
var terrain = TerrainBitmap(tileset, map, actualSize);
|
||||
return AddStaticResources(tileset, map, resourceRules, terrain);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
public void ApplyRemap(IPaletteRemap r)
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
for (var i = 0; i < 256; i++)
|
||||
colors[i] = (uint)r.GetRemappedColor(Color.FromArgb((int)colors[i]), i).ToArgb();
|
||||
}
|
||||
|
||||
@@ -54,19 +54,19 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
colors = new uint[256];
|
||||
|
||||
using (BinaryReader reader = new BinaryReader(s))
|
||||
using (var reader = new BinaryReader(s))
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
for (var i = 0; i < 256; i++)
|
||||
{
|
||||
byte r = (byte)(reader.ReadByte() << 2);
|
||||
byte g = (byte)(reader.ReadByte() << 2);
|
||||
byte b = (byte)(reader.ReadByte() << 2);
|
||||
var r = (byte)(reader.ReadByte() << 2);
|
||||
var g = (byte)(reader.ReadByte() << 2);
|
||||
var b = (byte)(reader.ReadByte() << 2);
|
||||
colors[i] = (uint)((255 << 24) | (r << 16) | (g << 8) | b);
|
||||
}
|
||||
}
|
||||
|
||||
colors[0] = 0; // convert black background to transparency
|
||||
foreach (int i in remapShadow)
|
||||
foreach (var i in remapShadow)
|
||||
colors[i] = 140u << 24;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace OpenRA.Graphics
|
||||
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
unsafe
|
||||
{
|
||||
uint* c = (uint*)data.Scan0;
|
||||
var c = (uint*)data.Scan0;
|
||||
for (var x = 0; x < 256; x++)
|
||||
*(c + x) = colors[x];
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Graphics
|
||||
RgbaSpriteRenderer = new SpriteRenderer(this, device.CreateShader("rgba"));
|
||||
SpriteRenderer = new SpriteRenderer(this, device.CreateShader("shp"));
|
||||
|
||||
for (int i = 0; i < TempBufferCount; i++)
|
||||
for (var i = 0; i < TempBufferCount; i++)
|
||||
tempBuffers.Enqueue(device.CreateVertexBuffer(TempBufferSize));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using SharpFont;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
@@ -94,7 +93,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
GlyphInfo CreateGlyph(Pair<char, Color> c)
|
||||
{
|
||||
uint index = face.GetCharIndex(c.First);
|
||||
var index = face.GetCharIndex(c.First);
|
||||
face.LoadGlyph(index, LoadFlags.Default, LoadTarget.Normal);
|
||||
face.Glyph.RenderGlyph(RenderMode.Normal);
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
var terrainPalette = wr.Palette("terrain").Index;
|
||||
var vertices = new Vertex[4 * map.Bounds.Height * map.Bounds.Width];
|
||||
int nv = 0;
|
||||
var nv = 0;
|
||||
|
||||
for (var j = map.Bounds.Top; j < map.Bounds.Bottom; j++)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Graphics
|
||||
var srcOffset = 0;
|
||||
for (var j = 0; j < height; j++)
|
||||
{
|
||||
for (int i = 0; i < srcStride; i++, srcOffset++)
|
||||
for (var i = 0; i < srcStride; i++, srcOffset++)
|
||||
{
|
||||
data[destOffset] = src[srcOffset];
|
||||
destOffset += 4;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Graphics
|
||||
c++;
|
||||
}
|
||||
|
||||
Sprite s = sheetBuilder.Allocate(new Size(su, sv));
|
||||
var s = sheetBuilder.Allocate(new Size(su, sv));
|
||||
Util.FastCopyIntoChannel(s, 0, colors);
|
||||
Util.FastCopyIntoChannel(s, 1, normals);
|
||||
s.sheet.CommitData();
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA
|
||||
if (!GlobalFileSystem.Exists(package)) { onError("Cannot find " + package); return false; }
|
||||
GlobalFileSystem.Mount(package);
|
||||
|
||||
foreach (string s in files)
|
||||
foreach (var s in files)
|
||||
{
|
||||
var destFile = Path.Combine(destPath, s);
|
||||
using (var sourceStream = GlobalFileSystem.Open(s))
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA
|
||||
return false;
|
||||
}
|
||||
|
||||
List<string> extracted = new List<string>();
|
||||
var extracted = new List<string>();
|
||||
try
|
||||
{
|
||||
using (var stream = File.OpenRead(zipFile))
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace OpenRA
|
||||
var tile = tileset.Templates.First();
|
||||
var tileRef = new TileReference<ushort, byte> { Type = tile.Key, Index = (byte)0 };
|
||||
|
||||
Map map = new Map()
|
||||
var map = new Map()
|
||||
{
|
||||
Title = "Name your map here",
|
||||
Description = "Describe your map here",
|
||||
@@ -364,8 +364,8 @@ namespace OpenRA
|
||||
// Load tile data
|
||||
var data = dataStream.ReadBytes(MapSize.X * MapSize.Y * 3);
|
||||
var d = 0;
|
||||
for (int i = 0; i < MapSize.X; i++)
|
||||
for (int j = 0; j < MapSize.Y; j++)
|
||||
for (var i = 0; i < MapSize.X; i++)
|
||||
for (var j = 0; j < MapSize.Y; j++)
|
||||
{
|
||||
var tile = BitConverter.ToUInt16(data, d);
|
||||
d += 2;
|
||||
|
||||
@@ -11,13 +11,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
@@ -172,7 +170,7 @@ namespace OpenRA
|
||||
|
||||
// Yuck... But this helps the UI Jank when opening the map selector significantly.
|
||||
Thread.Sleep(Environment.ProcessorCount == 1 ? 25 : 5);
|
||||
};
|
||||
}
|
||||
}
|
||||
Log.Write("debug", "MapCache.LoadAsyncInternal ended");
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -18,7 +17,6 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
|
||||
@@ -8,13 +8,11 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -121,7 +119,7 @@ namespace OpenRA
|
||||
var root = new List<MiniYamlNode>();
|
||||
foreach (var field in Fields)
|
||||
{
|
||||
FieldInfo f = this.GetType().GetField(field);
|
||||
var f = this.GetType().GetField(field);
|
||||
if (f.GetValue(this) == null)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace OpenRA
|
||||
|
||||
public static List<MiniYamlNode> FromFileInPackage(string path)
|
||||
{
|
||||
List<string> lines = new List<string>();
|
||||
var lines = new List<string>();
|
||||
using (var stream = GlobalFileSystem.Open(path))
|
||||
using (var reader = new StreamReader(stream))
|
||||
while (!reader.EndOfStream)
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
public class GameServer
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace OpenRA.Network
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < packet.Length; i++)
|
||||
for (var i = 0; i < packet.Length; i++)
|
||||
{
|
||||
if (packet[i] != existingSync[i])
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
|
||||
@@ -12,8 +12,6 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
using System;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA
|
||||
{
|
||||
var p = ctor.GetParameters();
|
||||
var a = new object[p.Length];
|
||||
for (int i = 0; i < p.Length; i++)
|
||||
for (var i = 0; i < p.Length; i++)
|
||||
{
|
||||
var key = p[i].Name;
|
||||
if (!args.ContainsKey(key)) throw new InvalidOperationException("ObjectCreator: key `{0}' not found".F(key));
|
||||
|
||||
@@ -13,7 +13,6 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using Eluant.ObjectBinding;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace OpenRA.Primitives
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
int addLevel = level;
|
||||
int addIndex = index;
|
||||
var addLevel = level;
|
||||
var addIndex = index;
|
||||
|
||||
while (addLevel >= 1 && Above(addLevel, addIndex).CompareTo(item) > 0)
|
||||
{
|
||||
@@ -53,8 +53,8 @@ namespace OpenRA.Primitives
|
||||
|
||||
T Last()
|
||||
{
|
||||
int lastLevel = level;
|
||||
int lastIndex = index;
|
||||
var lastLevel = level;
|
||||
var lastIndex = index;
|
||||
|
||||
if (--lastIndex < 0)
|
||||
lastIndex = (1 << --lastLevel) - 1;
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Primitives
|
||||
if (level == 0 && index == 0)
|
||||
throw new InvalidOperationException("Attempting to pop empty PriorityQueue");
|
||||
|
||||
T ret = At(0, 0);
|
||||
var ret = At(0, 0);
|
||||
BubbleInto(0, 0, Last());
|
||||
if (--index < 0)
|
||||
index = (1 << --level) - 1;
|
||||
@@ -78,8 +78,8 @@ namespace OpenRA.Primitives
|
||||
|
||||
void BubbleInto(int intoLevel, int intoIndex, T val)
|
||||
{
|
||||
int downLevel = intoLevel + 1;
|
||||
int downIndex = intoIndex << 1;
|
||||
var downLevel = intoLevel + 1;
|
||||
var downIndex = intoIndex << 1;
|
||||
|
||||
if (downLevel > level || (downLevel == level && downIndex >= index))
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA
|
||||
|
||||
public static bool WithinEpsilon(float2 a, float2 b, float e)
|
||||
{
|
||||
float2 d = a - b;
|
||||
var d = a - b;
|
||||
return Math.Abs(d.X) < e && Math.Abs(d.Y) < e;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Eluant;
|
||||
using Eluant.ObjectBinding;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Scripting
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -19,7 +18,6 @@ using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Support;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Scripting
|
||||
|
||||
@@ -9,14 +9,9 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Eluant;
|
||||
using Eluant.ObjectBinding;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Scripting
|
||||
{
|
||||
|
||||
@@ -9,14 +9,10 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Eluant;
|
||||
using Eluant.ObjectBinding;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Scripting
|
||||
{
|
||||
@@ -54,7 +50,7 @@ namespace OpenRA.Scripting
|
||||
var mi = (MethodInfo)Member;
|
||||
var pi = mi.GetParameters();
|
||||
|
||||
object[] clrArgs = new object[pi.Length];
|
||||
var clrArgs = new object[pi.Length];
|
||||
var argCount = args.Count;
|
||||
for (var i = 0; i < pi.Length; i++)
|
||||
{
|
||||
|
||||
@@ -8,15 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Eluant;
|
||||
using Eluant.ObjectBinding;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Scripting
|
||||
{
|
||||
|
||||
@@ -9,14 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Eluant;
|
||||
using Eluant.ObjectBinding;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Scripting
|
||||
{
|
||||
|
||||
@@ -10,17 +10,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Eluant;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Support;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Scripting
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Server
|
||||
|
||||
@@ -9,15 +9,12 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Primitives;
|
||||
@@ -447,7 +444,7 @@ namespace OpenRA.Server
|
||||
{
|
||||
case "Command":
|
||||
{
|
||||
bool handled = false;
|
||||
var handled = false;
|
||||
foreach (var t in serverTraits.WithInterface<IInterpretCommand>())
|
||||
if (handled = t.InterpretCommand(this, conn, GetClient(conn), so.Data))
|
||||
break;
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -230,10 +229,7 @@ namespace OpenRA
|
||||
var err1 = FieldLoader.UnknownFieldAction;
|
||||
var err2 = FieldLoader.InvalidValueAction;
|
||||
|
||||
FieldLoader.UnknownFieldAction = (s, f) =>
|
||||
{
|
||||
Console.WriteLine("Ignoring unknown field `{0}` on `{1}`".F(s, f.Name));
|
||||
};
|
||||
FieldLoader.UnknownFieldAction = (s, f) => Console.WriteLine("Ignoring unknown field `{0}` on `{1}`".F(s, f.Name));
|
||||
|
||||
if (File.Exists(settingsFile))
|
||||
{
|
||||
|
||||
@@ -533,8 +533,8 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
List<int> freeSources = new List<int>();
|
||||
foreach (int key in sourcePool.Keys)
|
||||
var freeSources = new List<int>();
|
||||
foreach (var key in sourcePool.Keys)
|
||||
{
|
||||
int state;
|
||||
AL.GetSource(key, ALGetSourcei.SourceState, out state);
|
||||
@@ -545,7 +545,7 @@ namespace OpenRA
|
||||
if (freeSources.Count == 0)
|
||||
return -1;
|
||||
|
||||
foreach (int i in freeSources)
|
||||
foreach (var i in freeSources)
|
||||
sourcePool[i].IsActive = false;
|
||||
|
||||
sourcePool[freeSources[0]].IsActive = true;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA
|
||||
var regex = new Regex("([^=]+)=(.*)");
|
||||
foreach (var s in src)
|
||||
{
|
||||
Match m = regex.Match(s);
|
||||
var m = regex.Match(s);
|
||||
if (!m.Success)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Support
|
||||
|
||||
public IEnumerable<double> Samples()
|
||||
{
|
||||
int n = head;
|
||||
var n = head;
|
||||
while (n != tail)
|
||||
{
|
||||
--n;
|
||||
@@ -82,8 +82,8 @@ namespace OpenRA.Support
|
||||
|
||||
public double Average(int count)
|
||||
{
|
||||
int i = 0;
|
||||
int n = head;
|
||||
var i = 0;
|
||||
var n = head;
|
||||
double sum = 0;
|
||||
while (i < count && n != tail)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Support
|
||||
{
|
||||
get
|
||||
{
|
||||
int n = head;
|
||||
var n = head;
|
||||
if (--n < 0) n = samples.Length - 1;
|
||||
return samples[n];
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace OpenRA
|
||||
|
||||
public static int hash_tdict(TypeDictionary d)
|
||||
{
|
||||
int ret = 0;
|
||||
var ret = 0;
|
||||
foreach (var o in d)
|
||||
ret += CalculateSyncHash(o);
|
||||
return ret;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA
|
||||
@@ -20,9 +19,9 @@ namespace OpenRA
|
||||
{
|
||||
public static int BinarySearchMany(this List<Actor> list, uint searchFor)
|
||||
{
|
||||
int start = 0;
|
||||
int end = list.Count;
|
||||
int mid = 0;
|
||||
var start = 0;
|
||||
var end = list.Count;
|
||||
var mid = 0;
|
||||
while (start != end)
|
||||
{
|
||||
mid = (start + end) / 2;
|
||||
@@ -173,13 +172,13 @@ namespace OpenRA
|
||||
public IEnumerable<TraitPair<T>> All()
|
||||
{
|
||||
++queries;
|
||||
for (int i = 0; i < actors.Count; i++)
|
||||
for (var i = 0; i < actors.Count; i++)
|
||||
yield return new TraitPair<T> { Actor = actors[i], Trait = traits[i] };
|
||||
}
|
||||
|
||||
public void RemoveActor(uint actor)
|
||||
{
|
||||
for (int i = actors.Count - 1; i >= 0; i--)
|
||||
for (var i = actors.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (actors[i].ActorID == actor)
|
||||
{
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public class BodyOrientationInfo : ITraitInfo, IBodyOrientationInfo
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace OpenRA
|
||||
{
|
||||
s = s.ToLowerInvariant();
|
||||
var components = s.Split('c');
|
||||
int cell = 0;
|
||||
int subcell = 0;
|
||||
var cell = 0;
|
||||
var subcell = 0;
|
||||
result = WRange.Zero;
|
||||
|
||||
switch (components.Length)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
@@ -60,7 +59,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
this.modRules = modRules;
|
||||
|
||||
GetText = () => { return Text; };
|
||||
GetText = () => Text;
|
||||
GetColor = () => TextColor;
|
||||
GetColorDisabled = () => TextColorDisabled;
|
||||
GetContrastColor = () => ContrastColor;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user