mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 13:06:46 +01:00
Merge feat/editor-turnout-catalogue into feat/editor-model-in-editor
This commit is contained in:
@@ -652,7 +652,7 @@ void editor_mode::ground_sources(editor_orthophoto &Layer)
|
||||
return true;
|
||||
// asked for, the tile goes onto it once it comes; not where no terrain is to be made of the model, as after the answer without
|
||||
// terrain
|
||||
if (m_nmt.placed() && (m_nmt_state.grow || EditorSettings.terrain_model().area))
|
||||
if (m_nmt.placed() && (m_nmt_state.grow || nmt_area()))
|
||||
m_nmt.request({X - 1.0, Z - 1.0}, {X + 1.0, Z + 1.0});
|
||||
return false;
|
||||
});
|
||||
@@ -1904,9 +1904,13 @@ void editor_mode::render_terrain_loading()
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("%s", STR_C("Where the terrain of the scenery ends, the terrain model is made under the tracks as they're laid, around the cursor from the first point placed; "
|
||||
"the chunks there are stay as they are. Off, it's made only when asked for"));
|
||||
auto &model{EditorSettings.terrain_model()};
|
||||
if (ImGui::Checkbox(STR_C("The terrain of the scenery around the camera"), &model.area))
|
||||
// as it is for the scenery open: off after the answer Without terrain, and ticked, on again and kept so in the settings
|
||||
if (bool area{nmt_area()}; ImGui::Checkbox(STR_C("The terrain of the scenery around the camera"), &area))
|
||||
{
|
||||
m_nmt_state.declined = false;
|
||||
EditorSettings.terrain_model().area = area;
|
||||
EditorSettings.save();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("%s", STR_C("Makes the terrain from the terrain model within the area, around the camera wherever it goes,\n"
|
||||
"a chunk at a time while the editor is idle. The terrain there is already isn't touched.\n"
|
||||
@@ -6431,7 +6435,7 @@ void editor_mode::render_ground_warning(tutorial_lesson const &Lesson)
|
||||
// over a panel the pointer is over no ground, and in a scenery laid without terrain no ground is to be there
|
||||
if (Lesson.action != tutorial_lesson::trial::lay || ui()->mode() != nodebank_panel::TRACK || ImGui::GetIO().WantCaptureMouse || false == ImGui::IsMousePosValid())
|
||||
return;
|
||||
auto const expected{m_streamer.resident() > 0 || ((m_nmt_state.grow || EditorSettings.terrain_model().area) && m_nmt.placed())};
|
||||
auto const expected{m_streamer.resident() > 0 || ((m_nmt_state.grow || nmt_area()) && m_nmt.placed())};
|
||||
if (expected && false == GfxRenderer->Mouse_Hit())
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.7f, 0.2f, 1.0f), "%s", STR_C("There is no ground under the mouse: the track will lie flat at height 0. Terrain model: F5"));
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "world/Sweep.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
#include <chrono>
|
||||
@@ -394,6 +395,9 @@ class editor_mode : public application_mode, private editor_track::observer, pri
|
||||
double band{300.0}; // m from the tracks the chunks made along them reach
|
||||
bool shape{true}; // the formation and the slopes of the tracks as modifiers of the terrain
|
||||
bool grow{true}; // while a track is laid, the terrain is made around the cursor where there's none
|
||||
// the answer Without terrain for the scenery open: nothing of the model is made around the camera by itself, whatever the
|
||||
// settings, which stay as they were for the other sceneries
|
||||
bool declined{false};
|
||||
bool laying{false}; // the tracks committed are being laid: they leave the terrain as it is
|
||||
bool follow{true}; // a track with its formation edited takes it along, the formation led anew
|
||||
bool grown{false}; // the chunks waiting were all asked for by growing: the formations aren't made anew after them
|
||||
@@ -665,8 +669,10 @@ class editor_mode : public application_mode, private editor_track::observer, pri
|
||||
void nmt_place_scenery(glm::dvec2 const &Point);
|
||||
void nmt_accept_offer();
|
||||
// the answer without terrain: the tracks lie on the plane, nothing of the terrain model is loaded by itself any more, under the
|
||||
// tracks laid nor around the camera
|
||||
// tracks laid nor around the camera, in the scenery open; the settings stay as they are for the other sceneries
|
||||
void nmt_decline_offer();
|
||||
// the terrain of the download area made around the camera by itself: as the settings have it, unless declined for this scenery
|
||||
bool nmt_area() const;
|
||||
// the whole scenery: tracks, includes and models, moved up or down as one undo step
|
||||
std::size_t nmt_join_ends();
|
||||
// the turntables as they lie, each with the ends of the tracks running up to it on its rim
|
||||
@@ -1145,6 +1151,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri
|
||||
// false, with the reason, when one of the paths can't be changed, its file not taking the changes back
|
||||
static bool tracks_editable(std::vector<TTrack *> const &Tracks, std::string &Reason);
|
||||
void trim_history();
|
||||
// the serial of the step on top of the history, 0 with none
|
||||
std::uint64_t history_top() const;
|
||||
void restore_track_snapshot(EditorSnapshot const &Snapshot, std::vector<EditorSnapshot> &Opposite, bool const Undo);
|
||||
// changes of the kept alignments and switches go into the last step of the history, made just before them
|
||||
void records_to_history();
|
||||
@@ -1924,9 +1932,10 @@ class editor_mode : public application_mode, private editor_track::observer, pri
|
||||
bool settings_open{false};
|
||||
bool details_open{false};
|
||||
bool notes_open{false};
|
||||
// the status tells of a line laid just now, as long as the history stays at the step it was laid with
|
||||
// the status tells of a line laid just now, as long as the history stays at the step it was laid with: the serial of the step on
|
||||
// top then, not the size of the history, which an undo and another step make the same again
|
||||
bool laid_now{false};
|
||||
std::size_t laid_step{0};
|
||||
std::uint64_t laid_step{0};
|
||||
// the line laid last, told in the inspector while the last of its tracks stays the selection the laying left
|
||||
struct laid_curve
|
||||
{
|
||||
@@ -3327,7 +3336,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri
|
||||
std::string badge; // the mouse or the keys drawn over the view, for the clips of the tutorial
|
||||
glm::vec2 badge_at{0.0f}; // its bottom left corner, in the pixels of the window
|
||||
std::map<std::string, double> marks; // the heights of the ends of tracks kept by mark, for expect lift
|
||||
std::optional<std::pair<bool, bool>> terrain_kept; // the terrain made while laying and around the camera before nmtquestion
|
||||
std::optional<std::pair<bool, bool>> terrain_kept; // the terrain made while laying, and the answer without it, before nmtquestion
|
||||
};
|
||||
selftest m_selftest;
|
||||
using selftest_result = editor_selftest_result;
|
||||
|
||||
@@ -2178,7 +2178,7 @@ void editor_mode::lay_finish(editor_track::snap_target const &End)
|
||||
tool.points.clear();
|
||||
tool.modes.clear();
|
||||
tool.start = {};
|
||||
tool.laid_step = m_history.size();
|
||||
tool.laid_step = history_top();
|
||||
straight_refresh();
|
||||
}
|
||||
|
||||
@@ -2189,7 +2189,7 @@ void editor_mode::lay_told(double const Length, std::size_t const Tracks)
|
||||
tool.status_time = ImGui::GetTime();
|
||||
tool.laid_now = true;
|
||||
tool.notes_open = false;
|
||||
tool.laid_step = m_history.size();
|
||||
tool.laid_step = history_top();
|
||||
}
|
||||
|
||||
void editor_mode::lay_enter()
|
||||
@@ -2389,13 +2389,18 @@ alignment::limits editor_mode::laying_norms() const
|
||||
return norms;
|
||||
}
|
||||
|
||||
std::uint64_t editor_mode::history_top() const
|
||||
{
|
||||
return m_history.empty() ? 0 : m_history.back().serial;
|
||||
}
|
||||
|
||||
editor_mode::lay_state editor_mode::lay_panel_state() const
|
||||
{
|
||||
if (m_extend.active)
|
||||
return lay_state::extending;
|
||||
if (false == m_lay.points.empty())
|
||||
return lay_state::clicking;
|
||||
if (m_lay.laid_now && m_lay.laid_step == m_history.size())
|
||||
if (m_lay.laid_now && m_lay.laid_step == history_top())
|
||||
return lay_state::laid;
|
||||
return lay_state::ready;
|
||||
}
|
||||
|
||||
@@ -1085,7 +1085,7 @@ void editor_mode::nmt_area_terrain()
|
||||
WriteLog(std::string{"Editor: NMT - the terrain of the download area "} + (*Reason != '\0' ? std::string{"held: "} + Reason : std::string{"goes on"}), logtype::generic);
|
||||
}
|
||||
};
|
||||
if (false == area.run_only.value_or(EditorSettings.terrain_model().area))
|
||||
if (false == area.run_only.value_or(nmt_area()))
|
||||
return held("turned off");
|
||||
if (m_orthophoto.area().empty())
|
||||
return held("no area");
|
||||
@@ -1217,7 +1217,7 @@ void editor_mode::nmt_update()
|
||||
m_nmt_prefetched = wanted;
|
||||
// unless no terrain is made of the model by itself, as after the answer without terrain: what the terrain panel asks for then is
|
||||
// downloaded as it's asked for
|
||||
if (state.grow || EditorSettings.terrain_model().area)
|
||||
if (state.grow || nmt_area())
|
||||
m_nmt.prefetch(wanted);
|
||||
// the terrain around the camera looked at again within the new area
|
||||
m_area_terrain.listed = false;
|
||||
@@ -2142,13 +2142,18 @@ void editor_mode::render_download_area_ui(editor_orthophoto::statistics const &S
|
||||
}
|
||||
}
|
||||
auto &model{EditorSettings.terrain_model()};
|
||||
if (ImGui::Checkbox(STR_C("The terrain of the scenery around the camera"), &model.area))
|
||||
// as it is for the scenery open: off after the answer Without terrain, and ticked, on again and kept so in the settings
|
||||
if (bool area{nmt_area()}; ImGui::Checkbox(STR_C("The terrain of the scenery around the camera"), &area))
|
||||
{
|
||||
m_nmt_state.declined = false;
|
||||
model.area = area;
|
||||
EditorSettings.save();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("%s", STR_C("Makes the terrain from the terrain model within the area, around the camera wherever it goes,\n"
|
||||
"a chunk at a time while the editor is idle. The terrain there is already isn't touched.\n"
|
||||
"The chunks made wait in memory until the scenery is saved (Ctrl+S)."));
|
||||
if (model.area && m_area_terrain.made > 0)
|
||||
if (nmt_area() && m_area_terrain.made > 0)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("%s", format(STR_P("%zu chunk made", "%zu chunks made", m_area_terrain.made), m_area_terrain.made).c_str());
|
||||
@@ -2598,9 +2603,10 @@ void editor_mode::nmt_accept_offer()
|
||||
state.offset = 0.0;
|
||||
nmt_make(nmt_keys_around());
|
||||
state.prompt = false;
|
||||
// the terrain goes on under the tracks as they're laid and around the camera, as the answer says, also after the other answer was
|
||||
// given for a scenery before; the model of the download area is put into the cache again if that answer stopped it
|
||||
// the terrain goes on under the tracks as they're laid and around the camera, as the answer says, also where the settings had it
|
||||
// off; the model of the download area is put into the cache again if it was stopped
|
||||
state.grow = true;
|
||||
state.declined = false;
|
||||
EditorSettings.terrain_while_laying(true);
|
||||
EditorSettings.terrain_model().area = true;
|
||||
EditorSettings.save();
|
||||
@@ -2614,16 +2620,20 @@ void editor_mode::nmt_decline_offer()
|
||||
state.prompt = false;
|
||||
// nothing of the model loaded any more: not under the tracks as they're laid, as the checkbox of the layers turns it off, nor around
|
||||
// the camera within the download area, as the checkbox of the terrain panel does, nor the squares of the download area into the
|
||||
// cache. Kept on, they went on being loaded, and where there's no network their requests failed in the log
|
||||
// cache. Kept on, they went on being loaded, and where there's no network their requests failed in the log. For this scenery only:
|
||||
// the settings stay as they were, for the sceneries opened later
|
||||
state.grow = false;
|
||||
EditorSettings.terrain_while_laying(false);
|
||||
EditorSettings.terrain_model().area = false;
|
||||
EditorSettings.save();
|
||||
state.declined = true;
|
||||
m_nmt.prefetch({});
|
||||
// nor the squares asked for meanwhile, as the aerial photos asked for them to lie on
|
||||
m_nmt.cancel();
|
||||
}
|
||||
|
||||
bool editor_mode::nmt_area() const
|
||||
{
|
||||
return false == m_nmt_state.declined && EditorSettings.terrain_model().area;
|
||||
}
|
||||
|
||||
void editor_mode::render_nmt_prompt()
|
||||
{
|
||||
auto &state{m_nmt_state};
|
||||
|
||||
@@ -212,8 +212,24 @@ void norms_tool::forget(scene::basic_node const *Node)
|
||||
state.selected = -1;
|
||||
for (auto &line : state.lines)
|
||||
std::erase_if(line.entries, [Node](norms_report::entry const &Entry) { return Entry.track == Node; });
|
||||
for (auto &line : state.queue)
|
||||
std::erase_if(line.spans, [Node](norms_report::span const &Span) { return Span.track == Node; });
|
||||
// the span whose findings alone are kept moves down by the spans taken out before it; a line whose own span went has nothing left
|
||||
// to report
|
||||
auto const gone = [Node](norms_report::span const &Span) { return Span.track == Node; };
|
||||
auto line{state.queue.begin()};
|
||||
while (line != state.queue.end())
|
||||
{
|
||||
if (line->own >= 0 && line->own < static_cast<int>(line->spans.size()))
|
||||
{
|
||||
if (gone(line->spans[line->own]))
|
||||
{
|
||||
line = state.queue.erase(line);
|
||||
continue;
|
||||
}
|
||||
line->own -= static_cast<int>(std::count_if(line->spans.begin(), line->spans.begin() + line->own, gone));
|
||||
}
|
||||
std::erase_if(line->spans, gone);
|
||||
++line;
|
||||
}
|
||||
}
|
||||
|
||||
void norms_tool::render_class()
|
||||
|
||||
@@ -195,7 +195,7 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
|
||||
// to it out along their lines from the rim, against the model there
|
||||
// nmtstate logs how far the tracks going onto the terrain model are
|
||||
// nmtquestion <open|flat|restore> the question of the terrain of a new scenery opened, or answered without terrain as its card does;
|
||||
// restore: the settings of the terrain made by itself put back as they were before that answer
|
||||
// restore: the terrain made by itself as it was before that answer, which leaves the settings be
|
||||
// gradelines <file> the grade line each track shares written to the file, for a map of them
|
||||
// fitreport <file> to the file: the tracks off the terrain model, the switches off their plane, the rails on common timbers apart in height
|
||||
// gradeline <lift m|off|on|whole 0/1|state> the common grade line of the route open in the profile tool: its design lifted and applied, the route taken off it and back
|
||||
@@ -226,6 +226,7 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
|
||||
// expect joint <track> <start|end> <gap m> <angle deg> <cant step mm> the end of the first path against the end of another track
|
||||
// nearest to it within 1 m: the gap, the kink and the step of the cant between them, each at most
|
||||
// expect records <name> <count> [kind] the records of the switch store of the name, with the connections having the switch among theirs
|
||||
// expect shaped <switch> <yes|no> the switch keeps the shape its record says, or was bent out of it
|
||||
// expect speed <track> <km/h> [tolerance], expect gauge <track> <m> [tolerance] as editor_track::velocity gives it / the gauge
|
||||
// expect track <name> <present|removed>
|
||||
// expect route <track> <in|out> the track is a part of the line open in the route tool, or not
|
||||
@@ -274,8 +275,13 @@ void editor_mode::selftest_step()
|
||||
std::ifstream stream(file);
|
||||
std::string line;
|
||||
while (std::getline(stream, line))
|
||||
if (false == line.empty() && line.front() != '#')
|
||||
test.lines.push_back(line);
|
||||
{
|
||||
// an indented comment or a line of blanks is no command either
|
||||
auto const first{line.find_first_not_of(" \t\r")};
|
||||
if (first == std::string::npos || line[first] == '#')
|
||||
continue;
|
||||
test.lines.push_back(line.substr(first));
|
||||
}
|
||||
WriteLog("SELFTEST: " + std::to_string(test.lines.size()) + " steps from " + file);
|
||||
}
|
||||
++editor_selftest::frames();
|
||||
|
||||
@@ -51,6 +51,13 @@ inline std::size_t &failures()
|
||||
return count;
|
||||
}
|
||||
|
||||
// a command whose subject isn't there, a track name mistyped, fails the run as an expectation does
|
||||
inline void fail()
|
||||
{
|
||||
++expectations();
|
||||
++failures();
|
||||
}
|
||||
|
||||
// apart from the 1 of a start which failed or of an error which ended the editor
|
||||
inline constexpr int failed_exit_code{2};
|
||||
|
||||
|
||||
@@ -189,6 +189,24 @@ void expect_records(std::string const &What, std::istringstream &Words)
|
||||
expectation(count == wanted, What, std::to_string(count), std::to_string(wanted));
|
||||
}
|
||||
|
||||
// expect shaped <switch> <yes|no>: the switch keeps the shape its record says, or was bent out of it
|
||||
void expect_shaped(std::string const &What, std::istringstream &Words)
|
||||
{
|
||||
std::string name;
|
||||
std::string wanted;
|
||||
Words >> name >> wanted;
|
||||
if (malformed(What, Words))
|
||||
return;
|
||||
auto const *track{simulation::Paths.find(name)};
|
||||
if (track == nullptr || track->m_editorremoved)
|
||||
{
|
||||
expectation(false, What, "no track " + name, "a switch");
|
||||
return;
|
||||
}
|
||||
auto const shaped{switch_store::of(*track).has_value()};
|
||||
expectation(shaped == (wanted == "yes"), What, shaped ? "yes" : "no", wanted);
|
||||
}
|
||||
|
||||
// expect speed <track> <km/h> [tolerance], expect gauge <track> <m> [tolerance]
|
||||
void expect_track_value(std::string const &What, std::string const &Kind, std::istringstream &Words)
|
||||
{
|
||||
@@ -564,6 +582,8 @@ editor_mode::selftest_result editor_mode::selftest_expect(std::string const &com
|
||||
expect_joint(what, words, &editor_mode::cant_of_roll);
|
||||
else if (kind == "records")
|
||||
expect_records(what, words);
|
||||
else if (kind == "shaped")
|
||||
expect_shaped(what, words);
|
||||
else if (kind == "speed" || kind == "gauge")
|
||||
expect_track_value(what, kind, words);
|
||||
else if (kind == "track")
|
||||
@@ -585,14 +605,14 @@ editor_mode::selftest_result editor_mode::selftest_expect(std::string const &com
|
||||
else
|
||||
{
|
||||
shown_state shown{m_switch.status, ui()->refusal_shown(), ui()->status_line(), m_lay.mouse,
|
||||
{{"grow", m_nmt_state.grow}, {"area", EditorSettings.terrain_model().area}, {"prompt", m_nmt_state.prompt}}, tool_name(ui()->mode()),
|
||||
{{"grow", m_nmt_state.grow}, {"area", nmt_area()}, {"prompt", m_nmt_state.prompt}}, tool_name(ui()->mode()),
|
||||
{{"shortcuts", m_shortcuts_open}, {"settings", m_settings_open}, {"weather", m_environment_open}, {"orthophoto", m_orthophoto_window}}, std::nullopt,
|
||||
shown_lay_panel(), shown_switch_panel()};
|
||||
if (m_node != nullptr)
|
||||
shown.selected = m_node->location();
|
||||
if (false == expect_shown(kind, what, words, shown))
|
||||
expectation(false, what, "no expectation " + kind,
|
||||
"cant, joint, records, speed, gauge, track, route, norms, findings, height, lift, includes, status, statuslacks, refusal, statusline, laycursor, terrain, tool, window, "
|
||||
"cant, joint, records, shaped, speed, gauge, track, route, norms, findings, height, lift, includes, status, statuslacks, refusal, statusline, laycursor, terrain, tool, window, "
|
||||
"selected, laypanel, switchpanel or steps");
|
||||
}
|
||||
return selftest_result::handled;
|
||||
|
||||
@@ -513,26 +513,31 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co
|
||||
if (command == "nmtquestion")
|
||||
{
|
||||
// the question of the terrain of a new scenery: open, as the first L in an empty scenery opens it, or answered without
|
||||
// terrain, as its card does it; restore: the settings of the terrain made by itself as they were before the answer, which
|
||||
// keeps them with the editor
|
||||
// terrain, as its card does it; restore: the terrain made by itself as it was before the answer. The answer keeps to the
|
||||
// scenery open, so the settings of the tester aren't written
|
||||
std::string answer;
|
||||
words >> answer;
|
||||
auto &model{EditorSettings.terrain_model()};
|
||||
auto const &model{EditorSettings.terrain_model()};
|
||||
if (answer == "open")
|
||||
m_nmt_state.prompt = true;
|
||||
else if (answer == "flat")
|
||||
{
|
||||
m_selftest.terrain_kept = std::pair{m_nmt_state.grow, model.area};
|
||||
auto const kept{std::pair{EditorSettings.terrain_while_laying(), model.area}};
|
||||
m_selftest.terrain_kept = std::pair{m_nmt_state.grow, m_nmt_state.declined};
|
||||
nmt_decline_offer();
|
||||
// the settings as they were: the answer is for this scenery alone
|
||||
if (std::pair{EditorSettings.terrain_while_laying(), model.area} != kept)
|
||||
{
|
||||
editor_selftest::fail();
|
||||
WriteLog("SELFTEST FAIL nmtquestion flat: the settings of the terrain changed");
|
||||
}
|
||||
}
|
||||
else if (answer == "restore" && m_selftest.terrain_kept.has_value())
|
||||
{
|
||||
m_nmt_state.grow = m_selftest.terrain_kept->first;
|
||||
model.area = m_selftest.terrain_kept->second;
|
||||
EditorSettings.terrain_while_laying(m_nmt_state.grow);
|
||||
EditorSettings.save();
|
||||
m_nmt_state.declined = m_selftest.terrain_kept->second;
|
||||
}
|
||||
WriteLog(format("SELFTEST nmtquestion %s: prompt %d, terrain while laying %d, around the camera %d", answer.c_str(), m_nmt_state.prompt ? 1 : 0, m_nmt_state.grow ? 1 : 0, model.area ? 1 : 0));
|
||||
WriteLog(format("SELFTEST nmtquestion %s: prompt %d, terrain while laying %d, around the camera %d", answer.c_str(), m_nmt_state.prompt ? 1 : 0, m_nmt_state.grow ? 1 : 0, nmt_area() ? 1 : 0));
|
||||
return selftest_result::handled;
|
||||
}
|
||||
if (command == "nmtgrow")
|
||||
|
||||
@@ -404,8 +404,15 @@ editor_mode::selftest_result editor_mode::selftest_track(std::string const &comm
|
||||
double gauge{1500.0};
|
||||
std::string name;
|
||||
words >> gauge >> name;
|
||||
auto *track{name.empty() ? nullptr : simulation::Paths.find(name)};
|
||||
if (false == name.empty() && (track == nullptr || track->m_editorremoved))
|
||||
{
|
||||
editor_selftest::fail();
|
||||
WriteLog("SELFTEST FAIL routegauge: no track " + name);
|
||||
return selftest_result::handled;
|
||||
}
|
||||
// the line of the track opened in the route tool, as a click on it with the tool does, unless it's in the line open already
|
||||
if (auto *track{simulation::Paths.find(name)}; track != nullptr && false == track->m_editorremoved && std::ranges::find(m_route.chain.tracks, track) == m_route.chain.tracks.end())
|
||||
if (track != nullptr && std::ranges::find(m_route.chain.tracks, track) == m_route.chain.tracks.end())
|
||||
{
|
||||
m_track_tab = track_tab::route;
|
||||
m_route.single = false;
|
||||
@@ -426,7 +433,8 @@ editor_mode::selftest_result editor_mode::selftest_track(std::string const &comm
|
||||
std::string reason;
|
||||
if (track == nullptr || track->m_editorremoved || index < 0 || index >= static_cast<int>(track->m_paths.size()) || false == editor_track::can_edit_geometry(*track, reason))
|
||||
{
|
||||
WriteLog("SELFTEST trackcant: no path " + name + " " + std::to_string(index) + " to edit " + reason);
|
||||
editor_selftest::fail();
|
||||
WriteLog("SELFTEST FAIL trackcant: no path " + name + " " + std::to_string(index) + " to edit " + reason);
|
||||
return selftest_result::handled;
|
||||
}
|
||||
// as the field of the inspector takes it: the rolls of the path set, then the edit committed with the track as it was before
|
||||
|
||||
@@ -15,6 +15,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "stdafx.h"
|
||||
#include "application/editormode.h"
|
||||
#include "application/editoruilayer.h"
|
||||
#include "application/editormodeselftest.h"
|
||||
#include "application/editormodeshared.h"
|
||||
#include "editor/editorFormat.hpp"
|
||||
#include "editor/editorGeometry.hpp"
|
||||
@@ -2126,8 +2127,15 @@ editor_mode::selftest_result editor_mode::selftest_props(std::string const &Comm
|
||||
// the set made of the tracks, also of one, and the last of them selected, as the set stays the selection only with it
|
||||
m_track_set.clear();
|
||||
for (std::string name; Words >> name;)
|
||||
{
|
||||
if (auto *track{simulation::Paths.find(name)}; track != nullptr && false == track->m_editorremoved)
|
||||
{
|
||||
m_track_set.push_back(track);
|
||||
continue;
|
||||
}
|
||||
editor_selftest::fail();
|
||||
WriteLog("SELFTEST FAIL tracksetdelete: no track " + name);
|
||||
}
|
||||
m_node = m_track_set.empty() ? nullptr : m_track_set.back();
|
||||
m_track_point = {};
|
||||
ui()->set_node(m_node);
|
||||
|
||||
Reference in New Issue
Block a user