@@ -2152,25 +2152,26 @@ void Vehicle::RefreshNextHopsStats()
const Order *next = first;
bool has_cargo = this->last_loading_station != INVALID_STATION;
bool was_refit = false;
uint hops = 0;
while (next != NULL) {
/* If the refit cargo is CT_AUTO_REFIT, we're optimistic and assume the
* cargo will stay the same. The point of this method is to avoid
* deadlocks due to vehicles waiting for cargo that isn't being routed,
* yet. That situation will not occur if the vehicle is actually
* carrying a different cargo in the end. */
if (next->IsRefit() && !next->IsAutoRefit()) {
if ((next->IsType(OT_GOTO_DEPOT) || next->IsType(OT_GOTO_STATION)) &&
next->IsRefit() && !next->IsAutoRefit()) {
was_refit = true;
CargoID new_cid = next->GetRefitCargo();
RefitList::iterator refit_it = refit_capacities.begin();
for (Vehicle *v = this; v != NULL; v = v->Next()) {
const Engine *e = Engine::Get(v->engine_type);
if (!HasBit(e->info.refit_mask, new_cid)) {
++refit_it;
continue;
}
/* Back up the vehicle's cargo type */
CargoID temp_cid = v->cargo_type;