summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-03 11:44:31 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-03 11:44:31 +0200
commitcb68989e0ea376d19f05dfa77c3d72a094102f9c (patch)
tree287169d675cc6f79febb27cb3deea8c20470bbe5
parent7e789d4438fd4a78285bdda0e9e33fe6f9645454 (diff)
downloadRustAndDust-cb68989e0ea376d19f05dfa77c3d72a094102f9c.zip
RustAndDust-cb68989e0ea376d19f05dfa77c3d72a094102f9c.tar.gz
getPawnPosAt(...) has a third intout argument
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 49ec38c..f5cfca9 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -417,17 +417,21 @@ public abstract class Board implements Disposable
return getTile(coords).getCenter();
}
- public Vector2 getPawnPosAt(Pawn pawn, GridPoint2 coords)
+ public Vector2 getPawnPosAt(Pawn pawn, GridPoint2 coords, Vector2 pos)
{
Vector2 center = getTile(coords).getCenter();
float x = (center.x - (pawn.getWidth() / 2));
float y = (center.y - (pawn.getHeight() / 2));
- return new Vector2(x, y);
+ if (pos == null)
+ return new Vector2(x, y);
+ else
+ pos.set(x, y);
+ return pos;
}
public void setPawnAt(Pawn pawn, GridPoint2 coords, Orientation o)
{
- Vector2 pos = getPawnPosAt(pawn, coords);
+ Vector2 pos = getPawnPosAt(pawn, coords, null);
pawn.pushMove(pos.x, pos.y, o);
pushPawnAt(pawn, coords);
}
@@ -442,7 +446,7 @@ public abstract class Board implements Disposable
removePawnFrom(pawn, getHexAt(pawn.getLastPosition()));
pushPawnAt(pawn, coords);
- Vector2 pos = getPawnPosAt(pawn, coords);
+ Vector2 pos = getPawnPosAt(pawn, coords, null);
pawn.pushMove(pos.x, pos.y, o);
}