Squash compiler warnings

This commit is contained in:
Paul Chote
2011-04-07 21:26:57 +12:00
parent b0425aff3b
commit aba14eec23
11 changed files with 17 additions and 27 deletions

View File

@@ -95,7 +95,6 @@ namespace OpenRA.Editor
public static ActorTemplate RenderActor(ActorInfo info, TileSet tileset, Palette p) public static ActorTemplate RenderActor(ActorInfo info, TileSet tileset, Palette p)
{ {
var ri = info.Traits.Get<RenderSimpleInfo>();
var image = RenderSimple.GetImage(info, tileset.Id); var image = RenderSimple.GetImage(info, tileset.Id);
using (var s = FileSystem.OpenWithExts(image, tileset.Extensions)) using (var s = FileSystem.OpenWithExts(image, tileset.Extensions))

View File

@@ -45,7 +45,7 @@ namespace OpenRA.FileFormats.Graphics
var length = IPAddress.NetworkToHostOrder(br.ReadInt32()); var length = IPAddress.NetworkToHostOrder(br.ReadInt32());
var type = Encoding.UTF8.GetString(br.ReadBytes(4)); var type = Encoding.UTF8.GetString(br.ReadBytes(4));
var content = br.ReadBytes(length); var content = br.ReadBytes(length);
var crc = br.ReadInt32(); /*var crc = */br.ReadInt32();
using (var ms = new MemoryStream(content)) using (var ms = new MemoryStream(content))
using (var cr = new BinaryReader(ms)) using (var cr = new BinaryReader(ms))
@@ -59,7 +59,7 @@ namespace OpenRA.FileFormats.Graphics
var bitDepth = cr.ReadByte(); var bitDepth = cr.ReadByte();
var colorType = (PngColorType)cr.ReadByte(); var colorType = (PngColorType)cr.ReadByte();
var compression = cr.ReadByte(); var compression = cr.ReadByte();
var filter = cr.ReadByte(); /*var filter = */cr.ReadByte();
var interlace = cr.ReadByte(); var interlace = cr.ReadByte();
if (compression != 0) throw new InvalidDataException("Compression method not supported"); if (compression != 0) throw new InvalidDataException("Compression method not supported");
@@ -102,8 +102,8 @@ namespace OpenRA.FileFormats.Graphics
using (var ns = new MemoryStream(data.ToArray())) using (var ns = new MemoryStream(data.ToArray()))
{ {
// 'zlib' flags bytes; confuses the DeflateStream. // 'zlib' flags bytes; confuses the DeflateStream.
var flags = (byte)ns.ReadByte(); /*var flags = (byte)*/ns.ReadByte();
var moreFlags = (byte)ns.ReadByte(); /*var moreFlags = (byte)*/ns.ReadByte();
using (var ds = new DeflateStream(ns, CompressionMode.Decompress)) using (var ds = new DeflateStream(ns, CompressionMode.Decompress))
using (var dr = new BinaryReader(ds)) using (var dr = new BinaryReader(ds))

View File

@@ -40,7 +40,9 @@ namespace OpenRA.FileFormats
public void Force() public void Force()
{ {
#pragma warning disable 0168
var ignored = Value; var ignored = Value;
#pragma warning restore 0168
} }
} }

View File

@@ -16,13 +16,12 @@ namespace OpenRA
{ {
public class UiOverlay public class UiOverlay
{ {
Sprite buildOk, buildBlocked, unitDebug; Sprite buildOk, buildBlocked;
public UiOverlay() public UiOverlay()
{ {
buildOk = SynthesizeTile(0x0f); buildOk = SynthesizeTile(0x0f);
buildBlocked = SynthesizeTile(0x08); buildBlocked = SynthesizeTile(0x08);
unitDebug = SynthesizeTile(0x04);
} }
public static Sprite SynthesizeTile(byte paletteIndex) public static Sprite SynthesizeTile(byte paletteIndex)

View File

@@ -24,11 +24,9 @@ namespace OpenRA.Mods.RA
{ {
Dictionary<string, Actor> Actors; Dictionary<string, Actor> Actors;
static int2 ViewportOrigin; static int2 ViewportOrigin;
Map Map;
public void WorldLoaded(World w) public void WorldLoaded(World w)
{ {
Map = w.Map;
var b = w.Map.Bounds; var b = w.Map.Bounds;
ViewportOrigin = new int2(b.Left + b.Width/2, b.Top + b.Height/2); ViewportOrigin = new int2(b.Left + b.Width/2, b.Top + b.Height/2);
Game.MoveViewport(ViewportOrigin); Game.MoveViewport(ViewportOrigin);

View File

@@ -28,11 +28,9 @@ namespace OpenRA.Mods.Cnc
{ {
Dictionary<string, Actor> Actors; Dictionary<string, Actor> Actors;
Dictionary<string, Player> Players; Dictionary<string, Player> Players;
Map Map;
public void WorldLoaded(World w) public void WorldLoaded(World w)
{ {
Map = w.Map;
Players = w.players.Values.ToDictionary(p => p.InternalName); Players = w.players.Values.ToDictionary(p => p.InternalName);
Actors = w.WorldActor.Trait<SpawnMapActors>().Actors; Actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
var b = w.Map.Bounds; var b = w.Map.Bounds;

View File

@@ -18,7 +18,6 @@ namespace OpenRA.Mods.RA.Effects
class CashTick : IEffect class CashTick : IEffect
{ {
string s; string s;
int lifetime;
int remaining; int remaining;
int velocity; int velocity;
float2 pos; float2 pos;
@@ -27,7 +26,6 @@ namespace OpenRA.Mods.RA.Effects
public CashTick(int value, int lifetime, int velocity, float2 pos, Color color) public CashTick(int value, int lifetime, int velocity, float2 pos, Color color)
{ {
this.color = color; this.color = color;
this.lifetime = lifetime;
this.velocity = velocity; this.velocity = velocity;
s = "{0}${1}".F(value < 0 ? "-" : "+", value); s = "{0}${1}".F(value < 0 ? "-" : "+", value);
this.pos = pos - 0.5f*Game.Renderer.TinyBoldFont.Measure(s).ToFloat2(); this.pos = pos - 0.5f*Game.Renderer.TinyBoldFont.Measure(s).ToFloat2();

View File

@@ -18,15 +18,13 @@ namespace OpenRA.Mods.RA.Effects
class SatelliteLaunch : IEffect class SatelliteLaunch : IEffect
{ {
int frame = 0; int frame = 0;
Actor a;
Animation doors = new Animation("atek"); Animation doors = new Animation("atek");
float2 doorOffset = new float2(-4,0); float2 doorOffset = new float2(-4,0);
int2 pos; float2 pos;
public SatelliteLaunch(Actor a) public SatelliteLaunch(Actor a)
{ {
this.a = a; pos = a.CenterLocation - .5f * doors.Image.size + doorOffset;
pos = a.CenterLocation;
doors.PlayThen("active", doors.PlayThen("active",
() => a.World.AddFrameEndTask(w => w.Remove(this))); () => a.World.AddFrameEndTask(w => w.Remove(this)));
} }
@@ -37,14 +35,13 @@ namespace OpenRA.Mods.RA.Effects
if (++frame == 19) if (++frame == 19)
{ {
world.AddFrameEndTask(w => w.Add(new GpsSatellite(pos - .5f * doors.Image.size + doorOffset))); world.AddFrameEndTask(w => w.Add(new GpsSatellite(pos)));
} }
} }
public IEnumerable<Renderable> Render() public IEnumerable<Renderable> Render()
{ {
yield return new Renderable(doors.Image, yield return new Renderable(doors.Image, pos, "effect", (int)doorOffset.Y);
pos - .5f * doors.Image.size + doorOffset, "effect", (int)doorOffset.Y);
} }
} }
} }

View File

@@ -25,11 +25,9 @@ namespace OpenRA.Mods.RA
class SupplyTruck : IIssueOrder, IResolveOrder, IOrderVoice class SupplyTruck : IIssueOrder, IResolveOrder, IOrderVoice
{ {
int payload;
SupplyTruckInfo Info; SupplyTruckInfo Info;
public SupplyTruck(SupplyTruckInfo info) public SupplyTruck(SupplyTruckInfo info)
{ {
payload = info.Payload;
Info = info; Info = info;
} }
@@ -58,7 +56,7 @@ namespace OpenRA.Mods.RA
self.SetTargetLine(Target.FromOrder(order), Color.Yellow); self.SetTargetLine(Target.FromOrder(order), Color.Yellow);
self.CancelActivity(); self.CancelActivity();
self.QueueActivity(new Enter(order.TargetActor)); self.QueueActivity(new Enter(order.TargetActor));
self.QueueActivity(new DonateSupplies(order.TargetActor, payload)); self.QueueActivity(new DonateSupplies(order.TargetActor, Info.Payload));
} }
} }

View File

@@ -30,8 +30,8 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
return true; return true;
}; };
var installed = Rules.Music.Count(m => m.Value.Exists) > 1;
/* /*
var installed = Rules.Music.Count(m => m.Value.Exists) > 1;
// Hack around some mix packages including hellmarch for ra // Hack around some mix packages including hellmarch for ra
bg.GetWidget("BUTTON_INSTALL").IsVisible = () => !installed; bg.GetWidget("BUTTON_INSTALL").IsVisible = () => !installed;
bg.GetWidget("BUTTON_INSTALL").OnMouseUp = mi => { bg.GetWidget("BUTTON_INSTALL").OnMouseUp = mi => {

View File

@@ -121,7 +121,7 @@ namespace OpenRA.TilesetBuilder
// Create a Tileset definition // Create a Tileset definition
// Todo: Pull this info from the gui // Todo: Pull this info from the gui
var tilesetFile = "tileset-arrakis.yaml"; var tilesetFile = "tileset-arrakis.yaml";
var mixFile = "arrakis.mix"; //var mixFile = "arrakis.mix";
var tileset = new TileSet() var tileset = new TileSet()
{ {
Name = "Arrakis", Name = "Arrakis",
@@ -177,12 +177,13 @@ namespace OpenRA.TilesetBuilder
tileset.Save(Path.Combine(dir, tilesetFile)); tileset.Save(Path.Combine(dir, tilesetFile));
throw new NotImplementedException("NotI"); throw new NotImplementedException("NotI");
//PackageWriter.CreateMix(Path.Combine(dir, mixFile),fileList); //PackageWriter.CreateMix(Path.Combine(dir, mixFile),fileList);
/*
// Cleanup // Cleanup
foreach (var file in fileList) foreach (var file in fileList)
File.Delete(file); File.Delete(file);
Console.WriteLine("Finished export"); Console.WriteLine("Finished export");
*/
} }
string ExportPalette(List<Color> p, string file) string ExportPalette(List<Color> p, string file)