diff options
author | peter1138 <peter1138@openttd.org> | 2006-12-05 20:22:14 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-12-05 20:22:14 +0000 |
commit | 4d5535bc54d62a1b7009291f05e23dd86d5b62e0 (patch) | |
tree | 5634f97ab65ae68beb49dff9225c66b39f528e7f | |
parent | 55dc2fbbefd81d8c3ea7079c79ef9cf4bd0286be (diff) | |
download | openttd-4d5535bc54d62a1b7009291f05e23dd86d5b62e0.tar.xz |
(svn r7378) -Fix (r2428): Don't update vehicle images when turning a train around.
During this procedure the train is split into parts which can result in
incorrect images being used.
-rw-r--r-- | train_cmd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/train_cmd.c b/train_cmd.c index 76ea710cd..69ae01daa 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -34,7 +34,7 @@ #include "date.h" static bool TrainCheckIfLineEnds(Vehicle *v); -static void TrainController(Vehicle *v); +static void TrainController(Vehicle *v, bool update_image); static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; static const byte _vehicle_initial_y_fract[4] = { 8, 4, 8, 10}; @@ -1662,7 +1662,7 @@ static void AdvanceWagons(Vehicle *v, bool before) tempnext = last->next; last->next = NULL; - for (i = 0; i < differential; i++) TrainController(first); + for (i = 0; i < differential; i++) TrainController(first, false); last->next = tempnext; } @@ -3007,7 +3007,7 @@ static void *CheckVehicleAtSignal(Vehicle *v, void *data) return NULL; } -static void TrainController(Vehicle *v) +static void TrainController(Vehicle *v, bool update_image) { Vehicle *prev; GetNewVehiclePosResult gp; @@ -3168,7 +3168,7 @@ static void TrainController(Vehicle *v) /* update image of train, as well as delta XY */ newdir = GetNewVehicleDirection(v, gp.x, gp.y); UpdateTrainDeltaXY(v, newdir); - v->cur_image = GetTrainImage(v, newdir); + if (update_image) v->cur_image = GetTrainImage(v, newdir); v->x_pos = gp.x; v->y_pos = gp.y; @@ -3520,7 +3520,7 @@ static void TrainLocoHandler(Vehicle *v, bool mode) TrainCheckIfLineEnds(v); do { - TrainController(v); + TrainController(v, true); CheckTrainCollision(v); if (v->cur_speed <= 0x100) break; |