Fix multi-cargo ship capacity display in autoreplace and available ships windows

This commit is contained in:
Jonathan G Rennison
2024-02-14 23:24:02 +00:00
parent b13b2781bd
commit c5f026ba66
3 changed files with 8 additions and 9 deletions

View File

@@ -1108,7 +1108,7 @@ static uint ShowAdditionalText(int left, int right, int y, EngineID engine)
void TestedEngineDetails::FillDefaultCapacities(const Engine *e)
{
this->cargo = e->GetDefaultCargoType();
if (e->type == VEH_TRAIN || e->type == VEH_ROAD) {
if (e->type == VEH_TRAIN || e->type == VEH_ROAD || e->type == VEH_SHIP) {
this->all_capacities = GetCapacityOfArticulatedParts(e->index);
this->capacity = this->all_capacities[this->cargo];
this->mail_capacity = 0;
@@ -1617,7 +1617,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase {
}
/* Purchase test was not possible or failed, fill in the defaults instead. */
this->te.cost = 0;
this->te = {};
this->te.FillDefaultCapacities(e);
}
@@ -2524,7 +2524,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
}
/* Purchase test was not possible or failed, fill in the defaults instead. */
state.te.cost = 0;
state.te = {};
state.te.FillDefaultCapacities(e);
}