17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-18 18:29:40 +02:00

Merge the track layout editor into cpp20-modules, ported to modules

The editor branch was written against headers and the PCH, both of which this
branch has done away with, so its own files were ported rather than merged: the
five headers it added are now interface units and their .cpp files module
implementation units.

- editor/{puwg1992,polandmap,turnouts,orthophoto} become eu07.editor.* modules,
  application/planpanel becomes eu07.application.planpanel. The plan tool keeps
  to its own module rather than joining the eu07.simcore partitions: it stands on
  the editor's libraries and eu07.application.uilayer, not on the simulation core,
  so :editoruilayer can export import it without a cycle.
- glm arrives by import eu07.glm, never by include, as the rest of the tree does.
  maj0sted is header-only and glm-free, so its headers stay includes in the global
  module fragment - every unit that names those types includes them itself, since
  a global fragment is not visible across units.
- the one textual conflict was :editoruilayer's include block against this
  branch's imports; resolved this branch's way plus the planpanel import.

Builds with clang 22 (-DWITH_BETTER_RENDERER=OFF) and starts into the editor on
empty ground with -editor alone.
This commit is contained in:
maj00r
2026-09-13 12:36:21 +02:00
74 changed files with 13615 additions and 81 deletions

View File

@@ -73,14 +73,24 @@ bool scenarioloader_mode::update() {
}
catch (invalid_scenery_exception &e) {
ErrorLog( "Bad init: scenario loading failed" );
state.reset();
Application.pop_mode();
}
WriteLog( "Scenario loading time: " + std::to_string( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now() - timestart ).count() ) + " seconds" );
// TODO: implement and use next mode cue
// the mode object is kept for the next time a scenery is loaded; without dropping the context
// here, a later enter() would skip deserialize_begin and finish an already-spent parser again
state.reset();
Application.pop_mode();
Application.push_mode( eu07_application::mode::driver );
// starting into the editor the simulation never runs at all: there's no driver mode underneath, so
// no physics, no AI and no timetables - just the loaded world to work on
Application.push_mode(
Global.editor_startup ?
eu07_application::mode::editor :
eu07_application::mode::driver );
return true;
}
@@ -94,6 +104,11 @@ void scenarioloader_mode::enter() {
// TBD: hide cursor in fullscreen mode?
Application.set_cursor( GLFW_CURSOR_NORMAL );
// a new map from the editor re-enters this mode while the previous load's context is still
// sitting in `state`; clear it so update() opens the file again instead of re-finishing an
// exhausted parser (Groups.close / create_map_geometry on an already-built region)
state.reset();
simulation::is_ready = false;
Application.set_title( Global.AppName + " (" + Global.SceneryFile + ")" );