Realistic braking: Cache train overall z position

Refresh cache at a variable rate depending on train length and
weight distribution
This commit is contained in:
Jonathan G Rennison
2022-06-03 00:41:41 +01:00
parent c238bd5012
commit 99ee4b13ce
9 changed files with 57 additions and 16 deletions

View File

@@ -3418,6 +3418,7 @@ void Vehicle::LeaveStation()
}
SetBit(Train::From(this)->flags, VRF_LEAVING_STATION);
if (Train::From(this)->lookahead != nullptr) Train::From(this)->lookahead->zpos_refresh_remaining = 0;
}
if (this->type == VEH_ROAD && !(this->vehstatus & VS_CRASHED)) {
/* Trigger road stop animation */
@@ -3477,6 +3478,7 @@ void Vehicle::AdvanceLoadingInStation()
HideFillingPercent(&this->fill_percent_te_id);
this->current_order.MakeLoadingAdvance(this->last_station_visited);
this->current_order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
if (Train::From(this)->lookahead != nullptr) Train::From(this)->lookahead->zpos_refresh_remaining = 0;
this->MarkDirty();
}