Fix: Require non-zero capacity for refit cargo type

This commit is contained in:
Yourself
2022-01-06 15:42:22 -07:00
parent 0ffa1b1db6
commit aa7413a89f

View File

@@ -6999,7 +6999,7 @@ CommandCost CmdTemplateReplaceVehicle(TileIndex tile, DoCommandFlag flags, uint3
// if a train shall keep its old refit, store the refit setting of its first vehicle // if a train shall keep its old refit, store the refit setting of its first vehicle
if (!use_refit) { if (!use_refit) {
for (Train *getc = incoming; getc != nullptr; getc = getc->GetNextUnit()) { for (Train *getc = incoming; getc != nullptr; getc = getc->GetNextUnit()) {
if (getc->cargo_type != CT_INVALID) { if (getc->cargo_type != CT_INVALID && getc->cargo_cap > 0) {
store_refit_ct = getc->cargo_type; store_refit_ct = getc->cargo_type;
break; break;
} }