diff --git a/DynObj.cpp b/DynObj.cpp index 4cde4156..05a9f09b 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -3163,12 +3163,7 @@ bool TDynamicObject::Update(double dt, double dt1) if( MyTrack->fSoundDistance != dRailLength ) { if( dRailLength > 0.0 ) { for( auto &axle : m_axlesounds ) { - axle.distance = - clamp_circular( - axle.distance - dRailLength - + axle.offset - /* - 0.5 * MoverParameters->Dim.L */, - MyTrack->fSoundDistance ); + axle.distance = axle.offset; } } dRailLength = MyTrack->fSoundDistance; @@ -3197,8 +3192,14 @@ bool TDynamicObject::Update(double dt, double dt1) } if( dRailLength > 0.0 ) { auto axleindex { 0 }; + auto const directioninconsist { ( + ctOwner == nullptr ? + 1 : + ( ctOwner->Vehicle()->DirectionGet() == DirectionGet() ? + 1 : + -1 ) ) }; for( auto &axle : m_axlesounds ) { - axle.distance += dDOMoveLen * DirectionGet(); + axle.distance += dDOMoveLen * directioninconsist; if( ( axle.distance < 0 ) || ( axle.distance > dRailLength ) ) { axle.distance = clamp_circular( axle.distance, dRailLength ); @@ -4470,15 +4471,15 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co // each value is a name of additional 3d model // value can be optionally set of values enclosed in "[]" in which case one value will be picked randomly // TBD: reconsider something more yaml-compliant and/or ability to define offset and rotation - while( ( ( token = parser.getToken() ) != "" ) + while( ( ( token = deserialize_random_set( parser ) ) != "" ) && ( token != "}" ) ) { - auto attachmentmodelname { deserialize_random_set( parser ) }; - replace_slashes( attachmentmodelname ); - Global.asCurrentTexturePath = asBaseDir; // biezaca sciezka do tekstur to dynamic/... - auto *attachmentmodel { TModelsManager::GetModel( asBaseDir + attachmentmodelname, true ) }; - if( attachmentmodel != nullptr ) { - mdAttachments.emplace_back( attachmentmodel ); - } + if( token == "{" ) { continue; } + replace_slashes( token ); + Global.asCurrentTexturePath = asBaseDir; // biezaca sciezka do tekstur to dynamic/... + auto *attachmentmodel { TModelsManager::GetModel( asBaseDir + token, true ) }; + if( attachmentmodel != nullptr ) { + mdAttachments.emplace_back( attachmentmodel ); + } } } @@ -5770,6 +5771,9 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co mdLoad->Init(); if (mdLowPolyInt) mdLowPolyInt->Init(); + for( auto *attachment : mdAttachments ) { + attachment->Init(); + } Global.asCurrentTexturePath = szTexturePath; // kiedyś uproszczone wnętrze mieszało tekstury nieba Global.asCurrentDynamicPath = ""; diff --git a/PyInt.cpp b/PyInt.cpp index e36fd903..cbaac2e9 100644 --- a/PyInt.cpp +++ b/PyInt.cpp @@ -192,8 +192,7 @@ auto python_taskqueue::run_file( std::string const &File, std::string const &Pat if( lookup.first.empty() ) { return false; } std::ifstream inputfile { lookup.first + lookup.second }; - std::string input; - input.assign( std::istreambuf_iterator( inputfile ), std::istreambuf_iterator() ); + std::string const input { std::istreambuf_iterator( inputfile ), std::istreambuf_iterator() }; if( PyRun_SimpleString( input.c_str() ) != 0 ) { error(); @@ -215,7 +214,7 @@ void python_taskqueue::release_lock() { PyEval_SaveThread(); } -auto python_taskqueue::fetch_renderer( std::string const Renderer ) ->PyObject * { +auto python_taskqueue::fetch_renderer( std::string const Renderer ) -> PyObject * { auto const lookup { m_renderers.find( Renderer ) }; if( lookup != std::end( m_renderers ) ) { @@ -296,7 +295,9 @@ void python_taskqueue::run( GLFWwindow *Context, rendertask_sequence &Tasks, thr { // execute python code task->run(); - error(); + if( PyErr_Occurred() != nullptr ) { + error(); + } } // clear the thread state PyEval_SaveThread(); @@ -318,8 +319,6 @@ void python_taskqueue::run( GLFWwindow *Context, rendertask_sequence &Tasks, thr void python_taskqueue::error() { - if( PyErr_Occurred() == nullptr ) { return; } - if( m_stderr != nullptr ) { // std err pythona jest buforowane PyErr_Print(); diff --git a/Train.cpp b/Train.cpp index 7be1e6b6..9e1cb264 100644 --- a/Train.cpp +++ b/Train.cpp @@ -6244,10 +6244,13 @@ bool TTrain::Update( double const Deltatime ) if( ggJointCtrl.SubModel != nullptr ) { // joint master controller moves forward to adjust power and backward to adjust brakes auto const brakerangemultiplier { + /* NOTE: scaling disabled as it was conflicting with associating sounds with control positions ( mvControlled->CoupledCtrl ? mvControlled->MainCtrlPosNo + mvControlled->ScndCtrlPosNo : mvControlled->MainCtrlPosNo ) - / static_cast(LocalBrakePosNo) }; + / static_cast(LocalBrakePosNo) + */ + 1 }; ggJointCtrl.UpdateValue( ( mvOccupied->LocalBrakePosA > 0.0 ? mvOccupied->LocalBrakePosA * LocalBrakePosNo * -1 * brakerangemultiplier : mvControlled->CoupledCtrl ? double( mvControlled->MainCtrlPos + mvControlled->ScndCtrlPos ) : diff --git a/version.h b/version.h index 05bc72ea..f70838da 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 19 -#define VERSION_MINOR 925 +#define VERSION_MINOR 929 #define VERSION_REVISION 0