mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-03 01:30:16 +01:00
feat(editor): the signalling mode numbers the switches of a station along it and names them after its code, the drives and the switch records follow, and an undo of names passed round among the tracks leaves the drives right
This commit is contained in:
@@ -374,6 +374,17 @@ void editor_mode::restore_track_snapshot(EditorSnapshot const &Snapshot, std::ve
|
||||
for (auto *track : Snapshot.created)
|
||||
editor_track::revive(*track);
|
||||
}
|
||||
// names passed round among the tracks: a track whose name another one gets back gives it up first. The drives the step
|
||||
// put back have the names of their switches already
|
||||
std::vector<scene::instance_handle> restored;
|
||||
for (auto const &entry : Snapshot.directives)
|
||||
restored.push_back(entry.first);
|
||||
for (auto const &entry : Snapshot.tracks)
|
||||
if (entry.second.name != entry.first->name() && std::any_of(Snapshot.tracks.begin(), Snapshot.tracks.end(), [&](auto const &Other) { return Other.first != entry.first && Other.second.name == entry.first->name(); }))
|
||||
editor_track::rename(*entry.first, entry.first->name() + "~", restored);
|
||||
for (auto const &entry : Snapshot.tracks)
|
||||
if (entry.second.name != entry.first->name())
|
||||
editor_track::rename(*entry.first, entry.second.name, restored);
|
||||
for (auto const &entry : Snapshot.tracks)
|
||||
editor_track::apply(*entry.first, entry.second);
|
||||
editor_track::commit(tracks);
|
||||
|
||||
Reference in New Issue
Block a user