Reduce frequency of brake overheating breakdowns

Decay overheat state more quickly
Avoid double-triggering overheating
Make overheating speed-dependent
This commit is contained in:
Jonathan G Rennison
2024-05-18 20:56:58 +01:00
parent 66d03530dc
commit 3df3ed6690
2 changed files with 11 additions and 8 deletions

View File

@@ -6607,7 +6607,7 @@ static bool TrainLocoHandler(Train *v, bool mode)
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--;
v->crash_anim_pos -= (v->crash_anim_pos + 255) >> 8;
}
if (v->force_proceed != TFP_NONE) {
@@ -7565,8 +7565,9 @@ void TrainRoadVehicleCrashBreakdown(Vehicle *v)
t->reliability = 0;
}
void TrainBrakesOverheatedBreakdown(Vehicle *v)
void TrainBrakesOverheatedBreakdown(Vehicle *v, int speed, int max_speed)
{
if (v->type != VEH_TRAIN) return;
Train *t = Train::From(v)->First();
if (t->breakdown_ctr != 0 || (t->vehstatus & VS_CRASHED)) return;
@@ -7574,7 +7575,7 @@ void TrainBrakesOverheatedBreakdown(Vehicle *v)
ShowVehicleViewWindow(t);
}
t->crash_anim_pos = std::min<uint>(1500, t->crash_anim_pos + 200);
t->crash_anim_pos = std::min<uint>(1500, t->crash_anim_pos + Clamp(((speed - max_speed) * speed) / 2, 0, 500));
if (t->crash_anim_pos < 1500) return;
t->breakdown_ctr = 2;