diff --git a/OpenRA.Server/Server.cs b/OpenRA.Server/Server.cs index 74cd3a056f..a2f7b1661e 100644 --- a/OpenRA.Server/Server.cs +++ b/OpenRA.Server/Server.cs @@ -99,13 +99,6 @@ namespace OpenRA.Server { // TODO: Query the list of palettes from somewhere, and pick one return 0; - - /* - for (var i = 0; i < 8; i++) - if (lobbyInfo.Clients.All(c => c.Palette != i)) - return "player"+i; - */ - throw new InvalidOperationException("No free palettes"); } static void AcceptConnection() diff --git a/OpenRa.FileFormats/AudLoader.cs b/OpenRa.FileFormats/AudLoader.cs index 79d5207c19..2758677fd8 100644 --- a/OpenRa.FileFormats/AudLoader.cs +++ b/OpenRa.FileFormats/AudLoader.cs @@ -89,11 +89,11 @@ namespace OpenRa.FileFormats public static byte[] LoadSound(Stream s) { var br = new BinaryReader(s); - var sampleRate = br.ReadUInt16(); + /*var sampleRate =*/ br.ReadUInt16(); var dataSize = br.ReadInt32(); var outputSize = br.ReadInt32(); - var flags = (SoundFlags)br.ReadByte(); - var format = (SoundFormat)br.ReadByte(); + /*var flags = (SoundFlags)*/ br.ReadByte(); + /*var format = (SoundFormat)*/ br.ReadByte(); var output = new byte[outputSize]; var offset = 0; diff --git a/OpenRa.FileFormats/Map.cs b/OpenRa.FileFormats/Map.cs index cb57b84277..16056cc7c9 100644 --- a/OpenRa.FileFormats/Map.cs +++ b/OpenRa.FileFormats/Map.cs @@ -104,7 +104,7 @@ namespace OpenRa.FileFormats byte[] dest = new byte[8192]; byte[] src = reader.ReadBytes((int)length); - int actualLength = Format80.DecodeInto(src, dest); + /*int actualLength =*/ Format80.DecodeInto(src, dest); chunks.Add(dest); } diff --git a/OpenRa.FileFormats/Package.cs b/OpenRa.FileFormats/Package.cs index 0edc130e80..69c0d77efd 100644 --- a/OpenRa.FileFormats/Package.cs +++ b/OpenRa.FileFormats/Package.cs @@ -33,7 +33,6 @@ namespace OpenRa.FileFormats public class Package : IFolder { - readonly string filename; readonly Dictionary index; readonly bool isRmix, isEncrypted; readonly long dataStart; @@ -41,7 +40,6 @@ namespace OpenRa.FileFormats public Package(string filename) { - this.filename = filename; s = FileSystem.Open(filename); BinaryReader reader = new BinaryReader(s); @@ -127,7 +125,7 @@ namespace OpenRa.FileFormats BinaryReader reader = new BinaryReader(s); ushort numFiles = reader.ReadUInt16(); - uint dataSize = reader.ReadUInt32(); + /*uint dataSize = */reader.ReadUInt32(); for (int i = 0; i < numFiles; i++) items.Add(new PackageEntry(reader)); diff --git a/OpenRa.FileFormats/PriorityQueue.cs b/OpenRa.FileFormats/PriorityQueue.cs index 6d76d54b0f..71fe120a72 100644 --- a/OpenRa.FileFormats/PriorityQueue.cs +++ b/OpenRa.FileFormats/PriorityQueue.cs @@ -109,12 +109,5 @@ namespace OpenRa.FileFormats items[intoLevel][intoIndex] = At(downLevel, downIndex); BubbleInto(downLevel, downIndex, val); } - - int RowLength(int i) - { - if (i == level) - return index; - return (1 << i); - } } } diff --git a/OpenRa.FileFormats/Terrain.cs b/OpenRa.FileFormats/Terrain.cs index 4f649e3e82..b615a9d88d 100644 --- a/OpenRa.FileFormats/Terrain.cs +++ b/OpenRa.FileFormats/Terrain.cs @@ -29,7 +29,7 @@ namespace OpenRa.FileFormats public Terrain( Stream stream ) { - int Width, Height, XDim, YDim, NumTiles; + int Width, Height; BinaryReader reader = new BinaryReader( stream ); Width = reader.ReadUInt16(); @@ -38,11 +38,11 @@ namespace OpenRa.FileFormats if( Width != 24 || Height != 24 ) throw new InvalidDataException( string.Format( "{0}x{1}", Width, Height ) ); - NumTiles = reader.ReadUInt16(); + /*NumTiles = */reader.ReadUInt16(); reader.ReadUInt16(); - XDim = reader.ReadUInt16(); - YDim = reader.ReadUInt16(); - uint FileSize = reader.ReadUInt32(); + /*XDim = */reader.ReadUInt16(); + /*YDim = */reader.ReadUInt16(); + /*uint FileSize = */reader.ReadUInt32(); uint ImgStart = reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index ad8a32f57c..337df2bcbc 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -94,7 +94,6 @@ namespace OpenRa // mapchooser Sheet mapChooserSheet; Sprite mapChooserSprite; - Sprite colorBlock; int mapOffset = 0; public Chrome(Renderer r) @@ -143,7 +142,6 @@ namespace OpenRa clock = new Animation("clock"); mapChooserSheet = new Sheet(r, new Size(128, 128)); - colorBlock = SheetBuilder.Add(new Size(65 - 8, 22 - 8), 0x54); } List visibleTabs = new List(); diff --git a/OpenRa.Game/Effects/Missile.cs b/OpenRa.Game/Effects/Missile.cs index b9cbca62f5..5bdfadb662 100755 --- a/OpenRa.Game/Effects/Missile.cs +++ b/OpenRa.Game/Effects/Missile.cs @@ -28,7 +28,6 @@ namespace OpenRa.Effects { class Missile : IEffect { - readonly Player Owner; readonly Actor FiredBy; readonly WeaponInfo Weapon; readonly ProjectileInfo Projectile; @@ -47,7 +46,6 @@ namespace OpenRa.Effects Projectile = Rules.ProjectileInfo[Weapon.Projectile]; Warhead = Rules.WarheadInfo[Weapon.Warhead]; FiredBy = firedBy; - Owner = owner; Target = target; Pos = src.ToFloat2(); Altitude = altitude; diff --git a/OpenRa.Game/Graphics/Minimap.cs b/OpenRa.Game/Graphics/Minimap.cs index fc6a5d2878..256246d83a 100644 --- a/OpenRa.Game/Graphics/Minimap.cs +++ b/OpenRa.Game/Graphics/Minimap.cs @@ -30,10 +30,10 @@ namespace OpenRa.Graphics class Minimap { readonly World world; - Sheet sheet, mapOnlySheet, mapSpawnPointSheet; + Sheet sheet, mapOnlySheet; SpriteRenderer rgbaRenderer; LineRenderer lineRenderer; - Sprite sprite, mapOnlySprite, mapSpawnPointSprite; + Sprite sprite, mapOnlySprite; Bitmap terrain, oreLayer; Rectangle bounds; @@ -49,7 +49,6 @@ namespace OpenRa.Graphics this.world = world; sheet = new Sheet(r, new Size(128, 128)); mapOnlySheet = new Sheet(r, new Size(128, 128)); - mapSpawnPointSheet = new Sheet(r, new Size(128, 128)); lineRenderer = new LineRenderer(r); rgbaRenderer = new SpriteRenderer(r, true, r.RgbaSpriteShader); @@ -61,7 +60,6 @@ namespace OpenRa.Graphics sprite = new Sprite(sheet, bounds, TextureChannel.Alpha); mapOnlySprite = new Sprite(mapOnlySheet, bounds, TextureChannel.Alpha); - mapSpawnPointSprite = new Sprite(mapSpawnPointSheet, bounds, TextureChannel.Alpha); shroudColor = Color.FromArgb(alpha, Color.Black); diff --git a/OpenRa.Game/Graphics/Renderer.cs b/OpenRa.Game/Graphics/Renderer.cs index 7657590dbe..c4f0884eaa 100644 --- a/OpenRa.Game/Graphics/Renderer.cs +++ b/OpenRa.Game/Graphics/Renderer.cs @@ -158,7 +158,6 @@ namespace OpenRa.Graphics { using (new PerfSample("text")) { - var size = MeasureText(text); Bitmap b = RenderTextToBitmap(text, fDebug, c); textSheet.Texture.SetData(b); rgbaRenderer.DrawSprite(textSprite, pos.ToFloat2(), "chrome"); @@ -170,7 +169,6 @@ namespace OpenRa.Graphics { using (new PerfSample("text")) { - var size = MeasureText2(text); Bitmap b = RenderTextToBitmap(text, fTitle, c); textSheet.Texture.SetData(b); rgbaRenderer.DrawSprite(textSprite, pos.ToFloat2(), "chrome"); diff --git a/OpenRa.Game/Network/Order.cs b/OpenRa.Game/Network/Order.cs index 76fb2a3adf..f928ed0fcd 100755 --- a/OpenRa.Game/Network/Order.cs +++ b/OpenRa.Game/Network/Order.cs @@ -97,13 +97,6 @@ namespace OpenRa } } - static Player LookupPlayer(World world, uint index) - { - return world.players - .Where(x => x.Value.Index == index) - .First().Value; - } - public static Order Deserialize(World world, BinaryReader r) { switch (r.ReadByte()) diff --git a/OpenRa.Game/Network/OrderManager.cs b/OpenRa.Game/Network/OrderManager.cs index 27bb469d3d..a6cafd22e7 100755 --- a/OpenRa.Game/Network/OrderManager.cs +++ b/OpenRa.Game/Network/OrderManager.cs @@ -28,7 +28,6 @@ namespace OpenRa.Network { class OrderManager { - Stream savingReplay; int frameNumber = 0; public int FramesAhead = 0; @@ -36,7 +35,8 @@ namespace OpenRa.Network public bool GameStarted { get { return frameNumber != 0; } } public IConnection Connection { get; private set; } - Dictionary> frameClientData = new Dictionary>(); + Dictionary> frameClientData = + new Dictionary>(); List readyForFrames = new List(); List localOrders = new List(); @@ -59,7 +59,6 @@ namespace OpenRa.Network public OrderManager( IConnection conn, string replayFilename ) : this( conn ) { - savingReplay = new FileStream( replayFilename, FileMode.Create ); } public void IssueOrders( Order[] orders ) diff --git a/OpenRa.Game/Traits/AI/AutoHeal.cs b/OpenRa.Game/Traits/AI/AutoHeal.cs index 44ab835421..a50595da16 100644 --- a/OpenRa.Game/Traits/AI/AutoHeal.cs +++ b/OpenRa.Game/Traits/AI/AutoHeal.cs @@ -54,7 +54,6 @@ namespace OpenRa.Traits public void Tick(Actor self) { - var attack = self.traits.Get(); var range = Util.GetMaximumRange(self); if (NeedsNewTarget(self)) diff --git a/OpenRa.Game/Traits/Activities/DeliverOre.cs b/OpenRa.Game/Traits/Activities/DeliverOre.cs index fdc2fd06fd..f165535e84 100644 --- a/OpenRa.Game/Traits/Activities/DeliverOre.cs +++ b/OpenRa.Game/Traits/Activities/DeliverOre.cs @@ -38,7 +38,6 @@ namespace OpenRa.Traits.Activities public IActivity Tick( Actor self ) { - var unit = self.traits.Get(); var mobile = self.traits.Get(); if( NextActivity != null ) diff --git a/OpenRa.Game/Traits/Activities/Harvest.cs b/OpenRa.Game/Traits/Activities/Harvest.cs index 5bddc0701b..956380d491 100644 --- a/OpenRa.Game/Traits/Activities/Harvest.cs +++ b/OpenRa.Game/Traits/Activities/Harvest.cs @@ -27,9 +27,6 @@ namespace OpenRa.Traits.Activities public IActivity Tick( Actor self ) { - var unit = self.traits.Get(); - var mobile = self.traits.Get(); - if( isHarvesting ) return this; if( NextActivity != null ) return NextActivity; @@ -49,7 +46,6 @@ namespace OpenRa.Traits.Activities bool HarvestThisTile(Actor self) { - var unit = self.traits.Get(); var harv = self.traits.Get(); var renderUnit = self.traits.Get(); /* better have one of these! */ diff --git a/OpenRa.Game/Traits/Activities/Move.cs b/OpenRa.Game/Traits/Activities/Move.cs index 57a7900733..619efb1a49 100755 --- a/OpenRa.Game/Traits/Activities/Move.cs +++ b/OpenRa.Game/Traits/Activities/Move.cs @@ -201,9 +201,6 @@ namespace OpenRa.Traits.Activities public void TickMove( Actor self, Mobile mobile, Move parent ) { - var oldFraction = moveFraction; - var oldTotal = moveFractionTotal; - moveFraction += (int)Util.GetEffectiveSpeed(self); if( moveFraction >= moveFractionTotal ) moveFraction = moveFractionTotal; diff --git a/OpenRa.Game/Traits/Activities/Repair.cs b/OpenRa.Game/Traits/Activities/Repair.cs index d0bedbc5c3..44f68ccd5f 100644 --- a/OpenRa.Game/Traits/Activities/Repair.cs +++ b/OpenRa.Game/Traits/Activities/Repair.cs @@ -27,10 +27,9 @@ namespace OpenRa.Traits.Activities { public IActivity NextActivity { get; set; } bool isCanceled; - bool playHostAnim; int remainingTicks; - public Repair(bool playHostAnim) { this.playHostAnim = playHostAnim; } + public Repair(bool playHostAnim) {} public IActivity Tick(Actor self) { @@ -57,7 +56,8 @@ namespace OpenRa.Traits.Activities .FirstOrDefault(a => a.traits.Contains()); if (hostBuilding != null) - hostBuilding.traits.Get().PlayCustomAnim(hostBuilding, "active"); + hostBuilding.traits.Get() + .PlayCustomAnim(hostBuilding, "active"); remainingTicks = (int)(Rules.General.RepairRate * 60 * 25); } diff --git a/OpenRa.Game/Traits/CanPowerDown.cs b/OpenRa.Game/Traits/CanPowerDown.cs index 30e44cb778..4a7c9800cf 100644 --- a/OpenRa.Game/Traits/CanPowerDown.cs +++ b/OpenRa.Game/Traits/CanPowerDown.cs @@ -22,20 +22,14 @@ namespace OpenRa.Traits { public class CanPowerDownInfo : ITraitInfo { - public object Create(Actor self) { return new CanPowerDown(self); } + public object Create(Actor self) { return new CanPowerDown(); } } public class CanPowerDown : IDisable, IPowerModifier, IResolveOrder { - readonly Actor self; [Sync] bool IsDisabled = false; - public CanPowerDown(Actor self) - { - this.self = self; - } - public bool Disabled { get { return IsDisabled; } diff --git a/OpenRa.Game/Traits/OreRefinery.cs b/OpenRa.Game/Traits/OreRefinery.cs index f1ecb521bb..4edcddf5e4 100644 --- a/OpenRa.Game/Traits/OreRefinery.cs +++ b/OpenRa.Game/Traits/OreRefinery.cs @@ -36,9 +36,9 @@ namespace OpenRa.Traits self.World.AddFrameEndTask( w => { /* create the free harvester! */ - var harvester = w.CreateActor("harv", self.Location + new int2(1, 2), self.Owner); + var harvester = w.CreateActor("harv", self.Location + + new int2(1, 2), self.Owner); var unit = harvester.traits.Get(); - var mobile = harvester.traits.Get(); unit.Facing = 64; harvester.QueueActivity(new Harvest()); }); diff --git a/OpenRa.Game/Traits/Render/RenderBuildingWarFactory.cs b/OpenRa.Game/Traits/Render/RenderBuildingWarFactory.cs index 4bdd52b6df..0e2a55f4d9 100644 --- a/OpenRa.Game/Traits/Render/RenderBuildingWarFactory.cs +++ b/OpenRa.Game/Traits/Render/RenderBuildingWarFactory.cs @@ -52,8 +52,8 @@ namespace OpenRa.Traits public void Tick(Actor self) { - var b = self.GetBounds(false); - if (isOpen && !self.World.WorldActor.traits.Get().GetUnitsAt(((1/24f) * self.CenterLocation).ToInt2()).Any()) + if (isOpen && !self.World.WorldActor.traits.Get() + .GetUnitsAt(((1/24f) * self.CenterLocation).ToInt2()).Any()) { isOpen = false; roof.PlayBackwardsThen(GetPrefix(self) + "build-top", () => roof.Play(GetPrefix(self) + "idle-top")); diff --git a/OpenRa.Game/Traits/TransformsOnDeploy.cs b/OpenRa.Game/Traits/TransformsOnDeploy.cs index c82c1b552a..738241cb5e 100644 --- a/OpenRa.Game/Traits/TransformsOnDeploy.cs +++ b/OpenRa.Game/Traits/TransformsOnDeploy.cs @@ -71,8 +71,6 @@ namespace OpenRa.Traits // Pick the closed deploy direction to turn to if (self.traits.Contains()) { - var unit = self.traits.Get(); - // TODO: Pick the closest deploy direction var bestDir = info.DeployDirections[0]; diff --git a/OpenRa.Game/Traits/Util.cs b/OpenRa.Game/Traits/Util.cs index 2e1e401780..3cc6ccf30b 100755 --- a/OpenRa.Game/Traits/Util.cs +++ b/OpenRa.Game/Traits/Util.cs @@ -158,7 +158,6 @@ namespace OpenRa.Traits public static float GetMaximumRange(Actor self) { - var info = self.Info.Traits.Get(); return new[] { self.GetPrimaryWeapon(), self.GetSecondaryWeapon() } .Where(w => w != null).Max(w => w.Range); } diff --git a/OpenRa.Game/Traits/World/UnitInfluence.cs b/OpenRa.Game/Traits/World/UnitInfluence.cs index f7c11f42b6..0eaea7fee5 100644 --- a/OpenRa.Game/Traits/World/UnitInfluence.cs +++ b/OpenRa.Game/Traits/World/UnitInfluence.cs @@ -33,7 +33,6 @@ namespace OpenRa.Traits public class UnitInfluence : ITick { List[,] influence = new List[128, 128]; - readonly int2 searchDistance = new int2(2,2); public UnitInfluence( Actor self ) { diff --git a/OpenRa.Gl/GraphicsDevice.cs b/OpenRa.Gl/GraphicsDevice.cs index 8c4ab95029..2e3f8494b3 100644 --- a/OpenRa.Gl/GraphicsDevice.cs +++ b/OpenRa.Gl/GraphicsDevice.cs @@ -40,9 +40,9 @@ namespace OpenRa.GlRenderer internal IntPtr cgContext; internal int vertexProfile, fragmentProfile; - readonly Glfw.GLFWmousebuttonfun mouseButtonCallback; - readonly Glfw.GLFWmouseposfun mousePositionCallback; - readonly Glfw.GLFWwindowclosefun windowCloseCallback; +// readonly Glfw.GLFWmousebuttonfun mouseButtonCallback; +// readonly Glfw.GLFWmouseposfun mousePositionCallback; +// readonly Glfw.GLFWwindowclosefun windowCloseCallback; int mouseX, mouseY; public Size WindowSize { get { return windowSize; } } @@ -57,12 +57,14 @@ namespace OpenRa.GlRenderer public GraphicsDevice( int width, int height, bool fullscreen, bool vsync ) { Glfw.glfwInit(); - Glfw.glfwOpenWindow(width, height, 0, 0, 0, 0, 0, 0, /*fullscreen ? Glfw.GLFW_FULLSCREEN : */Glfw.GLFW_WINDOW); + Glfw.glfwOpenWindow(width, height, 0, 0, 0, 0, 0, 0, + /*fullscreen ? Glfw.GLFW_FULLSCREEN : */Glfw.GLFW_WINDOW); + bool initDone = false; var lastButtonBits = (MouseButtons)0; - Glfw.glfwSetMouseButtonCallback( mouseButtonCallback = ( button, action ) => + Glfw.glfwSetMouseButtonCallback( /*mouseButtonCallback =*/ ( button, action ) => { var b = button == Glfw.GLFW_MOUSE_BUTTON_1 ? MouseButtons.Left : button == Glfw.GLFW_MOUSE_BUTTON_2 ? MouseButtons.Right @@ -77,14 +79,14 @@ namespace OpenRa.GlRenderer if (action != Glfw.GLFW_PRESS && action != Glfw.GLFW_RELEASE) throw new InvalidOperationException(); } ); - Glfw.glfwSetMousePosCallback(mousePositionCallback = (x, y) => + Glfw.glfwSetMousePosCallback(/*mousePositionCallback = */(x, y) => { mouseX = x; mouseY = y; if (initDone) OpenRa.Game.DispatchMouseInput(MouseInputEvent.Move, new MouseEventArgs(lastButtonBits, 0, x, y, 0), 0); }); - Glfw.glfwSetWindowCloseCallback( windowCloseCallback = () => + Glfw.glfwSetWindowCloseCallback(/* windowCloseCallback = */() => { OpenRa.Game.Exit(); Glfw.glfwIconifyWindow(); diff --git a/OpenRa.Mods.Cnc/ProductionAirdrop.cs b/OpenRa.Mods.Cnc/ProductionAirdrop.cs index 2957ef2b20..812ffe23a0 100644 --- a/OpenRa.Mods.Cnc/ProductionAirdrop.cs +++ b/OpenRa.Mods.Cnc/ProductionAirdrop.cs @@ -35,7 +35,6 @@ namespace OpenRa.Mods.Cnc public override bool Produce( Actor self, ActorInfo producee ) { - var location = CreationLocation(self, producee); var owner = self.Owner; // Start beyond the edge of the map, to give a finite delay, and ability to land when AFLD is on map edge diff --git a/OpenRa.Mods.Cnc/TiberiumRefinery.cs b/OpenRa.Mods.Cnc/TiberiumRefinery.cs index 5d7aafaad3..fb9444b151 100644 --- a/OpenRa.Mods.Cnc/TiberiumRefinery.cs +++ b/OpenRa.Mods.Cnc/TiberiumRefinery.cs @@ -39,7 +39,6 @@ namespace OpenRa.Mods.Cnc { /* create the free harvester! */ var harvester = w.CreateActor("harv", self.Location + new int2(0, 2), self.Owner); var unit = harvester.traits.Get(); - var mobile = harvester.traits.Get(); unit.Facing = 64; harvester.QueueActivity(new Harvest()); }); @@ -49,7 +48,6 @@ namespace OpenRa.Mods.Cnc public void OnDock(Actor harv, DeliverOre dockOrder) { // Todo: need to be careful about cancellation and multiple harvs - var unit = harv.traits.Get(); harv.QueueActivity(new Move(self.Location + new int2(1,1), self)); harv.QueueActivity(new Turn(96)); harv.QueueActivity( new CallFunc( () =>