mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
SBT Include
This commit is contained in:
3
scene.h
3
scene.h
@@ -37,6 +37,7 @@ struct scratch_data {
|
|||||||
struct binary_data {
|
struct binary_data {
|
||||||
|
|
||||||
bool terrain{ false };
|
bool terrain{ false };
|
||||||
|
bool terrain_included{false};
|
||||||
} binary;
|
} binary;
|
||||||
|
|
||||||
struct location_data {
|
struct location_data {
|
||||||
@@ -59,6 +60,8 @@ struct scratch_data {
|
|||||||
} trainset;
|
} trainset;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
std::string terrain_name;
|
||||||
|
|
||||||
bool initialized { false };
|
bool initialized { false };
|
||||||
bool time_initialized { false };
|
bool time_initialized { false };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ state_serializer::deserialize_begin( std::string const &Scenariofile ) {
|
|||||||
{ "test", &state_serializer::deserialize_test },
|
{ "test", &state_serializer::deserialize_test },
|
||||||
{ "time", &state_serializer::deserialize_time },
|
{ "time", &state_serializer::deserialize_time },
|
||||||
{ "trainset", &state_serializer::deserialize_trainset },
|
{ "trainset", &state_serializer::deserialize_trainset },
|
||||||
|
{ "terrain", &state_serializer::deserialize_terrain },
|
||||||
{ "endtrainset", &state_serializer::deserialize_endtrainset } };
|
{ "endtrainset", &state_serializer::deserialize_endtrainset } };
|
||||||
|
|
||||||
for( auto &function : functionlist ) {
|
for( auto &function : functionlist ) {
|
||||||
@@ -361,7 +362,15 @@ state_serializer::deserialize_firstinit( cParser &Input, scene::scratch_data &Sc
|
|||||||
if( true == Scratchpad.binary.terrain ) {
|
if( true == Scratchpad.binary.terrain ) {
|
||||||
// at this stage it should be safe to import terrain from the binary scene file
|
// at this stage it should be safe to import terrain from the binary scene file
|
||||||
// TBD: postpone loading furter and only load required blocks during the simulation?
|
// TBD: postpone loading furter and only load required blocks during the simulation?
|
||||||
Region->deserialize( Scratchpad.name );
|
if (false == Scratchpad.binary.terrain_included)
|
||||||
|
{
|
||||||
|
Region->deserialize(Scratchpad.name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Region->deserialize(Scratchpad.terrain_name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
simulation::Paths.InitTracks();
|
simulation::Paths.InitTracks();
|
||||||
@@ -734,6 +743,26 @@ state_serializer::deserialize_trainset( cParser &Input, scene::scratch_data &Scr
|
|||||||
>> Scratchpad.trainset.velocity;
|
>> Scratchpad.trainset.velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
state_serializer::deserialize_terrain(cParser &Input, scene::scratch_data &Scratchpad)
|
||||||
|
{
|
||||||
|
std::string line;
|
||||||
|
Input.getTokens(1);
|
||||||
|
Input >> line;
|
||||||
|
if ((true == Global.file_binary_terrain) && (true == ends_with(line, ".sbt")))
|
||||||
|
{
|
||||||
|
|
||||||
|
WriteLog("SBT included");
|
||||||
|
Global.file_binary_terrain_state = true;
|
||||||
|
Scratchpad.binary.terrain_included = true;
|
||||||
|
Scratchpad.terrain_name = line;
|
||||||
|
WriteLog("SBT present");
|
||||||
|
}
|
||||||
|
|
||||||
|
skip_until(Input, "endterrain");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
state_serializer::deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad ) {
|
state_serializer::deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad ) {
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ private:
|
|||||||
void deserialize_test( cParser &Input, scene::scratch_data &Scratchpad );
|
void deserialize_test( cParser &Input, scene::scratch_data &Scratchpad );
|
||||||
void deserialize_time( cParser &Input, scene::scratch_data &Scratchpad );
|
void deserialize_time( cParser &Input, scene::scratch_data &Scratchpad );
|
||||||
void deserialize_trainset( cParser &Input, scene::scratch_data &Scratchpad );
|
void deserialize_trainset( cParser &Input, scene::scratch_data &Scratchpad );
|
||||||
|
void deserialize_terrain( cParser &Input, scene::scratch_data &Scratchpad );
|
||||||
void deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad );
|
void deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad );
|
||||||
TTrack * deserialize_path( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
|
TTrack * deserialize_path( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
|
||||||
TTraction * deserialize_traction( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
|
TTraction * deserialize_traction( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
|
||||||
|
|||||||
Reference in New Issue
Block a user