mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-13 07:10:57 +00:00
Reduce sensitivity of train overheated breakdown
This commit is contained in:
parent
5d88030feb
commit
d484c32d44
@ -1084,6 +1084,9 @@ static bool TrainAccelerationModelChanged(int32 p1)
|
||||
static bool TrainBrakingModelChanged(int32 p1)
|
||||
{
|
||||
for (Train *t : Train::Iterate()) {
|
||||
if (!(t->vehstatus & VS_CRASHED)) {
|
||||
t->crash_anim_pos = 0;
|
||||
}
|
||||
if (t->IsFrontEngine()) {
|
||||
t->UpdateAcceleration();
|
||||
}
|
||||
|
@ -163,6 +163,13 @@ class NIHVehicle : public NIHelper {
|
||||
seprintf(buffer, lastof(buffer), " Railtype: %u, compatible_railtypes: 0x" OTTD_PRINTFHEX64,
|
||||
t->railtype, t->compatible_railtypes);
|
||||
print(buffer);
|
||||
if (t->vehstatus & VS_CRASHED) {
|
||||
seprintf(buffer, lastof(buffer), " CRASHED: anim pos: %u", t->crash_anim_pos);
|
||||
print(buffer);
|
||||
} else if (t->crash_anim_pos > 0) {
|
||||
seprintf(buffer, lastof(buffer), " Brake heating: %u", t->crash_anim_pos);
|
||||
print(buffer);
|
||||
}
|
||||
if (t->lookahead != nullptr) {
|
||||
print (" Look ahead:");
|
||||
const TrainReservationLookAhead &l = *t->lookahead;
|
||||
|
@ -120,7 +120,7 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
|
||||
|
||||
uint32 flags;
|
||||
|
||||
uint16 crash_anim_pos; ///< Crash animation counter.
|
||||
uint16 crash_anim_pos; ///< Crash animation counter, also used for realistic braking train brake overheating
|
||||
|
||||
TrackBits track;
|
||||
TrainForceProceeding force_proceed;
|
||||
|
@ -5959,6 +5959,9 @@ static bool TrainLocoHandler(Train *v, bool mode)
|
||||
/* train has crashed? */
|
||||
if (v->vehstatus & VS_CRASHED) {
|
||||
return mode ? true : HandleCrashedTrain(v); // 'this' can be deleted here
|
||||
} else if (v->crash_anim_pos > 0) {
|
||||
/* Reduce realistic braking brake overheating */
|
||||
v->crash_anim_pos--;
|
||||
}
|
||||
|
||||
if (v->force_proceed != TFP_NONE) {
|
||||
@ -6794,7 +6797,11 @@ void TrainRoadVehicleCrashBreakdown(Vehicle *v)
|
||||
void TrainBrakesOverheatedBreakdown(Vehicle *v)
|
||||
{
|
||||
Train *t = Train::From(v)->First();
|
||||
if (t->breakdown_ctr != 0) return;
|
||||
if (t->breakdown_ctr != 0 || (t->vehstatus & VS_CRASHED)) return;
|
||||
|
||||
t->crash_anim_pos = std::min<uint>(1500, t->crash_anim_pos + 200);
|
||||
if (t->crash_anim_pos < 1500) return;
|
||||
|
||||
t->breakdown_ctr = 2;
|
||||
SetBit(t->flags, VRF_CONSIST_BREAKDOWN);
|
||||
t->breakdown_delay = 255;
|
||||
|
@ -2334,6 +2334,9 @@ void VehicleEnterDepot(Vehicle *v)
|
||||
t->ConsistChanged(CCF_ARRANGE);
|
||||
t->reverse_distance = 0;
|
||||
t->lookahead.reset();
|
||||
if (!(t->vehstatus & VS_CRASHED)) {
|
||||
t->crash_anim_pos = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user