fix trailing whitespace everywhere
This commit is contained in:
@@ -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,13 +26,13 @@ namespace OpenRA.Mods.RA.Move
|
||||
endLocation = end;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
|
||||
int ticks = 0;
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
var mobile = self.Trait<Mobile>();
|
||||
mobile.PxPosition = int2.Lerp(startLocation, endLocation, ticks, length - 1);
|
||||
|
||||
|
||||
if (++ticks >= length)
|
||||
{
|
||||
mobile.IsMoving = false;
|
||||
|
||||
@@ -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.
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
return TerrainSpeeds[type].Cost;
|
||||
}
|
||||
|
||||
|
||||
public readonly Dictionary<SubCell, int2> SubCellOffsets = new Dictionary<SubCell, int2>()
|
||||
{
|
||||
{SubCell.TopLeft, new int2(-7,-6)},
|
||||
@@ -76,15 +76,15 @@ namespace OpenRA.Mods.RA.Move
|
||||
{SubCell.BottomRight, new int2(6,6)},
|
||||
{SubCell.FullCell, new int2(0,0)},
|
||||
};
|
||||
|
||||
|
||||
public bool CanEnterCell(World world, Player owner, int2 cell, Actor ignoreActor, bool checkTransientActors)
|
||||
{
|
||||
if (MovementCostForCell(world, cell) == int.MaxValue)
|
||||
return false;
|
||||
|
||||
|
||||
if (SharesCell && world.ActorMap.HasFreeSubCell(cell))
|
||||
return true;
|
||||
|
||||
|
||||
var blockingActors = world.ActorMap.GetUnitsAt(cell).Where(x => x != ignoreActor).ToList();
|
||||
if (checkTransientActors && blockingActors.Count > 0)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
int __facing;
|
||||
int2 __fromCell, __toCell;
|
||||
public SubCell fromSubCell, toSubCell;
|
||||
|
||||
|
||||
int __altitude;
|
||||
|
||||
[Sync]
|
||||
@@ -165,7 +165,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
{
|
||||
this.fromSubCell = this.toSubCell = init.Get<SubCellInit, SubCell>();
|
||||
}
|
||||
|
||||
|
||||
if (init.Contains<LocationInit>())
|
||||
{
|
||||
this.__fromCell = this.__toCell = init.Get<LocationInit, int2>();
|
||||
@@ -228,7 +228,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
// Couldn't find a cell
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
void PerformMoveInner(Actor self, int2 targetLocation, bool queued)
|
||||
{
|
||||
int2 currentLocation = NearestMoveableCell(targetLocation);
|
||||
@@ -247,7 +247,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
self.SetTargetLine(Target.FromCell(currentLocation), Color.Green);
|
||||
}
|
||||
|
||||
|
||||
protected void PerformMove(Actor self, int2 targetLocation, bool queued)
|
||||
{
|
||||
if (queued)
|
||||
@@ -264,7 +264,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
if (order.OrderString == "Stop")
|
||||
self.CancelActivity();
|
||||
|
||||
|
||||
if (order.OrderString == "Scatter")
|
||||
OnNudge(self, self, true);
|
||||
}
|
||||
@@ -296,15 +296,15 @@ namespace OpenRA.Mods.RA.Move
|
||||
yield return Pair.New(toCell, toSubCell);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SubCell GetDesiredSubcell(int2 a, Actor ignoreActor)
|
||||
{
|
||||
if (!Info.SharesCell)
|
||||
return SubCell.FullCell;
|
||||
|
||||
|
||||
// Prioritise the current subcell
|
||||
return new[]{ fromSubCell, SubCell.TopLeft, SubCell.TopRight, SubCell.Center,
|
||||
SubCell.BottomLeft, SubCell.BottomRight}.First(b =>
|
||||
SubCell.BottomLeft, SubCell.BottomRight}.First(b =>
|
||||
{
|
||||
var blockingActors = self.World.ActorMap.GetUnitsAt(a,b).Where(c => c != ignoreActor);
|
||||
if (blockingActors.Count() > 0)
|
||||
@@ -320,7 +320,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public bool CanEnterCell(int2 p)
|
||||
{
|
||||
return CanEnterCell(p, null, true);
|
||||
|
||||
@@ -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.Move
|
||||
public List<int2> path;
|
||||
Func<Actor, Mobile, List<int2>> getPath;
|
||||
public Actor ignoreBuilding;
|
||||
|
||||
|
||||
// Scriptable move order
|
||||
// Ignores lane bias and nearby units
|
||||
public Move( int2 destination )
|
||||
@@ -39,16 +39,16 @@ namespace OpenRA.Mods.RA.Move
|
||||
this.nearEnough = 0;
|
||||
}
|
||||
|
||||
public Move( int2 destination, int nearEnough )
|
||||
public Move( int2 destination, int nearEnough )
|
||||
{
|
||||
this.getPath = (self,mobile) => self.World.WorldActor.Trait<PathFinder>().FindUnitPath( mobile.toCell, destination, self );
|
||||
this.destination = destination;
|
||||
this.nearEnough = nearEnough;
|
||||
}
|
||||
|
||||
|
||||
public Move(int2 destination, Actor ignoreBuilding)
|
||||
{
|
||||
this.getPath = (self,mobile) =>
|
||||
this.getPath = (self,mobile) =>
|
||||
self.World.WorldActor.Trait<PathFinder>().FindPath(
|
||||
PathSearch.FromPoint( self.World, mobile.Info, self.Owner, mobile.toCell, destination, false )
|
||||
.WithIgnoredBuilding( ignoreBuilding ));
|
||||
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
{
|
||||
var path = getPath(self, mobile).TakeWhile(a => a != mobile.toCell).ToList();
|
||||
mobile.PathHash = HashList(path);
|
||||
Log.Write("debug", "EvalPathHash #{0} {1}",
|
||||
Log.Write("debug", "EvalPathHash #{0} {1}",
|
||||
self.ActorID, mobile.PathHash);
|
||||
return path;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
path = EvalPath(self, mobile);
|
||||
SanityCheckPath( mobile );
|
||||
}
|
||||
|
||||
|
||||
if( path.Count == 0 )
|
||||
{
|
||||
destination = mobile.toCell;
|
||||
@@ -219,7 +219,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
hasNudged = false;
|
||||
hasWaited = false;
|
||||
path.RemoveAt( path.Count - 1 );
|
||||
|
||||
|
||||
var subCell = mobile.GetDesiredSubcell(nextCell, ignoreBuilding);
|
||||
return Pair.New(nextCell, subCell);
|
||||
}
|
||||
@@ -357,7 +357,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
mobile.Facing,
|
||||
mobile.Facing,
|
||||
moveFraction - moveFractionTotal );
|
||||
|
||||
|
||||
mobile.EnteringCell(self);
|
||||
mobile.SetLocation( mobile.toCell, mobile.toSubCell, mobile.toCell, mobile.toSubCell );
|
||||
return ret2;
|
||||
|
||||
@@ -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.
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
cached.tick = world.FrameNumber;
|
||||
return new List<int2>(cached.result);
|
||||
}
|
||||
|
||||
|
||||
var mi = self.Info.Traits.Get<MobileInfo>();
|
||||
|
||||
var pb = FindBidiPath(
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
PathSearch.FromPoints(world, mi, self.Owner, tilesInRange, src, true),
|
||||
PathSearch.FromPoint(world, mi, self.Owner, src, target, true)
|
||||
.InReverse());
|
||||
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,10 +25,10 @@ namespace OpenRA.Mods.RA.Move
|
||||
public bool checkForBlocked;
|
||||
public Actor ignoreBuilding;
|
||||
public bool inReverse;
|
||||
|
||||
|
||||
MobileInfo mobileInfo;
|
||||
Player owner;
|
||||
|
||||
|
||||
public PathSearch(World world, MobileInfo mobileInfo, Player owner)
|
||||
{
|
||||
this.world = world;
|
||||
@@ -61,19 +61,19 @@ namespace OpenRA.Mods.RA.Move
|
||||
heuristic = h;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public PathSearch WithoutLaneBias()
|
||||
{
|
||||
LaneBias = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public PathSearch FromPoint(int2 from)
|
||||
{
|
||||
AddInitialCell( from );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
int LaneBias = 1;
|
||||
|
||||
public int2 Expand( World world )
|
||||
@@ -86,10 +86,10 @@ namespace OpenRA.Mods.RA.Move
|
||||
p = queue.Pop();
|
||||
|
||||
cellInfo[p.Location.X, p.Location.Y].Seen = true;
|
||||
|
||||
|
||||
var thisCost = mobileInfo.MovementCostForCell(world, p.Location);
|
||||
|
||||
if (thisCost == int.MaxValue)
|
||||
if (thisCost == int.MaxValue)
|
||||
return p.Location;
|
||||
|
||||
foreach( int2 d in directions )
|
||||
@@ -101,16 +101,16 @@ namespace OpenRA.Mods.RA.Move
|
||||
continue;
|
||||
|
||||
var costHere = mobileInfo.MovementCostForCell(world, newHere);
|
||||
|
||||
|
||||
if (costHere == int.MaxValue)
|
||||
continue;
|
||||
|
||||
if (!mobileInfo.CanEnterCell(world, owner, newHere, ignoreBuilding, checkForBlocked))
|
||||
continue;
|
||||
|
||||
|
||||
if (customBlock != null && customBlock(newHere))
|
||||
continue;
|
||||
|
||||
|
||||
var est = heuristic( newHere );
|
||||
if( est == int.MaxValue )
|
||||
continue;
|
||||
@@ -136,7 +136,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
cellInfo[ newHere.X, newHere.Y ].MinCost = newCost;
|
||||
|
||||
queue.Add( new PathDistance( newCost + est, newHere ) );
|
||||
|
||||
|
||||
}
|
||||
return p.Location;
|
||||
}
|
||||
@@ -161,14 +161,14 @@ namespace OpenRA.Mods.RA.Move
|
||||
cellInfo[ location.X, location.Y ] = new CellInfo( 0, location, false );
|
||||
queue.Add( new PathDistance( heuristic( location ), location ) );
|
||||
}
|
||||
|
||||
|
||||
public static PathSearch Search( World world, MobileInfo mi, Player owner, bool checkForBlocked )
|
||||
{
|
||||
var search = new PathSearch(world, mi, owner) {
|
||||
checkForBlocked = checkForBlocked };
|
||||
return search;
|
||||
}
|
||||
|
||||
|
||||
public static PathSearch FromPoint( World world, MobileInfo mi, Player owner, int2 from, int2 target, bool checkForBlocked )
|
||||
{
|
||||
var search = new PathSearch(world, mi, owner) {
|
||||
|
||||
Reference in New Issue
Block a user