@@ -630,14 +630,15 @@ static void ProcessRoadVehOrder(Vehicle
v->current_order = *order;
v->dest_tile = 0;
if (order->type == OT_GOTO_STATION) {
const Station* st = GetStation(order->station);
uint mindist = 0xFFFFFFFF;
const RoadStop* rs;
TileIndex dest;
uint mindist;
if (order->station == v->last_station_visited) {
v->last_station_visited = INVALID_STATION;
}
rs = GetPrimaryRoadStop(st, v->cargo_type == CT_PASSENGERS ? RS_BUS : RS_TRUCK);
@@ -646,15 +647,23 @@ static void ProcessRoadVehOrder(Vehicle
// There is no stop left at the station, so don't even TRY to go there
v->cur_order_index++;
InvalidateVehicleOrder(v);
return;
for (; rs != NULL; rs = rs->next) {
if (DistanceManhattan(v->tile, rs->xy) < mindist) v->dest_tile = rs->xy;
dest = rs->xy;
mindist = DistanceManhattan(v->tile, rs->xy);
for (rs = rs->next; rs != NULL; rs = rs->next) {
uint dist = DistanceManhattan(v->tile, rs->xy);
if (dist < mindist) {
mindist = dist;
v->dest_tile = dest;
} else if (order->type == OT_GOTO_DEPOT) {
v->dest_tile = GetDepot(order->station)->xy;