summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-10-16 14:56:33 +0000
committerfrosch <frosch@openttd.org>2016-10-16 14:56:33 +0000
commita6d1d128dae5a8a329def0b1c4d3c257267a928b (patch)
treee69b05498569790b2971fefdb004c3bf7cb6ce5b
parent88dd4d11b41a2fe2f1097e695232ed71e669de90 (diff)
downloadopenttd-a6d1d128dae5a8a329def0b1c4d3c257267a928b.tar.xz
(svn r27663) -Codechange: Deduplicate code when rotating crashed vehicles.
-rw-r--r--src/train_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index dca456d97..699f0c144 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3521,14 +3521,14 @@ static void ChangeTrainDirRandomly(Train *v)
/* We don't need to twist around vehicles if they're not visible */
if (!(v->vehstatus & VS_HIDDEN)) {
v->direction = ChangeDir(v->direction, delta[GB(Random(), 0, 2)]);
- v->UpdateDeltaXY(v->direction);
- v->cur_image = v->GetImage(v->direction, EIT_ON_MAP);
/* Refrain from updating the z position of the vehicle when on
* a bridge, because UpdateInclination() will put the vehicle under
* the bridge in that case */
if (v->track != TRACK_BIT_WORMHOLE) {
v->UpdatePosition();
- v->UpdateInclination(false, false);
+ v->UpdateInclination(false, true);
+ } else {
+ v->UpdateViewport(false, true);
}
}
} while ((v = v->Next()) != NULL);