From 8375891c41558fc623cdf69db192e996d738e30b Mon Sep 17 00:00:00 2001 From: maj00r Date: Sat, 24 Oct 2026 02:19:06 +0200 Subject: [PATCH] feat(editor): the selftest fastentour, the camera over each cell of a grid with switches or crossings laying timbers in turn, for a fastencheck of the whole scenery after it --- application/editormodeselftest.cpp | 1 + application/editormodeselftestsleepers.cpp | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/application/editormodeselftest.cpp b/application/editormodeselftest.cpp index cb8095d4..9aa32171 100644 --- a/application/editormodeselftest.cpp +++ b/application/editormodeselftest.cpp @@ -68,6 +68,7 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c // railtime lays out the rails of every track, as when its geometry is made, and logs how long it took // throw <0|1> sets every switch to the path and moves its blades there at once // crossings [name] logs where rails of tracks cross rails of other tracks and of what kind (acute, obtuse, middle acute or obtuse, wide), checks that each acute crossing has one partner and one nose +// fastentour [cell] [frames] the camera over each cell of the grid with switches laying timbers in turn, for a fastencheck after of the whole scenery // switchtimbers the model of the timbers set on all the switches and crossings, as the buttons of the switch tool do it // frogkey name [on|off] sets or clears the frogs key of a switch (one undo step); logs the key, whether it is written, the frog and the crossings // geomhash [name] logs the number of vertices and a hash of the drawn geometry of each rail track (rails, trackbed, cut faces), to compare builds; exact: the bits of every value, userdata and tread materials too diff --git a/application/editormodeselftestsleepers.cpp b/application/editormodeselftestsleepers.cpp index 2188df66..d8e1e7b1 100644 --- a/application/editormodeselftestsleepers.cpp +++ b/application/editormodeselftestsleepers.cpp @@ -198,6 +198,32 @@ editor_mode::selftest_result editor_mode::selftest_sleepers(std::string const &c WriteLog(format("SELFTEST fastenings %s: %d plates, %d chairs, %d checks", track->name().c_str(), counts[track_sleepers::part_plate], counts[track_sleepers::part_chair], counts[track_sleepers::part_check])); return selftest_result::handled; } + if (command == "fastentour") + { + // the camera over each cell of the grid with switches or crossings laying timbers, in turn, as the tracks get their beams only + // near it: the steps of the tour go in after this one, a fastencheck after them takes the whole scenery + double cell{400.0}; + int frames{40}; + words >> cell >> frames; + std::map, glm::dvec3> stops; + for (auto *track : simulation::Paths.sequence()) + { + if (track == nullptr || track->m_editorremoved || (track->eType != tt_Switch && track->m_crossings.empty()) || false == track_sleepers::lays(*track)) + continue; + auto const at{track->location()}; + stops.emplace(std::make_pair(std::lround(std::floor(at.x / cell)), std::lround(std::floor(at.z / cell))), at); + } + std::vector steps; + for (auto const &stop : stops) + { + auto const &at{stop.second}; + steps.push_back(format("camera %.2f %.2f %.2f %.2f %.2f %.2f", at.x, at.y + 60.0, at.z + 1.0, at.x, at.y, at.z)); + steps.push_back("wait " + std::to_string(frames)); + } + m_selftest.lines.insert(m_selftest.lines.begin() + static_cast(m_selftest.next), steps.begin(), steps.end()); + WriteLog(format("SELFTEST fastentour: %zu stops of %.0f m", stops.size(), cell)); + return selftest_result::handled; + } if (command == "fastencheck") { // the fastenings of all the tracks laying timbers with them: of each kind, and those over one another on a timber