1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 18:02:37 +01:00

Fix #13053: Payment transfers incorrect for non-passenger cargos. (#13054)

CargoPayment required cargo type to be set as state via SetCargo(). This was error prone as CargoPayment is per consist but cargo type can vary per vehicle part. Additionally if SetCargo was not called then the default "uninitialised" state was cargo slot 0, passengers.

Instead of trying to make sure it is set correctly, remove cargo type from CargoPayment and always pass it explicitly to the PayTransfer/PayFinalDelivery methods.
This commit is contained in:
Peter Nelson
2024-11-03 18:53:01 +00:00
committed by GitHub
parent cbde825785
commit a91d889646
6 changed files with 23 additions and 27 deletions

View File

@@ -107,7 +107,7 @@ bool CargoDelivery::operator()(CargoPacket *cp)
{
uint remove = this->Preprocess(cp);
this->source->RemoveFromMeta(cp, VehicleCargoList::MTA_DELIVER, remove);
this->payment->PayFinalDelivery(cp, remove, this->current_tile);
this->payment->PayFinalDelivery(this->cargo, cp, remove, this->current_tile);
return this->Postprocess(cp, remove);
}