diff --git a/Track.h b/Track.h index caa0c2ab..ccecc6ea 100644 --- a/Track.h +++ b/Track.h @@ -303,6 +303,9 @@ public: for (TIsolated *iso : Isolated) iso->Modify(i, o); }; // dodanie lub odjęcie osi std::string RemoteIsolatedName(); + void AddIsolated(TIsolated *iso) { + Isolated.push_back(iso); + } double WidthTotal(); bool IsGroupable(); int TestPoint( Math3D::vector3 *Point); diff --git a/simulationstateserializer.cpp b/simulationstateserializer.cpp index 342de759..2327bc71 100644 --- a/simulationstateserializer.cpp +++ b/simulationstateserializer.cpp @@ -68,6 +68,7 @@ state_serializer::deserialize_begin( std::string const &Scenariofile ) { std::string, deserializefunction> > functionlist = { { "area", &state_serializer::deserialize_area }, + { "isolated", &state_serializer::deserialize_isolated }, { "assignment", &state_serializer::deserialize_assignment }, { "atmo", &state_serializer::deserialize_atmo }, { "camera", &state_serializer::deserialize_camera }, @@ -149,6 +150,22 @@ state_serializer::deserialize_continue(std::shared_ptr state return false; } +void +state_serializer::deserialize_isolated( cParser &Input, scene::scratch_data &Scratchpad ) { + // first parameter specifies name of parent piece... + auto token { Input.getToken() }; + auto *groupowner { TIsolated::Find( token ) }; + // ...followed by list of its tracks + while( ( false == ( token = Input.getToken() ).empty() ) + && ( token != "endisolated" ) ) { + auto *track { simulation::Paths.find( token ) }; + if( track != nullptr ) + track->AddIsolated( groupowner ); + else + ErrorLog( "Bad scenario: track \"" + token + "\" not found" ); + } +} + void state_serializer::deserialize_area( cParser &Input, scene::scratch_data &Scratchpad ) { // first parameter specifies name of parent piece... diff --git a/simulationstateserializer.h b/simulationstateserializer.h index 82fc5638..a2043e41 100644 --- a/simulationstateserializer.h +++ b/simulationstateserializer.h @@ -50,6 +50,7 @@ private: // methods // restores class data from provided stream void deserialize_area( cParser &Input, scene::scratch_data &Scratchpad ); + void deserialize_isolated( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_assignment( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_atmo( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_camera( cParser &Input, scene::scratch_data &Scratchpad );