17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-09 00:17:39 +01:00

fix: the bugs and vulnerabilities SonarCloud reports on PR #216

This commit is contained in:
2026-11-07 22:11:08 +01:00
parent 8e85def98f
commit 7667e5b2ec
65 changed files with 910 additions and 121 deletions

View File

@@ -2185,8 +2185,12 @@ bool editor_mode::plan_curved_slip(editor_track::switch_template const &Shape, i
Plan.snapped.clear();
// bent with a curve as sharp as its slip curves, the outer one would turn the other way
double sharpest{0.0};
for (auto s{middle - half}; s <= middle + half + 1e-9; s += 0.5)
auto s{middle - half};
while (s <= middle + half + 1e-9)
{
sharpest = std::max(sharpest, std::abs(switch_curve::curvature_at(points, s)));
s += 0.5;
}
if (sharpest * curve.radius > 1.0 - 1e-6)
{
Plan.problem = format(STR_C("The curve of R %.0f m is as sharp as the slip curves of R %.0f m or sharper, the slip isn't bent into it"), 1.0 / sharpest, curve.radius);