fix trailing whitespace everywhere

This commit is contained in:
Chris Forbes
2011-09-25 14:37:12 +13:00
parent 0eb98ef3b5
commit 55036cd58c
596 changed files with 3194 additions and 3194 deletions

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -26,42 +26,42 @@ namespace OpenRA.Mods.RA.Buildings
}
class BibLayer: IRenderOverlay, IWorldLoaded
{
{
World world;
BibLayerInfo info;
Dictionary<int2, TileReference<byte, byte>> tiles;
Sprite[][] bibSprites;
public BibLayer(Actor self, BibLayerInfo info)
{
this.info = info;
bibSprites = info.BibTypes.Select(x => Game.modData.SpriteLoader.LoadAllSprites(x)).ToArray();
self.World.ActorAdded +=
a => { if (a.HasTrait<Bib>()) DoBib(a,true); };
self.World.ActorRemoved +=
a => { if (a.HasTrait<Bib>()) DoBib(a,false); };
}
public void WorldLoaded(World w)
{
world = w;
tiles = new Dictionary<int2, TileReference<byte, byte>>();
}
public void DoBib(Actor b, bool isAdd)
{
var buildingInfo = b.Info.Traits.Get<BuildingInfo>();
var buildingInfo = b.Info.Traits.Get<BuildingInfo>();
var size = buildingInfo.Dimensions.X;
var bibOffset = buildingInfo.Dimensions.Y - 1;
int bib = Array.IndexOf(info.BibWidths,size);
if (bib < 0)
{
Log.Write("debug", "Cannot bib {0}-wide building {1}", size, b.Info.Name);
return;
}
for (int i = 0; i < 2 * size; i++)
{
var p = b.Location + new int2(i % size, i / size + bibOffset);
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.RA.Buildings
}
}
}
public class BibInfo : TraitInfo<Bib> { }
public class Bib { }
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Buildings
public readonly int Adjacent = 2;
public readonly string Footprint = "x";
public readonly int2 Dimensions = new int2(1, 1);
public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"};
public readonly string[] SellSounds = {"cashturn.aud"};
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Buildings
var nearnessCandidates = new List<int2>();
var bi = world.WorldActor.Trait<BuildingInfluence>();
for( int y = scanStart.Y ; y < scanEnd.Y ; y++ )
for( int x = scanStart.X ; x < scanEnd.X ; x++ )
{
@@ -76,26 +76,26 @@ namespace OpenRA.Mods.RA.Buildings
public int2 TopLeft { get { return topLeft; } }
public int2 PxPosition { get { return pxPosition; } }
public IEnumerable<string> ProvidesPrerequisites { get { yield return self.Info.Name; } }
public Building(ActorInitializer init, BuildingInfo info)
{
this.self = init.self;
this.topLeft = init.Get<LocationInit,int2>();
this.Info = info;
this.PlayerPower = init.self.Owner.PlayerActor.Trait<PowerManager>();
occupiedCells = FootprintUtils.UnpathableTiles( self.Info.Name, Info, TopLeft )
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
pxPosition = ( 2 * topLeft + Info.Dimensions ) * Game.CellSize / 2;
}
public int GetPowerUsage()
{
if (Info.Power <= 0)
return Info.Power;
var health = self.TraitOrDefault<Health>();
return health != null ? (Info.Power * health.HP / health.MaxHP) : Info.Power;
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -24,14 +24,14 @@ namespace OpenRA.Mods.RA.Buildings
bool disabled = false;
int normalPower = 0;
PowerManager PowerManager;
public CanPowerDown(ActorInitializer init)
{
PowerManager = init.self.Owner.PlayerActor.Trait<PowerManager>();
normalPower = init.self.Info.Traits.Get<BuildingInfo>().Power;
}
public bool Disabled { get { return disabled; } }
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "PowerDown")
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA.Buildings
disabled = !disabled;
var eva = self.World.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
Sound.PlayToPlayer(self.Owner, disabled ? eva.EnablePower : eva.DisablePower);
PowerManager.UpdateActor(self, disabled ? 0 : normalPower);
if (disabled)
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Buildings
w => w.Add(new PowerdownIndicator(self)));
}
}
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
{
PowerManager = newOwner.PlayerActor.Trait<PowerManager>();

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -26,12 +26,12 @@ namespace OpenRA.Mods.RA.Buildings
{
public static int GetSellValue( this Actor a )
{
var csv = a.Info.Traits.GetOrDefault<CustomSellValueInfo>();
var csv = a.Info.Traits.GetOrDefault<CustomSellValueInfo>();
if (csv != null) return csv.Value;
var valued = a.Info.Traits.GetOrDefault<ValuedInfo>();
if (valued != null) return valued.Cost;
return 0;
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Buildings
var dim = buildingInfo.Dimensions;
var footprint = buildingInfo.Footprint.Where(x => !char.IsWhiteSpace(x));
if (Rules.Info[ name ].Traits.Contains<BibInfo>())
{
dim.Y += 1;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Buildings
PowerManagerInfo Info;
Player Player;
DeveloperMode devMode;
Dictionary<Actor, int> PowerDrain = new Dictionary<Actor, int>();
[Sync] int totalProvided;
public int PowerProvided { get { return totalProvided; } }
@@ -38,14 +38,14 @@ namespace OpenRA.Mods.RA.Buildings
{
Info = info;
Player = init.self.Owner;
init.world.ActorAdded += ActorAdded;
init.world.ActorRemoved += ActorRemoved;
devMode = init.self.Trait<DeveloperMode>();
wasHackEnabled = devMode.UnlimitedPower;
}
void ActorAdded(Actor a)
{
if (a.Owner != Player || !a.HasTrait<Building>())
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Buildings
PowerDrain.Add(a, a.Trait<Building>().GetPowerUsage());
UpdateTotals();
}
void ActorRemoved(Actor a)
{
if (a.Owner != Player || !a.HasTrait<Building>())
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.RA.Buildings
PowerDrain.Remove(a);
UpdateTotals();
}
void UpdateTotals()
{
totalProvided = 0;
@@ -78,16 +78,16 @@ namespace OpenRA.Mods.RA.Buildings
if (devMode.UnlimitedPower)
totalProvided = 1000000;
}
public void UpdateActor(Actor a, int newPower)
{
if (a.Owner != Player || !a.HasTrait<Building>())
return;
PowerDrain[a] = newPower;
UpdateTotals();
}
int nextPowerAdviceTime = 0;
bool wasLowPower = false;
bool wasHackEnabled;
@@ -104,16 +104,16 @@ namespace OpenRA.Mods.RA.Buildings
if (lowPower && !wasLowPower)
nextPowerAdviceTime = 0;
wasLowPower = lowPower;
if (--nextPowerAdviceTime <= 0)
{
if (lowPower)
Player.GiveAdvice(Rules.Info["world"].Traits.Get<EvaAlertsInfo>().LowPower);
nextPowerAdviceTime = Info.AdviceInterval;
}
}
public PowerState PowerState
{
get {

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Buildings
{
get { return power.PowerProvided < power.PowerDrained; }
}
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
{
power = newOwner.PlayerActor.Trait<PowerManager>();

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Buildings
{
this.Info = info;
}
public void Killed(Actor self, AttackInfo e)
{
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(Info.Intensity, self.CenterLocation, 1);

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Render
{
public readonly string DamagedSound;
public readonly string DestroyedSound;
public object Create(ActorInitializer init) { return new SoundOnDamageTransition(this);}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -30,20 +30,20 @@ namespace OpenRA.Mods.RA.Buildings
init.world.ActorAdded += ActorChanged;
init.world.ActorRemoved += ActorChanged;
}
public void ActorChanged(Actor a)
{
if (a.Owner == player && a.HasTrait<ITechTreePrerequisite>())
Update();
}
public void Update()
{
var buildings = GatherBuildings(player);
foreach(var w in watchers)
w.Update(buildings);
}
public void Add(string key, List<string> prerequisites, ITechTreeElement tte)
{
watchers.Add(new Watcher( key, prerequisites, tte ));
@@ -53,22 +53,22 @@ namespace OpenRA.Mods.RA.Buildings
{
watchers.RemoveAll(x => x.key == key);
}
static Cache<string, List<Actor>> GatherBuildings( Player player )
{
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
if (player == null)
return ret;
foreach (var b in player.World.ActorsWithTrait<ITechTreePrerequisite>()
.Where(a => a.Actor.IsInWorld && !a.Actor.IsDead() && a.Actor.Owner == player))
foreach (var p in b.Trait.ProvidesPrerequisites)
ret[ p ].Add( b.Actor );
return ret;
}
class Watcher
{
public readonly string key;
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.RA.Buildings
public readonly List<string> prerequisites;
public readonly ITechTreeElement watcher;
bool hasPrerequisites;
public Watcher(string key, List<string> prerequisites, ITechTreeElement watcher)
{
this.key = key;
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.RA.Buildings
}
public void Update(Cache<string, List<Actor>> buildings)
{
{
var nowHasPrerequisites = true;
foreach (var p in prerequisites)
if (!buildings.Keys.Contains(p))
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA.Buildings
nowHasPrerequisites = false;
break;
}
if( nowHasPrerequisites && !hasPrerequisites )
watcher.PrerequisitesAvailable(key);
@@ -111,12 +111,12 @@ namespace OpenRA.Mods.RA.Buildings
void PrerequisitesAvailable(string key);
void PrerequisitesUnavailable(string key);
}
public interface ITechTreePrerequisite
{
IEnumerable<string> ProvidesPrerequisites {get;}
}
public class ProvidesCustomPrerequisiteInfo : ITraitInfo
{
public string Prerequisite;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -20,12 +20,12 @@ namespace OpenRA.Mods.RA.Buildings
{
return world.IsCellBuildable(a, bi, null);
}
public static bool IsCellBuildable(this World world, int2 a, BuildingInfo bi, Actor toIgnore)
{
if (world.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(a) != null) return false;
if (world.ActorMap.GetUnitsAt(a).Any(b => b != toIgnore)) return false;
return world.Map.IsInMap(a) && bi.TerrainTypes.Contains(world.GetTerrainType(a));
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Buildings
{
readonly Actor self;
readonly WallInfo info;
public Wall(Actor self, WallInfo info)
{
this.self = self;