mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 10:46:45 +01:00
fix(editor): a save writing some tracks of a line keeps the records of the others, a plan edit refused in part changes nothing
- record_written() erased every record of the line and added only the pieces written in this save, while the scenery writes only the tracks changed since. After a gizmo move and Ctrl+Z on one track of a line, the next save kept a record of that track alone: on reopening the line owned one track, and the next Plan edit left the others as duplicates. The records of the tracks the line still has and this save didn't write now stay. - model_run() kept each command before trying the next: with the radius of one vertex carried out and the cant of the next refused, the first stayed changed under "Refused, nothing changed". Several commands are now all tried on a copy first. - The fingerprint of the scenario index made a string of every file name before its .scn filter, which throws on Windows outside of the code page, on a detached thread (the class of GE#560). The extension is looked at first, as in the index itself; scenery_text::name_of() and has_extension() are shared by both. - A Del deferred by the check of the scenarios reads Shift as it was at the key press, not at the click on "go on". - open_project() writes no project file for a map with nothing to migrate (#461): the session test expects that.
This commit is contained in:
@@ -15,6 +15,9 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace project
|
||||
{
|
||||
@@ -172,7 +175,18 @@ void session::record_written(layout::line_id const Line, std::vector<written_pie
|
||||
entry.text = piece.text;
|
||||
written.pieces.push_back(std::move(entry));
|
||||
}
|
||||
// the scenery writes only the tracks changed since it was saved: the records of the other tracks the line still has stay as they
|
||||
// were, or after a track moved and moved back the line would keep a record of that one track alone, and own only it when opened
|
||||
std::set<std::string> current;
|
||||
for (auto const &piece : generate(Line).pieces)
|
||||
current.insert(piece.name);
|
||||
auto const written_now = [&Pieces](std::string const &Name) { return std::ranges::any_of(Pieces, [&Name](written_piece const &Piece) { return Piece.name == Name; }); };
|
||||
std::vector<generated_node> kept;
|
||||
for (auto const &node : m_project.generated)
|
||||
if (node.kind == "track" && node.line == Line && current.contains(node.name) && false == written_now(node.name))
|
||||
kept.push_back(node);
|
||||
record_generated(m_project, written, File);
|
||||
m_project.generated.insert(m_project.generated.end(), kept.begin(), kept.end());
|
||||
}
|
||||
|
||||
void session::mark_hand_changed(layout::line_id const Line)
|
||||
|
||||
Reference in New Issue
Block a user