diff --git a/application/editormode.cpp b/application/editormode.cpp index bd3000a2..ac6e48a1 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -2907,6 +2907,7 @@ bool editor_mode::save() if (m_profile.changed) profile_store(); switch_store::tidy(); + switch_store::settle(); infra_store(); if (false == m_saved_camera.has_value() || glm::distance(m_saved_camera->first, glm::dvec3{Camera.Pos}) > 0.5 || glm::distance(m_saved_camera->second, glm::vec3{Camera.Angle}) > 0.01f) { diff --git a/application/editormode.h b/application/editormode.h index 9b3e8c7b..1c643f32 100644 --- a/application/editormode.h +++ b/application/editormode.h @@ -21,6 +21,8 @@ http://mozilla.org/MPL/2.0/. #include "editor/editorOrthophoto.hpp" #include "editor/editorTrack.hpp" #include "editor/editorAlignment.hpp" +#include "editor/editorAlignmentStore.hpp" +#include "editor/editorSwitchStore.hpp" #include "editor/editorSpeed.hpp" #include "editor/editorRoad.hpp" #include "editor/editorProfile.hpp" @@ -168,6 +170,8 @@ class editor_mode : public application_mode, private editor_track::observer std::vector infra; // objects which followed the paths bool profiles{false}; // the stored grade line designs changed too, these were the ones before std::vector profile_library; + std::optional> alignments; // the kept horizontal alignments changed too, these were the ones before + std::optional> switch_records; // the kept switches changed too, these were the ones before std::vector copies; // models an array added to the one it was made of bool joined{false}; // undone and redone together with the change before it std::shared_ptr terrain; // the heightmap terrain from before the change (Action::Terrain) @@ -630,6 +634,8 @@ class editor_mode : public application_mode, private editor_track::observer static bool tracks_editable(std::vector const &Tracks, std::string &Reason); void trim_history(); void restore_track_snapshot(EditorSnapshot const &Snapshot, std::vector &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(); editor_track::point_ref m_track_point; std::vector m_track_drag; std::vector> m_track_drag_points; diff --git a/application/editormodeselftest.cpp b/application/editormodeselftest.cpp index dd6622b7..c034e51b 100644 --- a/application/editormodeselftest.cpp +++ b/application/editormodeselftest.cpp @@ -104,6 +104,7 @@ http://mozilla.org/MPL/2.0/. // switchplace