Only do RV leader check within uncached area
This commit is contained in:
@@ -446,16 +446,19 @@ public:
|
|||||||
Yapf().SetDestination(v);
|
Yapf().SetDestination(v);
|
||||||
|
|
||||||
bool multiple_targets = false;
|
bool multiple_targets = false;
|
||||||
|
TileArea non_cached_area;
|
||||||
const Station *st = Yapf().GetDestinationStation();
|
const Station *st = Yapf().GetDestinationStation();
|
||||||
if (st) {
|
if (st) {
|
||||||
const RoadStop *stop = st->GetPrimaryRoadStop(v);
|
const RoadStop *stop = st->GetPrimaryRoadStop(v);
|
||||||
if (stop != nullptr && (IsDriveThroughStopTile(stop->xy) || stop->GetNextRoadStop(v) != nullptr)) {
|
if (stop != nullptr && (IsDriveThroughStopTile(stop->xy) || stop->GetNextRoadStop(v) != nullptr)) {
|
||||||
multiple_targets = true;
|
multiple_targets = true;
|
||||||
|
non_cached_area = v->IsBus() ? st->bus_station : st->truck_station;
|
||||||
|
non_cached_area.Expand(YAPF_ROADVEH_PATH_CACHE_DESTINATION_LIMIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Yapf().leader_targets[0] = INVALID_TILE;
|
Yapf().leader_targets[0] = INVALID_TILE;
|
||||||
if (multiple_targets) {
|
if (multiple_targets && non_cached_area.Contains(tile)) {
|
||||||
/* Destination station has at least 2 usable road stops, or first is a drive-through stop,
|
/* Destination station has at least 2 usable road stops, or first is a drive-through stop,
|
||||||
* check for other vehicles headin to the same destination directly in front */
|
* check for other vehicles headin to the same destination directly in front */
|
||||||
for (int i = 1; i < MAX_RV_LEADER_TARGETS; ++i) {
|
for (int i = 1; i < MAX_RV_LEADER_TARGETS; ++i) {
|
||||||
@@ -502,8 +505,6 @@ public:
|
|||||||
if (multiple_targets) {
|
if (multiple_targets) {
|
||||||
/* Destination station has at least 2 usable road stops, or first is a drive-through stop,
|
/* Destination station has at least 2 usable road stops, or first is a drive-through stop,
|
||||||
* trim end of path cache within a number of tiles of road stop tile area */
|
* trim end of path cache within a number of tiles of road stop tile area */
|
||||||
TileArea non_cached_area = v->IsBus() ? st->bus_station : st->truck_station;
|
|
||||||
non_cached_area.Expand(YAPF_ROADVEH_PATH_CACHE_DESTINATION_LIMIT);
|
|
||||||
while (!path_cache.empty() && non_cached_area.Contains(path_cache.tile.back())) {
|
while (!path_cache.empty() && non_cached_area.Contains(path_cache.tile.back())) {
|
||||||
path_cache.td.pop_back();
|
path_cache.td.pop_back();
|
||||||
path_cache.tile.pop_back();
|
path_cache.tile.pop_back();
|
||||||
|
Reference in New Issue
Block a user