cleaned up compiler warnings

This commit is contained in:
Chris Forbes
2010-02-18 20:32:34 +13:00
parent c4329aec29
commit 3237485055
26 changed files with 31 additions and 83 deletions

View File

@@ -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>();

View File

@@ -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;

View File

@@ -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);

View File

@@ -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");

View File

@@ -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())

View File

@@ -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 )

View File

@@ -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))

View File

@@ -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 )

View File

@@ -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! */

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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; }

View File

@@ -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());
});

View File

@@ -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"));

View File

@@ -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];

View File

@@ -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);
}

View File

@@ -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 )
{