Codechange: Use IsValidCargoID/IsValidCargoType.

IsValidCargoType() is used only for unmapped IDs.
This commit is contained in:
2023-05-04 11:29:21 +01:00
committed by PeterN
parent c4ca6a0f74
commit 76516d7f70
30 changed files with 130 additions and 134 deletions

View File

@@ -1328,7 +1328,7 @@ struct BuildVehicleWindow : Window {
this->te.cost = ret.GetCost() - e->GetCost();
this->te.capacity = refit_capacity;
this->te.mail_capacity = refit_mail;
this->te.cargo = (cargo == CT_INVALID) ? e->GetDefaultCargoType() : cargo;
this->te.cargo = !IsValidCargoID(cargo) ? e->GetDefaultCargoType() : cargo;
this->te.all_capacities = cargo_capacities;
return;
}