mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r10809) -Fix (r10097): When reversing, articulated parts of road vehicles should not attempt to do their own pathfinding.
This commit is contained in:
parent
537064d010
commit
68abeed9b8
@ -1376,9 +1376,9 @@ static bool RoadVehLeaveDepot(Vehicle *v, bool first)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev, TileIndex tile, DiagDirection entry_dir)
|
static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev, TileIndex tile, DiagDirection entry_dir, bool already_reversed)
|
||||||
{
|
{
|
||||||
if (prev->tile == v->tile) {
|
if (prev->tile == v->tile && !already_reversed) {
|
||||||
/* If the previous vehicle is on the same tile as this vehicle is
|
/* If the previous vehicle is on the same tile as this vehicle is
|
||||||
* then it must have reversed. */
|
* then it must have reversed. */
|
||||||
return _road_reverse_table[entry_dir];
|
return _road_reverse_table[entry_dir];
|
||||||
@ -1491,7 +1491,7 @@ static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
|
|||||||
/* If this is the front engine, look for the right path. */
|
/* If this is the front engine, look for the right path. */
|
||||||
dir = RoadFindPathToDest(v, tile, (DiagDirection)(rd.x & 3));
|
dir = RoadFindPathToDest(v, tile, (DiagDirection)(rd.x & 3));
|
||||||
} else {
|
} else {
|
||||||
dir = FollowPreviousRoadVehicle(v, prev, tile, (DiagDirection)(rd.x & 3));
|
dir = FollowPreviousRoadVehicle(v, prev, tile, (DiagDirection)(rd.x & 3), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == INVALID_TRACKDIR) {
|
if (dir == INVALID_TRACKDIR) {
|
||||||
@ -1583,11 +1583,18 @@ again:
|
|||||||
|
|
||||||
if (rd.x & RDE_TURNED) {
|
if (rd.x & RDE_TURNED) {
|
||||||
/* Vehicle has finished turning around, it will now head back onto the same tile */
|
/* Vehicle has finished turning around, it will now head back onto the same tile */
|
||||||
Trackdir dir = RoadFindPathToDest(v, v->tile, (DiagDirection)(rd.x & 3));
|
Trackdir dir;
|
||||||
uint32 r;
|
uint32 r;
|
||||||
Direction newdir;
|
Direction newdir;
|
||||||
const RoadDriveEntry *rdp;
|
const RoadDriveEntry *rdp;
|
||||||
|
|
||||||
|
if (IsRoadVehFront(v)) {
|
||||||
|
/* If this is the front engine, look for the right path. */
|
||||||
|
dir = RoadFindPathToDest(v, v->tile, (DiagDirection)(rd.x & 3));
|
||||||
|
} else {
|
||||||
|
dir = FollowPreviousRoadVehicle(v, prev, v->tile, (DiagDirection)(rd.x & 3), true);
|
||||||
|
}
|
||||||
|
|
||||||
if (dir == INVALID_TRACKDIR) {
|
if (dir == INVALID_TRACKDIR) {
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user