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

refactor(editor): the trainset is a tool of its own

The fourth tool out of editor_mode. The track under the cursor and the
first steps of the tutorial become types of their own, which the editor
gives to the tools, and a tool shown as a tab of the lineside panel keeps
its open and expanded flags in a tool_tab. The trainsets waiting for the
save are handed to the editor by the tool, which hears back when they
were written. The self-test command trainset moves with it.
This commit is contained in:
maj00r
2026-10-21 09:44:17 +02:00
parent 8ba8345faf
commit c45c4713d6
11 changed files with 188 additions and 121 deletions

View File

@@ -793,7 +793,7 @@ void editor_mode::render_track_context()
if (ImGui::MenuItem(STR_C("Place a vehicle here")))
{
show_track_tab(track_tab::lineside);
vehicle_start(*track, point);
m_vehicle.start(*track, point);
}
if (ImGui::MenuItem(STR_C("Hectometre posts from here")))
{
@@ -1479,7 +1479,7 @@ void editor_mode::render_lineside_ui()
std::array<tab, 3> const tabs{{
{"Hectometre posts", &m_hekto.open, &m_hekto.expand, [this]() { render_hekto_ui(); }},
{"Fouling points", &m_fouling.open, &m_fouling.expand, [this]() { render_fouling_ui(); }},
{"Trainset", &m_vehicle.open, &m_vehicle.expand, [this]() { render_vehicle_ui(); }},
{"Trainset", &m_vehicle.tab().open, &m_vehicle.tab().expand, [this]() { m_vehicle.render_options(); }},
}};
if (selected_track() == nullptr)
ImGui::TextColored(ImVec4(1.0f, 0.8f, 0.3f, 1.0f), "%s", STR_C("LMB on a track: the line the objects go along"));