cleaned up compiler warnings
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace OpenRa.FileFormats
|
||||
|
||||
public class Package : IFolder
|
||||
{
|
||||
readonly string filename;
|
||||
readonly Dictionary<uint, PackageEntry> 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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<string> visibleTabs = new List<string>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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<int, Dictionary<int, byte[]>> frameClientData = new Dictionary<int, Dictionary<int, byte[]>>();
|
||||
Dictionary<int, Dictionary<int, byte[]>> frameClientData =
|
||||
new Dictionary<int, Dictionary<int, byte[]>>();
|
||||
List<int> readyForFrames = new List<int>();
|
||||
List<Order> localOrders = new List<Order>();
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -54,7 +54,6 @@ namespace OpenRa.Traits
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
var attack = self.traits.Get<AttackBase>();
|
||||
var range = Util.GetMaximumRange(self);
|
||||
|
||||
if (NeedsNewTarget(self))
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace OpenRa.Traits.Activities
|
||||
|
||||
public IActivity Tick( Actor self )
|
||||
{
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
|
||||
if( NextActivity != null )
|
||||
|
||||
@@ -27,9 +27,6 @@ namespace OpenRa.Traits.Activities
|
||||
|
||||
public IActivity Tick( Actor self )
|
||||
{
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
|
||||
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<Unit>();
|
||||
var harv = self.traits.Get<Harvester>();
|
||||
var renderUnit = self.traits.Get<RenderUnit>(); /* better have one of these! */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<RenderBuilding>());
|
||||
|
||||
if (hostBuilding != null)
|
||||
hostBuilding.traits.Get<RenderBuilding>().PlayCustomAnim(hostBuilding, "active");
|
||||
hostBuilding.traits.Get<RenderBuilding>()
|
||||
.PlayCustomAnim(hostBuilding, "active");
|
||||
|
||||
remainingTicks = (int)(Rules.General.RepairRate * 60 * 25);
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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<Unit>();
|
||||
var mobile = harvester.traits.Get<Mobile>();
|
||||
unit.Facing = 64;
|
||||
harvester.QueueActivity(new Harvest());
|
||||
});
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace OpenRa.Traits
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
var b = self.GetBounds(false);
|
||||
if (isOpen && !self.World.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(((1/24f) * self.CenterLocation).ToInt2()).Any())
|
||||
if (isOpen && !self.World.WorldActor.traits.Get<UnitInfluence>()
|
||||
.GetUnitsAt(((1/24f) * self.CenterLocation).ToInt2()).Any())
|
||||
{
|
||||
isOpen = false;
|
||||
roof.PlayBackwardsThen(GetPrefix(self) + "build-top", () => roof.Play(GetPrefix(self) + "idle-top"));
|
||||
|
||||
@@ -71,8 +71,6 @@ namespace OpenRa.Traits
|
||||
// Pick the closed deploy direction to turn to
|
||||
if (self.traits.Contains<Unit>())
|
||||
{
|
||||
var unit = self.traits.Get<Unit>();
|
||||
|
||||
// TODO: Pick the closest deploy direction
|
||||
var bestDir = info.DeployDirections[0];
|
||||
|
||||
|
||||
@@ -158,7 +158,6 @@ namespace OpenRa.Traits
|
||||
|
||||
public static float GetMaximumRange(Actor self)
|
||||
{
|
||||
var info = self.Info.Traits.Get<AttackBaseInfo>();
|
||||
return new[] { self.GetPrimaryWeapon(), self.GetSecondaryWeapon() }
|
||||
.Where(w => w != null).Max(w => w.Range);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace OpenRa.Traits
|
||||
public class UnitInfluence : ITick
|
||||
{
|
||||
List<Actor>[,] influence = new List<Actor>[128, 128];
|
||||
readonly int2 searchDistance = new int2(2,2);
|
||||
|
||||
public UnitInfluence( Actor self )
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<Unit>();
|
||||
var mobile = harvester.traits.Get<Mobile>();
|
||||
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<Unit>();
|
||||
harv.QueueActivity(new Move(self.Location + new int2(1,1), self));
|
||||
harv.QueueActivity(new Turn(96));
|
||||
harv.QueueActivity( new CallFunc( () =>
|
||||
|
||||
Reference in New Issue
Block a user