17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 05:20:52 +01:00

fix(editor): the records of the stations, the switches, the alignments and the kilometrage stay out of a _ter.scm too, as out of a .txtf: with the .sbt of the scenery the file loads as terrain, isn't written back and the changes kept there were lost

This commit is contained in:
maj00r
2026-10-22 16:06:37 +02:00
parent 2452c1cd0d
commit ad0a7e7d62
3 changed files with 10 additions and 8 deletions

View File

@@ -863,7 +863,12 @@ void restore(std::vector<record> Records)
scene::layer_handle layer_of(TTrack const &Track)
{
auto const usable = [](scene::layer_handle const Layer) { return scene::Layers.valid(Layer) && scene::Layers.accepts(Layer) && false == scene::Layers.layer(Layer).name.ends_with(".txtf"); };
auto const usable = [](scene::layer_handle const Layer) {
if (false == scene::Layers.valid(Layer) || false == scene::Layers.accepts(Layer))
return false;
auto const &name{scene::Layers.layer(Layer).name};
return false == name.ends_with(".txtf") && false == name.ends_with("_ter.scm");
};
auto layer{scene::Layers.resolve(Track.layer())};
if (false == usable(layer))
layer = scene::Layers.active();

View File

@@ -104,8 +104,8 @@ std::optional<std::vector<record>> take_changes();
void settle();
// puts the records back as they were, for undo and redo
void restore(std::vector<record> Records);
// layer the editor keeps the records of the track in: its own, unless it's a terrain file (.txtf), whose binary version
// (.btf) the editor doesn't read the records from
// layer the editor keeps the records of the track in: its own, unless it's a terrain file: a .txtf, whose binary version (.btf)
// the editor doesn't read the records from, or a _ter.scm, which isn't written back while the scenery has its .sbt
scene::layer_handle layer_of(TTrack const &Track);
} // namespace alignment_store