Fix #7119: When rotating a ship, apply an additional offset to avoid movement glitch.

This commit is contained in:
Peter Nelson
2019-01-31 20:54:15 +00:00
committed by PeterN
parent 0749a291c4
commit 33e3f49161
3 changed files with 28 additions and 0 deletions

View File

@@ -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;
}
}
}