Formatted all files.

Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
This commit is contained in:
RoosterDragon
2015-01-04 22:09:32 +00:00
parent 6468c0b6e6
commit a6cda967c2
153 changed files with 740 additions and 698 deletions

View File

@@ -288,12 +288,12 @@ namespace OpenRA.Mods.Common.Traits
{
switch (order.OrderString)
{
case "Move":
case "Enter":
case "ReturnToBase":
case "Stop":
return "Move";
default: return null;
case "Move":
case "Enter":
case "ReturnToBase":
case "Stop":
return "Move";
default: return null;
}
}
}

View File

@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) { return new Fly(self, Target.FromCell(self.World, cell)); }
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos) { return Util.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), new Fly(self, Target.FromPos(toPos))); }
public Activity MoveToTarget(Actor self, Target target) { return new Fly(self, target, WRange.FromCells(3), WRange.FromCells(5)); }
public Activity MoveToTarget(Actor self, Target target) { return new Fly(self, target, WRange.FromCells(3), WRange.FromCells(5)); }
public Activity MoveIntoTarget(Actor self, Target target) { return new Land(target); }
}
}

View File

@@ -33,8 +33,11 @@ namespace OpenRA.Mods.Common.Traits
public override string[] TargetTypes
{
get { return (self.CenterPosition.Z > 0) ? info.TargetTypes
: info.GroundedTargetTypes; }
get
{
return (self.CenterPosition.Z > 0) ? info.TargetTypes
: info.GroundedTargetTypes;
}
}
}
}

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Has to be defined here and in weapons.yaml.")]
public readonly string Weapon = null;
public readonly string Turret = "primary";
[Desc("Time (in frames) until the weapon can fire again.")]
[Desc("Time (in frames) until the weapon can fire again.")]
public readonly int FireDelay = 0;
[Desc("Muzzle position relative to turret or body. (forward, right, up) triples")]

View File

@@ -113,12 +113,12 @@ namespace OpenRA.Mods.Common.Traits
{
switch (target.Type)
{
case TargetType.Actor:
return new Order("Attack", self, queued) { TargetActor = target.Actor };
case TargetType.FrozenActor:
return new Order("Attack", self, queued) { ExtraData = target.FrozenActor.ID };
case TargetType.Terrain:
return new Order("Attack", self, queued) { TargetLocation = self.World.Map.CellContaining(target.CenterPosition) };
case TargetType.Actor:
return new Order("Attack", self, queued) { TargetActor = target.Actor };
case TargetType.FrozenActor:
return new Order("Attack", self, queued) { ExtraData = target.FrozenActor.ID };
case TargetType.Terrain:
return new Order("Attack", self, queued) { TargetLocation = self.World.Map.CellContaining(target.CenterPosition) };
}
}
@@ -255,13 +255,13 @@ namespace OpenRA.Mods.Common.Traits
{
switch (target.Type)
{
case TargetType.Actor:
case TargetType.FrozenActor:
return CanTargetActor(self, target, modifiers, ref cursor);
case TargetType.Terrain:
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
default:
return false;
case TargetType.Actor:
case TargetType.FrozenActor:
return CanTargetActor(self, target, modifiers, ref cursor);
case TargetType.Terrain:
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
default:
return false;
}
}

View File

@@ -84,10 +84,10 @@ namespace OpenRA.Mods.Common.Traits
readonly AttackCharge attack;
readonly Target target;
public ChargeAttack(AttackCharge attack, Target target)
{
public ChargeAttack(AttackCharge attack, Target target)
{
this.attack = attack;
this.target = target;
this.target = target;
}
public override Activity Tick(Actor self)
@@ -109,10 +109,10 @@ namespace OpenRA.Mods.Common.Traits
readonly AttackCharge attack;
readonly Target target;
public ChargeFire(AttackCharge attack, Target target)
{
public ChargeFire(AttackCharge attack, Target target)
{
this.attack = attack;
this.target = target;
this.target = target;
}
public override Activity Tick(Actor self)

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Disable production when there are more than this many of this actor on the battlefield. Set to 0 to disable.")]
public readonly int BuildLimit = 0;
[Desc("What the unit should start doing. Warning: If this is not a harvester", "it will break if you use FindResources.")]
[Desc("What the unit should start doing. Warning: If this is not a harvester", "it will break if you use FindResources.")]
public readonly string InitialActivity = null;
// TODO: UI fluff; doesn't belong here

View File

@@ -35,12 +35,12 @@ namespace OpenRA.Mods.Common.Traits
public void Killed(Actor self, AttackInfo e)
{
if (!rs.DefaultAnimation.HasSequence("dead")) return;
if (rs.DefaultAnimation.GetSequence("dead").Length > 1)
rs.DefaultAnimation.Play("dead");
else
rs.DefaultAnimation.PlayRepeating("dead");
self.World.AddFrameEndTask(
w => w.Add(
new DelayedAction(info.LingerTime,

View File

@@ -40,10 +40,13 @@ namespace OpenRA.Mods.Common.Traits
// the one we're playing in.
return new DisposableAction(
() => { reservedFor = null; reservedForAircraft = null; },
() => Game.RunAfterTick(
() => { if (Game.IsCurrentWorld(self.World)) throw new InvalidOperationException(
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})"
.F(forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID)); }));
() => Game.RunAfterTick(() =>
{
if (Game.IsCurrentWorld(self.World))
throw new InvalidOperationException(
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})".F(
forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID));
}));
}
public static bool IsReserved(Actor a)

View File

@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits
lastPos = self.Location;
}
}
public bool IsVisible(Actor self, Player viewer)
{
if (!Cloaked || self.Owner.IsAlliedWith(viewer))

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
{
var info = self.Info.Traits.Get<GivesBountyInfo>();
if (e.Attacker == null || e.Attacker.Destroyed) return;
if (e.Attacker == null || e.Attacker.Destroyed) return;
if (!info.Stances.Contains(e.Attacker.Owner.Stances[self.Owner])) return;

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
{
if (available == wasAvailable)
return;
if (available)
foreach (var u in info.Upgrades)
manager.GrantUpgrade(self, u, this);

View File

@@ -12,7 +12,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor can be targeted by the Hunt activity.")]
public class HuntableInfo : TraitInfo<Huntable> { }
public class Huntable { }
[Desc("This actor can be targeted by the Hunt activity.")]
public class HuntableInfo : TraitInfo<Huntable> { }
public class Huntable { }
}

View File

@@ -12,8 +12,8 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Allows automatic targeting of disguised actors.")]
class IgnoresDisguiseInfo : TraitInfo<IgnoresDisguise> { }
[Desc("Allows automatic targeting of disguised actors.")]
class IgnoresDisguiseInfo : TraitInfo<IgnoresDisguise> { }
class IgnoresDisguise { }
class IgnoresDisguise { }
}

View File

@@ -184,7 +184,7 @@ namespace OpenRA.Mods.Common.Traits
// Neutral/enemy units are blockers. Allied units that are moving are not blockers.
if (canIgnoreMovingAllies && self.Owner.Stances[a.Owner] == Stance.Ally && IsMovingInMyDirection(self, a)) continue;
// Non-sharable unit can enter a cell with shareable units only if it can crush all of them.
if (needsCellExclusively)
return false;
@@ -218,7 +218,7 @@ namespace OpenRA.Mods.Common.Traits
// Neutral/enemy units are blockers. Allied units that are moving are not blockers.
if (canIgnoreMovingAllies && self.Owner.Stances[a.Owner] == Stance.Ally && IsMovingInMyDirection(self, a))
return false;
// Non-sharable unit can enter a cell with shareable units only if it can crush all of them.
if (needsCellExclusively)
return true;
@@ -252,7 +252,7 @@ namespace OpenRA.Mods.Common.Traits
const int AverageTicksBeforePathing = 5;
const int SpreadTicksBeforePathing = 5;
internal int TicksBeforePathing = 0;
readonly Actor self;
public readonly MobileInfo Info;
public bool IsMoving { get; set; }

View File

@@ -36,13 +36,13 @@ namespace OpenRA.Mods.Common.Traits
public class MissionObjectivesInfo : ITraitInfo
{
[Desc("Set this to true if multiple cooperative players have a distinct set of " +
"objectives that each of them has to complete to win the game. This is mainly " +
"useful for multiplayer coop missions. Do not use this for skirmish team games.")]
"objectives that each of them has to complete to win the game. This is mainly " +
"useful for multiplayer coop missions. Do not use this for skirmish team games.")]
public readonly bool Cooperative = false;
[Desc("If set to true, this setting causes the game to end immediately once the first " +
"player (or team of cooperative players) fails or completes his objectives. If " +
"set to false, players that fail their objectives will stick around and become observers.")]
"player (or team of cooperative players) fails or completes his objectives. If " +
"set to false, players that fail their objectives will stick around and become observers.")]
public readonly bool EarlyGameOver = false;
[Desc("Delay between the game over condition being met, and the game actually ending, in milliseconds.")]
@@ -245,8 +245,8 @@ namespace OpenRA.Mods.Common.Traits
}
[Desc("Provides game mode progress information for players.",
"Goes on WorldActor - observers don't have a player it can live on.",
"Current options for PanelName are 'SKIRMISH_STATS' and 'MISSION_OBJECTIVES'.")]
"Goes on WorldActor - observers don't have a player it can live on.",
"Current options for PanelName are 'SKIRMISH_STATS' and 'MISSION_OBJECTIVES'.")]
public class ObjectivesPanelInfo : ITraitInfo
{
public string PanelName = null;

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
public double MapControl;
public int OrderCount;
public int EarnedThisMinute
public int EarnedThisMinute
{
get
{

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
{
this.info = info;
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
Update(init.Self.Owner, race);
}

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
PlayerPower = self.Owner.PlayerActor.Trait<PowerManager>();
powerModifiers = Exts.Lazy(() => self.TraitsImplementing<IPowerModifier>().ToArray());
}
protected override void UpgradeEnabled(Actor self) { PlayerPower.UpdateActor(self); }
protected override void UpgradeDisabled(Actor self) { PlayerPower.UpdateActor(self); }
public void AddedToWorld(Actor self) { PlayerPower.UpdateActor(self); }

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
{
var t = init.Actor.Traits.WithInterface<TurretedInfo>()
.FirstOrDefault();
// Show the correct turret facing
var anim = new Animation(init.World, image, () => t.InitialFacing);
anim.PlayRepeating("idle");

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Custom palette name")]
public readonly string Palette = "effect";
public object Create(ActorInitializer init) { return new WithBuildingExplosion(this); }
}

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info;
renderSimple = self.Trait<RenderSimple>();
}
public void BuildingPlaced(Actor self)
{
renderSimple.PlayCustomAnim(self, info.Sequence);

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
var building = self.Trait<Building>();
if (!building.SkipMakeAnimation)
{
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
{
building.NotifyBuildingComplete(self);
});

View File

@@ -38,9 +38,10 @@ namespace OpenRA.Mods.Common.Traits
anim = new Animation(self.World, rs.GetImage(self));
anim.PlayFetchIndex(info.Sequence,
() => playerResources.ResourceCapacity != 0
? ((10 * anim.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity)
: 0);
() =>
playerResources.ResourceCapacity != 0 ?
((10 * anim.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity) :
0);
rs.Add("resources_{0}".F(info.Sequence), new AnimationWithOffset(
anim, null, () => !buildComplete, 1024));

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
if (health.HP >= Info.HealIfBelow * health.MaxHP)
return;
if (damageTicks > 0)
{
--damageTicks;

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
public void AppliedDamage(Actor self, Actor damaged, AttackInfo e)
{
// Don't notify suicides
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
{
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Death notification voice.")]
public readonly string DeathSound = "Die";
[Desc("Multiply volume with this factor.")]
public readonly float VolumeMultiplier = 1f;

View File

@@ -99,8 +99,8 @@ namespace OpenRA.Mods.Common.Traits
// Select only the tiles that are within range from the requested SubCell
// This assumes that the SubCell does not change during the path traversal
var tilesInRange = world.Map.FindTilesInCircle(targetCell, range.Range / 1024 + 1)
.Where(t => (world.Map.CenterOfCell(t) - target).LengthSquared <= rangeSquared
&& mi.CanEnterCell(self.World, self, t));
.Where(t => (world.Map.CenterOfCell(t) - target).LengthSquared <= rangeSquared &&
mi.CanEnterCell(self.World, self, t));
// See if there is any cell within range that does not involve a cross-domain request
// Really, we only need to check the circle perimeter, but it's not clear that would be a performance win

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string FogPalette = "fog";
[Desc("Bitfield of shroud directions for each frame. Lower four bits are",
"corners clockwise from TL; upper four are edges clockwise from top")]
"corners clockwise from TL; upper four are edges clockwise from top")]
public readonly int[] Index = new[] { 12, 9, 8, 3, 1, 6, 4, 2, 13, 11, 7, 14 };
[Desc("Use the upper four bits when calculating frame")]

View File

@@ -1,12 +1,12 @@
#region Copyright & License Information
/*
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
#endregion
using System;
using System.Collections.Generic;