mirror of https://github.com/OpenTTD/OpenTTD
(svn r27584) -Codechange: Add some assertions about Vehicle::cargo_payment.
parent
7d4754a4f8
commit
dac94c7cbc
|
@ -1651,6 +1651,7 @@ static void LoadUnloadVehicle(Vehicle *front)
|
||||||
uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
|
uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
|
||||||
bool remaining = false; // Are there cargo entities in this vehicle that can still be unloaded here?
|
bool remaining = false; // Are there cargo entities in this vehicle that can still be unloaded here?
|
||||||
|
|
||||||
|
assert(payment != NULL);
|
||||||
payment->SetCargo(v->cargo_type);
|
payment->SetCargo(v->cargo_type);
|
||||||
|
|
||||||
if (!HasBit(ge->status, GoodsEntry::GES_ACCEPTANCE) && v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER) > 0) {
|
if (!HasBit(ge->status, GoodsEntry::GES_ACCEPTANCE) && v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER) > 0) {
|
||||||
|
|
|
@ -216,7 +216,7 @@ uint Vehicle::Crash(bool flooded)
|
||||||
SetWindowDirty(WC_VEHICLE_DEPOT, this->tile);
|
SetWindowDirty(WC_VEHICLE_DEPOT, this->tile);
|
||||||
|
|
||||||
delete this->cargo_payment;
|
delete this->cargo_payment;
|
||||||
this->cargo_payment = NULL;
|
assert(this->cargo_payment == NULL); // cleared by ~CargoPayment
|
||||||
|
|
||||||
return RandomRange(pass + 1); // Randomise deceased passengers.
|
return RandomRange(pass + 1); // Randomise deceased passengers.
|
||||||
}
|
}
|
||||||
|
@ -746,6 +746,7 @@ void Vehicle::PreDestructor()
|
||||||
HideFillingPercent(&this->fill_percent_te_id);
|
HideFillingPercent(&this->fill_percent_te_id);
|
||||||
this->CancelReservation(INVALID_STATION, st);
|
this->CancelReservation(INVALID_STATION, st);
|
||||||
delete this->cargo_payment;
|
delete this->cargo_payment;
|
||||||
|
assert(this->cargo_payment == NULL); // cleared by ~CargoPayment
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->IsEngineCountable()) {
|
if (this->IsEngineCountable()) {
|
||||||
|
@ -2085,6 +2086,7 @@ void Vehicle::LeaveStation()
|
||||||
assert(this->current_order.IsType(OT_LOADING));
|
assert(this->current_order.IsType(OT_LOADING));
|
||||||
|
|
||||||
delete this->cargo_payment;
|
delete this->cargo_payment;
|
||||||
|
assert(this->cargo_payment == NULL); // cleared by ~CargoPayment
|
||||||
|
|
||||||
/* Only update the timetable if the vehicle was supposed to stop here. */
|
/* Only update the timetable if the vehicle was supposed to stop here. */
|
||||||
if (this->current_order.GetNonStopType() != ONSF_STOP_EVERYWHERE) UpdateVehicleTimetable(this, false);
|
if (this->current_order.GetNonStopType() != ONSF_STOP_EVERYWHERE) UpdateVehicleTimetable(this, false);
|
||||||
|
|
Loading…
Reference in New Issue