fix off-by-one in IsInRange. use CenterLocation in combat code where appropriate

This commit is contained in:
Bob
2010-11-04 01:20:40 +13:00
committed by Chris Forbes
parent 5c0cd50797
commit 80caf1818b
4 changed files with 7 additions and 8 deletions

View File

@@ -224,7 +224,7 @@ namespace OpenRA.Mods.RA
{
var rsq = range * range * Game.CellSize * Game.CellSize;
foreach( var cell in target.Trait<ITargetable>().TargetableCells( target ) )
if( ( attackOrigin - cell * Game.CellSize ).LengthSquared < rsq )
if( ( attackOrigin - cell * Game.CellSize ).LengthSquared <= rsq )
return true;
return false;
}
@@ -232,7 +232,7 @@ namespace OpenRA.Mods.RA
public static bool IsInRange( float2 attackOrigin, float range, float2 targetLocation )
{
var rsq = range * range * Game.CellSize * Game.CellSize;
return ( attackOrigin - targetLocation ).LengthSquared < rsq;
return ( attackOrigin - targetLocation ).LengthSquared <= rsq;
}
public static bool IsInRange( float2 attackOrigin, float range, Target target )