Improve link graph refresher when using autorefit with cargo-type load orders

This commit is contained in:
Jonathan G Rennison
2024-06-30 13:05:24 +01:00
parent 9a342e489d
commit f1504dcc34

View File

@@ -387,7 +387,9 @@ void LinkRefresher::RefreshLinks(const Order *cur, const Order *next, TimetableT
SetBit(flags, IN_AUTOREFIT); SetBit(flags, IN_AUTOREFIT);
LinkRefresher backup(*this); LinkRefresher backup(*this);
for (CargoID c = 0; c != NUM_CARGO; ++c) { for (CargoID c = 0; c != NUM_CARGO; ++c) {
if (CargoSpec::Get(c)->IsValid() && this->HandleRefit(c)) { if (!CargoSpec::Get(c)->IsValid()) continue;
if (next->GetCargoLoadType(c) == OLFB_NO_LOAD) continue;
if (this->HandleRefit(c)) {
this->RefreshLinks(cur, next, travel, flags, num_hops); this->RefreshLinks(cur, next, travel, flags, num_hops);
*this = backup; *this = backup;
} }