add RALint checking to nearly everything

This commit is contained in:
Chris Forbes
2010-07-01 18:57:10 +12:00
parent 8974fb7ae8
commit 5bec019d55
30 changed files with 56 additions and 44 deletions

View File

@@ -64,8 +64,8 @@ namespace OpenRA.Traits
}
self.CancelActivity();
// Pick the closed deploy direction to turn to
if (self.traits.Contains<Unit>())
if (self.traits.Contains<Unit>()) // Pick the closest deploy direction to turn to
{
// TODO: Pick the closest deploy direction
var bestDir = info.DeployDirections[0];

View File

@@ -19,10 +19,10 @@
#endregion
using System;
using System.Linq;
using System.Drawing;
using OpenRA.Graphics;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
namespace OpenRA.Traits
{

View File

@@ -26,6 +26,7 @@ namespace OpenRA.Mods.Cnc
{
class PoisonedByTiberiumInfo : ITraitInfo
{
[WeaponReference]
public readonly string Weapon = "Tiberium";
public readonly string[] Resources = { "Tiberium" };

View File

@@ -28,7 +28,9 @@ namespace OpenRA.Mods.RA
public class AircraftInfo : ITraitInfo
{
public readonly int CruiseAltitude = 20;
[ActorReference]
public readonly string[] RepairBuildings = { "fix" };
[ActorReference]
public readonly string[] RearmBuildings = { "hpad", "afld" };
public virtual object Create( ActorInitializer init ) { return new Aircraft( init ); }

View File

@@ -27,7 +27,9 @@ namespace OpenRA.Mods.RA
{
class AirstrikePowerInfo : SupportPowerInfo
{
[ActorReference]
public readonly string UnitType = "badr.bomber";
[ActorReference]
public readonly string FlareType = null;
public override object Create(ActorInitializer init) { return new AirstrikePower(init.self, this); }

View File

@@ -21,9 +21,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System;
using OpenRA.FileFormats;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Traits;

View File

@@ -20,14 +20,15 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class BridgeLayerInfo : ITraitInfo
{
[ActorReference]
public readonly string[] Bridges = {"bridge1", "bridge2"};
public object Create(ActorInitializer init) { return new BridgeLayer(init.self, this); }
}

View File

@@ -25,6 +25,7 @@ namespace OpenRA.Mods.RA
{
class CarpetBombInfo : TraitInfo<CarpetBomb>
{
[WeaponReference]
public readonly string Weapon = null;
public readonly int Range = 0;
}

View File

@@ -21,7 +21,6 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.GameRules;
using OpenRA.Traits;
/*

View File

@@ -9,7 +9,9 @@ namespace OpenRA.Mods.RA
{
class ExplodeCrateActionInfo : CrateActionInfo
{
[WeaponReference]
public string Weapon = null;
public override object Create(ActorInitializer init) { return new ExplodeCrateAction(init.self, this); }
}

View File

@@ -29,6 +29,8 @@ namespace OpenRA.Mods.RA
{
public readonly float ValueFraction = .4f;
public readonly float MinHpFraction = .3f;
[ActorReference]
public readonly string[] ActorTypes = { "e1" };
}

View File

@@ -24,7 +24,9 @@ namespace OpenRA.Mods.RA
{
class ExplodesInfo : TraitInfo<Explodes>
{
[WeaponReference]
public readonly string Weapon = "UnitExplode";
[WeaponReference]
public readonly string EmptyWeapon = "UnitExplode";
}

View File

@@ -31,8 +31,8 @@ namespace OpenRA.Mods.RA
if (e.DamageState == DamageState.Dead)
{
// Prevent TK from giving exp
//if (e.Attacker == null || e.Attacker.Owner.Stances[ self.Owner ] == Stance.Ally )
// return;
if (e.Attacker == null || e.Attacker.Owner.Stances[ self.Owner ] == Stance.Ally )
return;
var info = self.Info.Traits.Get<GivesExperienceInfo>();
var valued = self.Info.Traits.GetOrDefault<ValuedInfo>();

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA
public readonly int PipCount = 7;
public readonly PipType PipColor = PipType.Yellow;
public readonly string[] Resources = { };
[WeaponReference]
public readonly string DeathWeapon = null;
public object Create(ActorInitializer init) { return new Harvester(init.self, this); }

View File

@@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA
{
public class FreeActorInfo : ITraitInfo
{
[ActorReference]
public readonly string Actor = null;
public readonly string InitialActivity = null;
public readonly int2 SpawnOffset = int2.Zero;

View File

@@ -22,7 +22,11 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class LeavesHuskInfo : TraitInfo<LeavesHusk> { public readonly string HuskActor = null; }
class LeavesHuskInfo : TraitInfo<LeavesHusk>
{
[ActorReference]
public readonly string HuskActor = null;
}
class LeavesHusk : INotifyDamage
{

View File

@@ -29,6 +29,7 @@ namespace OpenRA.Mods.RA
class MineInfo : ITraitInfo
{
public readonly string[] CrushClasses = { };
[WeaponReference]
public readonly string Weapon = "ATMine";
public readonly bool AvoidFriendly = true;

View File

@@ -29,8 +29,10 @@ namespace OpenRA.Mods.RA
{
class MinelayerInfo : TraitInfo<Minelayer>
{
[ActorReference]
public readonly string Mine = "minv";
public readonly float MinefieldDepth = 1.5f;
[ActorReference]
public readonly string[] RearmBuildings = { "fix" };
}

View File

@@ -67,6 +67,7 @@ namespace OpenRA.Mods.RA
// tag trait for the building
class NukeSiloInfo : ITraitInfo
{
[WeaponReference]
public readonly string MissileWeapon = "";
public object Create(ActorInitializer init) { return new NukeSilo(init.self); }
}

View File

@@ -36,6 +36,7 @@ namespace OpenRA.Mods.RA
public readonly int Capacity = 0;
public readonly int ProcessTick = 25;
public readonly int ProcessAmount = 50;
[WeaponReference]
public readonly string DeathWeapon = null;
public object Create(ActorInitializer init) { return new OreRefinery(init.self, this); }

View File

@@ -18,9 +18,6 @@
*/
#endregion
using System;
using System.Linq;
using System.Collections.Generic;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
using OpenRA.Traits.Activities;

View File

@@ -27,8 +27,11 @@ namespace OpenRA.Mods.RA
{
class ParatroopersPowerInfo : SupportPowerInfo
{
[ActorReference]
public string[] DropItems = { };
[ActorReference]
public string UnitType = "badr";
[ActorReference]
public string FlareType = "flare";
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.self, this); }

View File

@@ -20,10 +20,8 @@
using System;
using System.Linq;
using OpenRA.Traits.Activities;
using OpenRA.GameRules;
using OpenRA.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{

View File

@@ -18,12 +18,9 @@
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
using OpenRA.Mods.RA.Activities;
namespace OpenRA.Mods.RA
{

View File

@@ -27,6 +27,7 @@ namespace OpenRA.Mods.RA
{
class RepairableNearInfo : TraitInfo<RepairableNear>
{
[ActorReference]
public readonly string[] Buildings = { "spen", "syrd" };
}

View File

@@ -18,14 +18,15 @@
*/
#endregion
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class ReplaceWithActorInfo : ITraitInfo
{
[ActorReference]
public readonly string Actor = null;
public object Create(ActorInitializer init) { return new ReplaceWithActor(init.self, this); }
}

View File

@@ -18,11 +18,8 @@
*/
#endregion
using System;
using OpenRA.Traits.Activities;
using System.Drawing;
using OpenRA.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{

View File

@@ -19,8 +19,8 @@
#endregion
using System;
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA

View File

@@ -18,11 +18,10 @@
*/
#endregion
using System.Collections.Generic;
using OpenRA.Mods.RA.Activities;
using OpenRA.Orders;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
using OpenRA.Orders;
using OpenRA.Mods.RA.Activities;
namespace OpenRA.Mods.RA
{

View File

@@ -19,8 +19,6 @@
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Traits;
namespace OpenRA.Mods.RA