Replace WPos.ToCPos -> Map.CellContaining.

This commit is contained in:
Paul Chote
2013-09-17 22:57:30 +12:00
parent 4bc09692e0
commit 9487f49cd5
43 changed files with 81 additions and 83 deletions

View File

@@ -134,7 +134,7 @@ namespace OpenRA.Mods.RA.Effects
trail.Update(pos);
if (ticks++ >= length || (!info.High && world.ActorMap
.GetUnitsAt(pos.ToCPos()).Any(a => a.HasTrait<IBlocksBullets>())))
.GetUnitsAt(world.Map.CellContaining(pos)).Any(a => a.HasTrait<IBlocksBullets>())))
{
Explode(world);
}
@@ -148,7 +148,7 @@ namespace OpenRA.Mods.RA.Effects
if (anim == null || ticks >= length)
yield break;
var cell = pos.ToCPos();
var cell = wr.world.Map.CellContaining(pos);
if (!args.SourceActor.World.FogObscures(cell))
{
if (info.Shadow)

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (wr.world.FogObscures(pos.ToCPos()))
if (wr.world.FogObscures(wr.world.Map.CellContaining(pos)))
yield break;
yield return new TextRenderable(font, pos, 0, color, text);

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Effects
{
this.world = world;
this.pos = pos;
this.cell = pos.ToCPos();
this.cell = world.Map.CellContaining(pos);
this.paletteName = paletteName;
anim = new Animation(world, image);
anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Effects
{
this.world = world;
this.pos = pos;
this.cell = pos.ToCPos();
this.cell = world.Map.CellContaining(pos);
this.palette = palette;
anim = new Animation(world, "explosion");
anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
var cell = pos.ToCPos();
var cell = wr.world.Map.CellContaining(pos);
if (!args.SourceActor.World.FogObscures(cell))
{
if (info.Shadow)

View File

@@ -154,7 +154,7 @@ namespace OpenRA.Mods.RA.Effects
if (info.ContrailLength > 0)
trail.Update(pos);
var cell = pos.ToCPos();
var cell = world.Map.CellContaining(pos);
var shouldExplode = (pos.Z < 0) // Hit the ground
|| (dist.LengthSquared < MissileCloseEnough.Range * MissileCloseEnough.Range) // Within range
@@ -186,7 +186,7 @@ namespace OpenRA.Mods.RA.Effects
if (info.ContrailLength > 0)
yield return trail;
if (!args.SourceActor.World.FogObscures(pos.ToCPos()))
if (!args.SourceActor.World.FogObscures(wr.world.Map.CellContaining(pos)))
{
var palette = wr.Palette(args.Weapon.Palette);
foreach (var r in anim.Render(pos, palette))

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Effects
parachuteOffset = pai.Offset;
// Adjust x,y to match the target subcell
cargo.Trait<IPositionable>().SetPosition(cargo, dropPosition.ToCPos());
cargo.Trait<IPositionable>().SetPosition(cargo, cargo.World.Map.CellContaining(dropPosition));
var cp = cargo.CenterPosition;
pos = new WPos(cp.X, cp.Y, dropPosition.Z);
}

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects
{
this.world = world;
this.pos = pos;
this.cell = pos.ToCPos();
this.cell = world.Map.CellContaining(pos);
anim = new Animation(world, trail);
anim.PlayThen("idle",