Clear vehicle unit number on load for non-primary vehicles

This commit is contained in:
Jonathan G Rennison
2024-03-26 17:46:56 +00:00
parent 459e13fc5a
commit 8e9600991a

View File

@@ -572,7 +572,11 @@ void AfterLoadVehicles(bool part_of_load)
}
if (part_of_load && v->unitnumber != 0) {
Company::Get(v->owner)->freeunits[v->type].UseID(v->unitnumber);
if (v->IsPrimaryVehicle()) {
Company::Get(v->owner)->freeunits[v->type].UseID(v->unitnumber);
} else {
v->unitnumber = 0;
}
}
v->UpdateDeltaXY();