summaryrefslogtreecommitdiff
path: root/src/train.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/train.cpp')
-rw-r--r--src/train.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/train.cpp b/src/train.cpp
index cfbae97..080a357 100644
--- a/src/train.cpp
+++ b/src/train.cpp
@@ -57,6 +57,13 @@ void Train::setPosition(int tx, int ty)
findNextTile();
}
+Point2D Train::getSpritePosition() const
+{
+ int xi = ceil((float)x + (float)(m_nextX - x) * m_progress);
+ int yi = ceil((float)y + (float)(m_nextY - y) * m_progress);
+ return { xi, yi };
+}
+
void Train::addVehicle(Train* newTrain)
{
if (!m_prev) {