18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-05 16:55:32 +01:00

Merge branch 'feat/world-compiler' into feat/world-regions

# Conflicts:
#	tests/unit/test_world_logic_cache.cpp
This commit is contained in:
maj00r
2026-12-03 22:30:50 +01:00
13 changed files with 203 additions and 28 deletions
+11 -2
View File
@@ -165,6 +165,7 @@ state_serializer::make_deserializer_state( std::string const &Scenariofile, bool
world_logic_cache::load_settings settings;
settings.load_traction = Global.bLoadTraction;
settings.binary_terrain = Binaryterrain;
settings.file_binary_terrain = Global.file_binary_terrain;
settings.prepend = Global.prepend_scn;
std::vector<std::pair<int, std::string>> overrides { Global.trainset_overrides.begin(), Global.trainset_overrides.end() };
std::ranges::sort( overrides );
@@ -1489,7 +1490,7 @@ include_binary_terrain( std::string File, scene::scratch_data &Scratchpad ) {
// only for the text file of the same name, and has no bearing on how the rest of the scenery is loaded.
// a file which is to be read as text is added to Includes, for the caller to pass to the parser
void
include_terrain_file( std::string File, std::string &Includes, scene::scratch_data &Scratchpad ) {
include_terrain_file( std::string File, std::string &Includes, scene::scratch_data &Scratchpad, cParser &Input ) {
auto &binary { Scratchpad.binary };
@@ -1510,6 +1511,9 @@ include_terrain_file( std::string File, std::string &Includes, scene::scratch_da
auto const textfile { Global.asCurrentSceneryPath + File + ".txtf" };
auto const binaryfile { Global.asCurrentSceneryPath + File + ".btf" };
// what the directive gives the parser depends on both files, so a recorded tape follows the changes of both
Input.recordFile( textfile );
Input.recordFile( binaryfile );
auto const textpresent { FileExists( textfile ) };
// binary file holds the geometry where the text alone puts it, it can't stand in for a file placed with an offset or rotation
auto const relocated {
@@ -1602,10 +1606,15 @@ state_serializer::deserialize_terrain(cParser &Input, scene::scratch_data &Scrat
{
if (file.ends_with(".txtf") || file.ends_with(".btf"))
{
include_terrain_file(file, includes, Scratchpad);
include_terrain_file(file, includes, Scratchpad, Input);
}
else if (Global.file_binary_terrain && file.ends_with(".sbt"))
{
// whether the file can be used decides which terrain includes the scenery skips, so a recorded tape follows it
auto stem{file};
replace_slashes(stem);
erase_extension(stem);
Input.recordFile(FileOnDisk(Global.asCurrentSceneryPath + stem + ".sbt"));
include_binary_terrain(file, Scratchpad);
}
}