mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r12384) -Fix (r2428): do not disconnect train when reversing, it may 'think' it is whole in a depot
This commit is contained in:
parent
e46945a254
commit
f45221f274
@ -52,7 +52,7 @@
|
|||||||
#include "table/train_cmd.h"
|
#include "table/train_cmd.h"
|
||||||
|
|
||||||
static bool TrainCheckIfLineEnds(Vehicle *v);
|
static bool TrainCheckIfLineEnds(Vehicle *v);
|
||||||
static void TrainController(Vehicle *v, bool update_image);
|
static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image);
|
||||||
static TileIndex TrainApproachingCrossingTile(const Vehicle *v);
|
static TileIndex TrainApproachingCrossingTile(const Vehicle *v);
|
||||||
|
|
||||||
static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8};
|
static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8};
|
||||||
@ -1735,17 +1735,9 @@ static void AdvanceWagons(Vehicle *v, bool before)
|
|||||||
int differential = last->u.rail.cached_veh_length - base->u.rail.cached_veh_length;
|
int differential = last->u.rail.cached_veh_length - base->u.rail.cached_veh_length;
|
||||||
if (before) differential *= -1;
|
if (before) differential *= -1;
|
||||||
|
|
||||||
if (differential > 0) {
|
/* do not update images now
|
||||||
/* disconnect last car to make sure only this subset moves */
|
* negative differential will are handled in the second run */
|
||||||
Vehicle *tempnext = last->Next();
|
for (int i = 0; i < differential; i++) TrainController(first, last->Next(), false);
|
||||||
last->SetNext(NULL);
|
|
||||||
|
|
||||||
/* do not update images now because the wagons are disconnected
|
|
||||||
* and that could cause problems with NewGRFs */
|
|
||||||
for (int i = 0; i < differential; i++) TrainController(first, false);
|
|
||||||
|
|
||||||
last->SetNext(tempnext);
|
|
||||||
}
|
|
||||||
|
|
||||||
base = first;
|
base = first;
|
||||||
first = first->Next();
|
first = first->Next();
|
||||||
@ -2993,12 +2985,12 @@ static void *CheckVehicleAtSignal(Vehicle *v, void *data)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TrainController(Vehicle *v, bool update_image)
|
static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
|
||||||
{
|
{
|
||||||
Vehicle *prev;
|
Vehicle *prev;
|
||||||
|
|
||||||
/* For every vehicle after and including the given vehicle */
|
/* For every vehicle after and including the given vehicle */
|
||||||
for (prev = v->Previous(); v != NULL; prev = v, v = v->Next()) {
|
for (prev = v->Previous(); v != nomove; prev = v, v = v->Next()) {
|
||||||
DiagDirection enterdir = DIAGDIR_BEGIN;
|
DiagDirection enterdir = DIAGDIR_BEGIN;
|
||||||
bool update_signals_crossing = false; // will we update signals or crossing state?
|
bool update_signals_crossing = false; // will we update signals or crossing state?
|
||||||
BeginVehicleMove(v);
|
BeginVehicleMove(v);
|
||||||
@ -3554,7 +3546,7 @@ static void TrainLocoHandler(Vehicle *v, bool mode)
|
|||||||
TrainCheckIfLineEnds(v);
|
TrainCheckIfLineEnds(v);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
TrainController(v, true);
|
TrainController(v, NULL, true);
|
||||||
CheckTrainCollision(v);
|
CheckTrainCollision(v);
|
||||||
if (v->cur_speed <= 0x100)
|
if (v->cur_speed <= 0x100)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user