Skip to content

Open the crossing editor on an object that has no path yet - #146

Open
benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:fix/crossing-without-paths
Open

benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:fix/crossing-without-paths

Conversation

@benchan0527

Copy link
Copy Markdown
Contributor

Selecting an object that has no [path] of its own and pressing Crossing editor did not open it: the window fell back to the map's list of crossings and said the object "has no path". That made a crossing out of anything impossible — the editor is exactly where its first path would be drawn.

Now

  • An object with no path of its own opens in the editor, with an empty list. Its first path is drawn in the 2D page's Draw path, started from a nearby path's end (Start from a nearby path), or carried on with +/N once one exists.
  • An object whose paths live in a file of their own ([paths]) is still refused, and for the same reason as before: openMapper does not read that file, so it would write back an object that had lost them.
  • The list of crossings to pick from is unchanged: it still offers only objects that have paths (the catalogue files every signal head and light program under Junctions, and none of those has one).

Testing

  • cargo test --bin openmapper -- crossing: 117 passed, 1 failed — the failure is editor::tests::a_signal_head_put_by_a_crossing_takes_its_light_from_it, one of the tests that read an installed OMSI 2's content, and it fails the same way without this change.
  • cargo test --bin openmapper -- ui_crossing: 69 passed.
  • python tools/i18n/check.py: 3103 texts, 26 languages: complete. No interface text is added: the refusal that went away uses a message nothing shows any more.
  • New test crossing_edit::tests::an_object_with_no_path_of_its_own_is_still_the_editors: a .sco with no path is not refused, and one with [paths] still is.
  • crossing_edit::tests::an_object_without_paths_is_read_and_written_back_as_it_was (was ...is_not_offered): an object with no path still parses and is written back byte for byte, so opening one and saving it changes nothing.

By hand

  1. Select a house or a lamp that has no paths and press Crossing editor: the window opens on that object, Paths (0).
  2. In the 2D page, drag Draw path: the first path appears and can be edited as any other.
  3. Save: the object's .sco gains [path]s, the old file kept as a .bak.
  4. Select an object whose .sco says [paths]: it is still refused, with the message saying why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant