fix newlines in source files

This commit is contained in:
Chris Forbes
2011-09-17 11:26:17 +12:00
parent 9480846250
commit 776a1aa817
7 changed files with 106 additions and 106 deletions

View File

@@ -1,43 +1,43 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace OpenRA.Traits.Activities namespace OpenRA.Traits.Activities
{ {
public abstract class Activity public abstract class Activity
{ {
public Activity NextActivity { get; set; } public Activity NextActivity { get; set; }
protected bool IsCanceled { get; private set; } protected bool IsCanceled { get; private set; }
public abstract Activity Tick( Actor self ); public abstract Activity Tick( Actor self );
public virtual void Cancel( Actor self ) public virtual void Cancel( Actor self )
{ {
IsCanceled = true; IsCanceled = true;
NextActivity = null; NextActivity = null;
} }
public virtual void Queue( Activity activity ) public virtual void Queue( Activity activity )
{ {
if( NextActivity != null ) if( NextActivity != null )
NextActivity.Queue( activity ); NextActivity.Queue( activity );
else else
NextActivity = activity; NextActivity = activity;
} }
public virtual IEnumerable<Target> GetTargets( Actor self ) public virtual IEnumerable<Target> GetTargets( Actor self )
{ {
yield break; yield break;
} }
} }
public static class ActivityExts public static class ActivityExts
{ {
public static IEnumerable<Target> GetTargetQueue( this Actor self ) public static IEnumerable<Target> GetTargetQueue( this Actor self )
{ {
return self.GetCurrentActivity().Iterate( u => u.NextActivity ).TakeWhile( u => u != null ) return self.GetCurrentActivity().Iterate( u => u.NextActivity ).TakeWhile( u => u != null )
.SelectMany( u => u.GetTargets( self ) ); .SelectMany( u => u.GetTargets( self ) );
} }
} }
} }

View File

@@ -78,12 +78,12 @@ namespace OpenRA.Traits
/* apply the damage modifiers, if we have any. */ /* apply the damage modifiers, if we have any. */
var modifier = (float)self.TraitsImplementing<IDamageModifier>() var modifier = (float)self.TraitsImplementing<IDamageModifier>()
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>()) .Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
.Select(t => t.GetDamageModifier(attacker, warhead)).Product(); .Select(t => t.GetDamageModifier(attacker, warhead)).Product();
if (!ignoreModifiers) if (!ignoreModifiers)
damage = damage > 0 ? (int)(damage * modifier) : damage; damage = damage > 0 ? (int)(damage * modifier) : damage;
hp = Exts.Clamp(hp - damage, 0, MaxHP); hp = Exts.Clamp(hp - damage, 0, MaxHP);
var ai = new AttackInfo var ai = new AttackInfo
{ {

View File

@@ -6,14 +6,14 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Network; using OpenRA.Network;
namespace OpenRA.Traits namespace OpenRA.Traits
@@ -83,7 +83,7 @@ namespace OpenRA.Traits
} }
public interface IVisibilityModifier { bool IsVisible(Actor self); } public interface IVisibilityModifier { bool IsVisible(Actor self); }
public interface IRadarColorModifier { Color RadarColorOverride(Actor self); } public interface IRadarColorModifier { Color RadarColorOverride(Actor self); }
public interface IHasLocation { int2 PxPosition { get; } } public interface IHasLocation { int2 PxPosition { get; } }
public interface IOccupySpace : IHasLocation public interface IOccupySpace : IHasLocation
@@ -128,8 +128,8 @@ namespace OpenRA.Traits
void SetPosition(Actor self, int2 cell); void SetPosition(Actor self, int2 cell);
void SetPxPosition(Actor self, int2 px); void SetPxPosition(Actor self, int2 px);
void AdjustPxPosition(Actor self, int2 px); /* works like SetPxPosition, but visual only */ void AdjustPxPosition(Actor self, int2 px); /* works like SetPxPosition, but visual only */
} }
public interface IMove : ITeleportable { int Altitude { get; set; } } public interface IMove : ITeleportable { int Altitude { get; set; } }
public interface IFacing public interface IFacing

View File

@@ -17,16 +17,16 @@ namespace OpenRA.Mods.RA.Activities
{ {
public class Rearm : Activity public class Rearm : Activity
{ {
readonly LimitedAmmo limitedAmmo; readonly LimitedAmmo limitedAmmo;
int ticksPerPip = 25 * 2; int ticksPerPip = 25 * 2;
int remainingTicks = 25 * 2; int remainingTicks = 25 * 2;
public Rearm(Actor self) public Rearm(Actor self)
{ {
limitedAmmo = self.TraitOrDefault<LimitedAmmo>(); limitedAmmo = self.TraitOrDefault<LimitedAmmo>();
if (limitedAmmo != null) if (limitedAmmo != null)
ticksPerPip = limitedAmmo.ReloadTimePerAmmo(); ticksPerPip = limitedAmmo.ReloadTimePerAmmo();
remainingTicks = ticksPerPip; remainingTicks = ticksPerPip;
} }
public override Activity Tick(Actor self) public override Activity Tick(Actor self)

View File

@@ -1,38 +1,38 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Traits.Activities; using OpenRA.Traits.Activities;
namespace OpenRA.Mods.RA.Air namespace OpenRA.Mods.RA.Air
{ {
public class FlyCircle : Activity public class FlyCircle : Activity
{ {
public override Activity Tick(Actor self) public override Activity Tick(Actor self)
{ {
var cruiseAltitude = self.Info.Traits.Get<PlaneInfo>().CruiseAltitude; var cruiseAltitude = self.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
if (IsCanceled) return NextActivity; if (IsCanceled) return NextActivity;
var aircraft = self.Trait<Aircraft>(); var aircraft = self.Trait<Aircraft>();
var desiredFacing = aircraft.Facing + 64; // we can't possibly turn this fast. var desiredFacing = aircraft.Facing + 64; // we can't possibly turn this fast.
if (aircraft.Altitude == cruiseAltitude) if (aircraft.Altitude == cruiseAltitude)
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT); aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
if (aircraft.Altitude < cruiseAltitude) if (aircraft.Altitude < cruiseAltitude)
++aircraft.Altitude; ++aircraft.Altitude;
FlyUtil.Fly(self, cruiseAltitude); FlyUtil.Fly(self, cruiseAltitude);
return this; return this;
} }
} }
} }

View File

@@ -6,11 +6,11 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Air namespace OpenRA.Mods.RA.Air
@@ -71,8 +71,8 @@ namespace OpenRA.Mods.RA.Air
self.CancelActivity(); self.CancelActivity();
self.QueueActivity(new HeliFly(order.TargetActor.Trait<IHasLocation>().PxPosition + offset)); self.QueueActivity(new HeliFly(order.TargetActor.Trait<IHasLocation>().PxPosition + offset));
self.QueueActivity(new Turn(Info.InitialFacing)); self.QueueActivity(new Turn(Info.InitialFacing));
self.QueueActivity(new HeliLand(false)); self.QueueActivity(new HeliLand(false));
QueueResupplyActivities(order.TargetActor); QueueResupplyActivities(order.TargetActor);
} }

View File

@@ -23,8 +23,8 @@ namespace OpenRA.Mods.RA
} }
public class LimitedAmmo : INotifyAttack, IPips, ISync public class LimitedAmmo : INotifyAttack, IPips, ISync
{ {
[Sync] [Sync]
int ammo; int ammo;
LimitedAmmoInfo Info; LimitedAmmoInfo Info;