Fix: Road vehicles should only penalize traffic going to the same station

This commit is contained in:
Themba Dube
2020-03-31 12:52:54 -04:00
parent 0a441f63ff
commit 04b8e2f8a9

View File

@@ -358,6 +358,10 @@ static Vehicle * FindVehiclesOnTileProc(Vehicle *v, void *_data)
if (data->originVehicle == v) if (data->originVehicle == v)
return nullptr; return nullptr;
/* only consider vehicles going to the same station as us */
if(data->originVehicle->current_order.GetDestination() != v->current_order.GetDestination())
return nullptr;
TileIndex ti = v->tile + TileOffsByDir(v->direction); TileIndex ti = v->tile + TileOffsByDir(v->direction);
for (int i = 0; i < MAX_TARGETS; i++) { for (int i = 0; i < MAX_TARGETS; i++) {
@@ -442,7 +446,7 @@ public:
FindVehiclesOnTileProcData data; FindVehiclesOnTileProcData data;
data.originVehicle = v; data.originVehicle = v;
data.targets = &Yapf().leaderTargets; data.targets = &Yapf().leaderTargets;
FindVehicleOnPos(tile, &data, &FindVehiclesOnTileProc); FindVehicleOnPos(tile, VEH_ROAD, &data, &FindVehiclesOnTileProc);
/* find the best path */ /* find the best path */
path_found = Yapf().FindPath(v); path_found = Yapf().FindPath(v);