mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 07:29:20 +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:
@@ -63,6 +63,10 @@ state_serializer::deserialize_begin( std::string const &Scenariofile ) {
|
||||
// its sections, which those chunks referenced) is destroyed below
|
||||
EditorTerrain.reset();
|
||||
|
||||
// groups hold raw pointers into the region; wipe them before the region goes away so a reload
|
||||
// cannot walk dangling nodes in update_map() / erase()
|
||||
scene::Groups.clear();
|
||||
|
||||
// TODO: move initialization to separate routine so we can reuse it
|
||||
SafeDelete( Region );
|
||||
Region = new scene::basic_region();
|
||||
@@ -95,8 +99,16 @@ state_serializer::deserialize_begin( std::string const &Scenariofile ) {
|
||||
}
|
||||
scene::Groups.create();
|
||||
|
||||
if( false == state->input.ok() )
|
||||
throw invalid_scenery_exception();
|
||||
if( false == state->input.ok() ) {
|
||||
if( false == Global.editor_startup ) {
|
||||
throw invalid_scenery_exception();
|
||||
}
|
||||
// the editor is allowed to work on ground that has no scenery file yet: starting with -editor,
|
||||
// or beginning a new map, names a file which will only exist once it gets saved. an unreadable
|
||||
// scenery means an empty world here, not a failed load
|
||||
WriteLog( "Scenery \"" + Scenariofile + "\" not found, the editor starts on empty ground" );
|
||||
state->blank = true;
|
||||
}
|
||||
|
||||
// prepare deserialization function table
|
||||
// since all methods use the same objects, we can have simple, hard-coded binds or lambdas for the task
|
||||
@@ -183,6 +195,7 @@ state_serializer::deserialize_continue(std::shared_ptr<deserializer_state> state
|
||||
|
||||
if( true == Global.file_binary_terrain
|
||||
&& false == state->scratchpad.binary.terrain
|
||||
&& false == state->blank
|
||||
&& state->scenariofile != "$.scn" ) {
|
||||
// if we didn't find usable binary version of the scenario files, create them now for future use
|
||||
// as long as the scenario file wasn't rainsted-created base file override
|
||||
|
||||
Reference in New Issue
Block a user