summaryrefslogtreecommitdiff
path: root/src/saveload/vehicle_sl.cpp
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2019-01-31 20:54:15 +0000
committerPeterN <peter@fuzzle.org>2019-02-04 00:19:48 +0000
commit33e3f4916173b4129cbbe60f94dae659a70edb83 (patch)
tree2384acf24eafd4fa75910401c58e859926c1bb4c /src/saveload/vehicle_sl.cpp
parent0749a291c4941511744e82a315ee34d96e053fb1 (diff)
downloadopenttd-33e3f4916173b4129cbbe60f94dae659a70edb83.tar.xz
Fix #7119: When rotating a ship, apply an additional offset to avoid movement glitch.
Diffstat (limited to 'src/saveload/vehicle_sl.cpp')
-rw-r--r--src/saveload/vehicle_sl.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 11935fa40..540416586 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -375,6 +375,17 @@ void AfterLoadVehicles(bool part_of_load)
FOR_ALL_SHIPS(s) {
s->rotation = s->direction;
}
+ } else {
+ Ship *s;
+ FOR_ALL_SHIPS(s) {
+ if (s->rotation == s->direction) continue;
+ /* In case we are rotating on gameload, set the rotation position to
+ * the current position, otherwise the applied workaround offset would
+ * be with respect to 0,0.
+ */
+ s->rotation_x_pos = s->x_pos;
+ s->rotation_y_pos = s->y_pos;
+ }
}
}