Target uses int2.

This commit is contained in:
Paul Chote
2011-01-01 13:29:05 +13:00
parent 60e3f7621f
commit 9f38df013e
4 changed files with 8 additions and 8 deletions

View File

@@ -214,11 +214,11 @@ namespace OpenRA.Traits
public struct Target // a target: either an actor, or a fixed location. public struct Target // a target: either an actor, or a fixed location.
{ {
Actor actor; Actor actor;
float2 pos; int2 pos;
bool valid; bool valid;
public static Target FromActor(Actor a) { return new Target { actor = a, valid = (a != null) }; } public static Target FromActor(Actor a) { return new Target { actor = a, valid = (a != null) }; }
public static Target FromPos(float2 p) { return new Target { pos = p, valid = true }; } public static Target FromPos(int2 p) { return new Target { pos = p, valid = true }; }
public static Target FromCell(int2 c) { return new Target { pos = Util.CenterOfCell(c), valid = true }; } public static Target FromCell(int2 c) { return new Target { pos = Util.CenterOfCell(c), valid = true }; }
public static Target FromOrder(Order o) public static Target FromOrder(Order o)
{ {
@@ -230,7 +230,7 @@ namespace OpenRA.Traits
public static readonly Target None = new Target(); public static readonly Target None = new Target();
public bool IsValid { get { return valid && (actor == null || actor.IsInWorld); } } public bool IsValid { get { return valid && (actor == null || actor.IsInWorld); } }
public int2 PxPosition { get { return IsActor ? actor.Trait<IHasLocation>().PxPosition : pos.ToInt2(); } } public int2 PxPosition { get { return IsActor ? actor.Trait<IHasLocation>().PxPosition : pos; } }
public int2 CenterLocation { get { return PxPosition; } } public int2 CenterLocation { get { return PxPosition; } }
public Actor Actor { get { return IsActor ? actor : null; } } public Actor Actor { get { return IsActor ? actor : null; } }

View File

@@ -112,12 +112,12 @@ namespace OpenRA.Mods.RA
} }
} }
public static void DoExplosion(Actor attacker, string weapontype, float2 pos, int altitude) public static void DoExplosion(Actor attacker, string weapontype, int2 pos, int altitude)
{ {
var args = new ProjectileArgs var args = new ProjectileArgs
{ {
src = pos.ToInt2(), src = pos,
dest = pos.ToInt2(), dest = pos,
srcAltitude = altitude, srcAltitude = altitude,
destAltitude = altitude, destAltitude = altitude,
firedBy = attacker, firedBy = attacker,

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Effects
readonly Player firedBy; readonly Player firedBy;
readonly Actor silo; readonly Actor silo;
Animation anim; Animation anim;
float2 pos; int2 pos;
int2 targetLocation; int2 targetLocation;
int altitude; int altitude;
bool goingUp = true; bool goingUp = true;

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA
WaitForIdle(); WaitForIdle();
} }
protected void DefendThis(float2 target) protected void DefendThis(int2 target)
{ {
DefendTarget = Target.FromPos(target); DefendTarget = Target.FromPos(target);
TargetType = ETargetType.Location; TargetType = ETargetType.Location;