mirror of https://github.com/OpenTTD/OpenTTD.git
(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.
This commit is contained in:
parent
908552d7ed
commit
1267bb5968
10
train_cmd.c
10
train_cmd.c
|
@ -34,7 +34,7 @@
|
||||||
#include "date.h"
|
#include "date.h"
|
||||||
|
|
||||||
static bool TrainCheckIfLineEnds(Vehicle *v);
|
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_x_fract[4] = {10, 8, 4, 8};
|
||||||
static const byte _vehicle_initial_y_fract[4] = { 8, 4, 8, 10};
|
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;
|
tempnext = last->next;
|
||||||
last->next = NULL;
|
last->next = NULL;
|
||||||
|
|
||||||
for (i = 0; i < differential; i++) TrainController(first);
|
for (i = 0; i < differential; i++) TrainController(first, false);
|
||||||
|
|
||||||
last->next = tempnext;
|
last->next = tempnext;
|
||||||
}
|
}
|
||||||
|
@ -3007,7 +3007,7 @@ static void *CheckVehicleAtSignal(Vehicle *v, void *data)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TrainController(Vehicle *v)
|
static void TrainController(Vehicle *v, bool update_image)
|
||||||
{
|
{
|
||||||
Vehicle *prev;
|
Vehicle *prev;
|
||||||
GetNewVehiclePosResult gp;
|
GetNewVehiclePosResult gp;
|
||||||
|
@ -3168,7 +3168,7 @@ static void TrainController(Vehicle *v)
|
||||||
/* update image of train, as well as delta XY */
|
/* update image of train, as well as delta XY */
|
||||||
newdir = GetNewVehicleDirection(v, gp.x, gp.y);
|
newdir = GetNewVehicleDirection(v, gp.x, gp.y);
|
||||||
UpdateTrainDeltaXY(v, newdir);
|
UpdateTrainDeltaXY(v, newdir);
|
||||||
v->cur_image = GetTrainImage(v, newdir);
|
if (update_image) v->cur_image = GetTrainImage(v, newdir);
|
||||||
|
|
||||||
v->x_pos = gp.x;
|
v->x_pos = gp.x;
|
||||||
v->y_pos = gp.y;
|
v->y_pos = gp.y;
|
||||||
|
@ -3520,7 +3520,7 @@ static void TrainLocoHandler(Vehicle *v, bool mode)
|
||||||
TrainCheckIfLineEnds(v);
|
TrainCheckIfLineEnds(v);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
TrainController(v);
|
TrainController(v, true);
|
||||||
CheckTrainCollision(v);
|
CheckTrainCollision(v);
|
||||||
if (v->cur_speed <= 0x100)
|
if (v->cur_speed <= 0x100)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue