StyleCop clean Map/*.cs files

This commit is contained in:
Matthias Mailänder
2013-08-25 14:30:00 +02:00
parent ae00cb3adf
commit ba13c1d982
16 changed files with 68 additions and 72 deletions

View File

@@ -46,8 +46,8 @@ namespace OpenRA.Editor
surface.Map.MapTiles.Value[u + pos.X, v + pos.Y] =
new TileReference<ushort, byte>
{
type = brushTemplate.N,
index = template.PickAny ? (byte)((u + pos.X) % 4 + ((v + pos.Y) % 4) * 4) : (byte)z,
Type = brushTemplate.N,
Index = template.PickAny ? (byte)((u + pos.X) % 4 + ((v + pos.Y) % 4) * 4) : (byte)z,
};
var ch = new int2((pos.X + u) / Surface.ChunkSize, (pos.Y + v) / Surface.ChunkSize);
@@ -96,7 +96,7 @@ namespace OpenRA.Editor
for (var x = a.X; x <= b.X; x++)
{
s.Map.MapTiles.Value[x, p.Y] = new TileReference<ushort, byte> { type = brushTemplate.N, index = (byte)0 };
s.Map.MapTiles.Value[x, p.Y] = new TileReference<ushort, byte> { Type = brushTemplate.N, Index = (byte)0 };
if (s.Map.MapTiles.Value[x, p.Y - 1].Equals(replace))
maybeEnqueue(x, p.Y - 1);
if (s.Map.MapTiles.Value[x, p.Y + 1].Equals(replace))

10
OpenRA.Editor/Form1.cs Executable file → Normal file
View File

@@ -519,8 +519,8 @@ namespace OpenRA.Editor
for (var i = surface1.Map.Bounds.Left; i < surface1.Map.Bounds.Right; i++)
{
var tr = surface1.Map.MapTiles.Value[i, j];
if (tr.type == 0xff || tr.type == 0xffff || tr.type == 1 || tr.type == 2)
tr.index = (byte)r.Next(0, surface1.TileSetRenderer.Data(tr.type).Count);
if (tr.Type == 0xff || tr.Type == 0xffff || tr.Type == 1 || tr.Type == 2)
tr.Index = (byte)r.Next(0, surface1.TileSetRenderer.Data(tr.Type).Count);
surface1.Map.MapTiles.Value[i, j] = tr;
}
@@ -674,7 +674,7 @@ namespace OpenRA.Editor
for (int i = 0; i < surface1.Map.MapSize.X; i++)
for (int j = 0; j < surface1.Map.MapSize.Y; j++)
{
if (surface1.Map.MapResources.Value[i, j].type != 0)
if (surface1.Map.MapResources.Value[i, j].Type != 0)
totalResource += GetResourceValue(i, j);
}
@@ -689,7 +689,7 @@ namespace OpenRA.Editor
{
if (!surface1.Map.IsInMap(new CPos(x + u, y + v)))
continue;
if (surface1.Map.MapResources.Value[x + u, y + v].type == resourceType)
if (surface1.Map.MapResources.Value[x + u, y + v].Type == resourceType)
++sum;
}
@@ -699,7 +699,7 @@ namespace OpenRA.Editor
int GetResourceValue(int x, int y)
{
int imageLength = 0;
int type = surface1.Map.MapResources.Value[x, y].type;
int type = surface1.Map.MapResources.Value[x, y].Type;
var template = surface1.ResourceTemplates.Where(a => a.Value.Info.ResourceType == type).FirstOrDefault().Value;
if (type == 1)
imageLength = 12;

View File

@@ -254,11 +254,11 @@ namespace OpenRA.Editor
for (int j = 0; j < mapSize; j++)
for (int i = 0; i < mapSize; i++)
map.MapTiles.Value[i, j].type = ReadWord(ms);
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);
map.MapTiles.Value[i, j].Index = ReadByte(ms);
}
void UnpackRAOverlayData(MemoryStream ms)
@@ -311,8 +311,8 @@ namespace OpenRA.Editor
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);
}
}

View File

@@ -26,8 +26,8 @@ namespace OpenRA.Editor
surface.Map.MapResources.Value[surface.GetBrushLocation().X, surface.GetBrushLocation().Y]
= new TileReference<byte, byte>
{
type = (byte)resourceTemplate.Info.ResourceType,
index = (byte)random.Next(resourceTemplate.Info.SpriteNames.Length)
Type = (byte)resourceTemplate.Info.ResourceType,
Index = (byte)random.Next(resourceTemplate.Info.SpriteNames.Length)
};
var ch = new int2(surface.GetBrushLocation().X / Surface.ChunkSize,

10
OpenRA.Editor/Surface.cs Executable file → Normal file
View File

@@ -206,7 +206,7 @@ namespace OpenRA.Editor
var key = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == brushLocation);
if (key.Key != null) Map.Actors.Value.Remove(key.Key);
if (Map.MapResources.Value[brushLocation.X, brushLocation.Y].type != 0)
if (Map.MapResources.Value[brushLocation.X, brushLocation.Y].Type != 0)
{
Map.MapResources.Value[brushLocation.X, brushLocation.Y] = new TileReference<byte, byte>();
var ch = new int2(brushLocation.X / ChunkSize, brushLocation.Y / ChunkSize);
@@ -272,16 +272,16 @@ namespace OpenRA.Editor
for (var j = 0; j < ChunkSize; j++)
{
var tr = Map.MapTiles.Value[u * ChunkSize + i, v * ChunkSize + j];
var tile = TileSetRenderer.Data(tr.type);
var index = (tr.index < tile.Count) ? tr.index : (byte)0;
var tile = TileSetRenderer.Data(tr.Type);
var index = (tr.Index < tile.Count) ? tr.Index : (byte)0;
var rawImage = tile[index];
for (var x = 0; x < TileSetRenderer.TileSize.Width; x++)
for (var y = 0; y < TileSetRenderer.TileSize.Height; y++)
p[(j * TileSetRenderer.TileSize.Width + y) * stride + i * TileSetRenderer.TileSize.Width + x] = Palette.GetColor(rawImage[x + TileSetRenderer.TileSize.Width * y]).ToArgb();
if (Map.MapResources.Value[u * ChunkSize + i, v * ChunkSize + j].type != 0)
if (Map.MapResources.Value[u * ChunkSize + i, v * ChunkSize + j].Type != 0)
{
var resourceImage = ResourceTemplates[Map.MapResources.Value[u * ChunkSize + i, v * ChunkSize + j].type].Bitmap;
var resourceImage = ResourceTemplates[Map.MapResources.Value[u * ChunkSize + i, v * ChunkSize + j].Type].Bitmap;
var srcdata = resourceImage.LockBits(resourceImage.Bounds(),
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);