mirror of https://github.com/OpenTTD/OpenTTD.git
This commit is contained in:
parent
788b06fe0f
commit
31668b8f94
|
@ -1280,9 +1280,12 @@ again:
|
||||||
|
|
||||||
Direction new_dir = RoadVehGetSlidingDirection(v, x, y);
|
Direction new_dir = RoadVehGetSlidingDirection(v, x, y);
|
||||||
if (v->IsFrontEngine()) {
|
if (v->IsFrontEngine()) {
|
||||||
Vehicle *u = RoadVehFindCloseTo(v, x, y, new_dir);
|
const Vehicle *u = RoadVehFindCloseTo(v, x, y, new_dir);
|
||||||
if (u != nullptr) {
|
if (u != nullptr) {
|
||||||
v->cur_speed = u->First()->cur_speed;
|
v->cur_speed = u->First()->cur_speed;
|
||||||
|
/* We might be blocked, prevent pathfinding rerun as we already know where we are heading to. */
|
||||||
|
v->path.tile.push_front(tile);
|
||||||
|
v->path.td.push_front(dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1392,15 +1395,15 @@ again:
|
||||||
int y = TileY(v->tile) * TILE_SIZE + rdp[turn_around_start_frame].y;
|
int y = TileY(v->tile) * TILE_SIZE + rdp[turn_around_start_frame].y;
|
||||||
|
|
||||||
Direction new_dir = RoadVehGetSlidingDirection(v, x, y);
|
Direction new_dir = RoadVehGetSlidingDirection(v, x, y);
|
||||||
if (v->IsFrontEngine() && RoadVehFindCloseTo(v, x, y, new_dir) != nullptr) {
|
if (v->IsFrontEngine()) {
|
||||||
/* We are blocked. */
|
const Vehicle *u = RoadVehFindCloseTo(v, x, y, new_dir);
|
||||||
v->cur_speed = 0;
|
if (u != nullptr) {
|
||||||
if (!v->path.empty()) {
|
v->cur_speed = u->First()->cur_speed;
|
||||||
/* Prevent pathfinding rerun as we already know where we are heading to. */
|
/* We might be blocked, prevent pathfinding rerun as we already know where we are heading to. */
|
||||||
v->path.tile.push_front(v->tile);
|
v->path.tile.push_front(v->tile);
|
||||||
v->path.td.push_front(dir);
|
v->path.td.push_front(dir);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 r = VehicleEnterTile(v, v->tile, x, y);
|
uint32 r = VehicleEnterTile(v, v->tile, x, y);
|
||||||
|
|
Loading…
Reference in New Issue