summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-12-05 20:22:14 +0000
committerpeter1138 <peter1138@openttd.org>2006-12-05 20:22:14 +0000
commit1267bb5968081fcf79b876fed20e81ef104dc6c3 (patch)
tree5634f97ab65ae68beb49dff9225c66b39f528e7f /train_cmd.c
parent908552d7ed3bc71b144dc83aab9977a7712e190e (diff)
downloadopenttd-1267bb5968081fcf79b876fed20e81ef104dc6c3.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.
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c10
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;