17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 14:29:20 +02:00

feat(editor): every switch laid gets its drive at once, also the one made by pulling a free end into a straight (named z1, z2... like the others): the drive marked default: true in its //$e description (mech_komin) until another is picked, on the diverging side or the other; the drive goes into the same undo step as the switch; a switch with a drive puts it on the other side with one button, as one undo step; drive_headers.py marks mech_komin as the default; self-test commands drives and driveflip; Polish translation

This commit is contained in:
maj00r
2026-10-11 19:06:44 +02:00
parent 2751c085d8
commit dae97f7169
7 changed files with 141 additions and 5 deletions

View File

@@ -405,6 +405,28 @@ void editor_mode::selftest_step()
m_switch.drive_side = side;
WriteLog("SELFTEST switchdrive: " + (index >= 0 && index < static_cast<int>(m_switch.drives.size()) ? m_switch.drives[index].name : std::string{"none"}));
}
else if (command == "drives")
{
std::string name;
words >> name;
scan_switch_drives();
std::string files;
for (auto const &standing : standing_templates([](std::string const &File) { return File.find("napedy/") != std::string::npos; }))
if (false == standing.values.empty() && standing.values[0] == name)
files += " " + standing.file;
for (scene::instance_handle handle = 1; handle <= scene::Layers.instance_count(); ++handle)
if (scene::Layers.tracked(handle) && scene::Layers.instance(handle).file != nullptr && scene::Layers.instance(handle).file->find("napedy") != std::string::npos)
files += format(" [%d %s removed %d dead %d]", static_cast<int>(handle), scene::Layers.instance(handle).file->c_str(), scene::Layers.instance(handle).removed ? 1 : 0, scene::Layers.instance(handle).dead ? 1 : 0);
WriteLog("SELFTEST drives " + name + ": chosen " + (m_switch.drive >= 0 ? m_switch.drives[m_switch.drive].name : std::string{"none"}) + ", side " + std::to_string(m_switch.drive_side) + ", standing" + files + ", steps " + std::to_string(m_history.size()));
}
else if (command == "driveflip")
{
std::string name;
words >> name;
auto *track{simulation::Paths.find(name)};
auto const done{track != nullptr && flip_switch_drive(*track)};
WriteLog("SELFTEST driveflip " + name + ": " + (done ? "done " : "failed ") + m_switch.status);
}
else if (command == "drivetilt")
{
std::string name;