diff --git a/Driver.cpp b/Driver.cpp index c2d633cb..f4b079b6 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -894,10 +894,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN // przy jakim dystansie (stanie licznika) ma przesunąć na następny postój fLastStopExpDist = mvOccupied->DistCounter + 0.250 + 0.001 * fLength; TrainParams->UpdateMTable( simulation::Time, asNextStop ); + UpdateDelayFlag(); TrainParams->StationIndexInc(); // przejście do następnej asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania - // TableClear(); //aby od nowa sprawdziło W4 z inną nazwą już - to nie - // jest dobry pomysł sSpeedTable[i].iFlags = 0; // nie liczy się już continue; // nie analizować prędkości } @@ -972,21 +971,13 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN // also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop iDrivigFlags &= ~( moveStartHorn | moveStartHornNow ); } + UpdateDelayFlag(); // perform loading/unloading auto const platformside = static_cast( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10; auto const exchangetime = simulation::Station.update_load( pVehicles[ 0 ], *TrainParams, platformside ); WaitingSet( exchangetime ); - if( TrainParams->CheckTrainLatency() < 0.0 ) { - // odnotowano spóźnienie - iDrivigFlags |= moveLate; - } - else { - // przyjazd o czasie - iDrivigFlags &= ~moveLate; - } - if (TrainParams->DirectionChange()) { // jeśli "@" w rozkładzie, to wykonanie dalszych komend // wykonanie kolejnej komendy, nie dotyczy ostatniej stacji @@ -1914,9 +1905,12 @@ void TController::AutoRewident() d = d->Next(); // kolejny pojazd, podłączony od tyłu (licząc od czoła) } //ustawianie trybu pracy zadajnika hamulca, wystarczy raz po inicjalizacji AI - for( int i = 1; i <= 8; i *= 2 ) { - if( ( mvOccupied->BrakeOpModes & i ) > 0 ) { - mvOccupied->BrakeOpModeFlag = i; + if( true == AIControllFlag ) { + // if a human is in charge leave the brake mode up to them, otherwise do as you like + for( int i = 1; i <= 8; i *= 2 ) { + if( ( mvOccupied->BrakeOpModes & i ) > 0 ) { + mvOccupied->BrakeOpModeFlag = i; + } } } @@ -6210,6 +6204,18 @@ std::string TController::NextStop() const return nextstop; }; +void TController::UpdateDelayFlag() { + + if( TrainParams->CheckTrainLatency() < 0.0 ) { + // odnotowano spóźnienie + iDrivigFlags |= moveLate; + } + else { + // przyjazd o czasie + iDrivigFlags &= ~moveLate; + } +} + //-----------koniec skanowania semaforow void TController::TakeControl(bool yes) diff --git a/Driver.h b/Driver.h index e6fa6125..7aad9018 100644 --- a/Driver.h +++ b/Driver.h @@ -388,6 +388,8 @@ private: int StationCount() const; bool IsStop() const; std::string NextStop() const; + // tests whether the train is delayed and sets accordingly a driving flag + void UpdateDelayFlag(); // members Mtable::TTrainParameters *TrainParams = nullptr; // rozkład jazdy zawsze jest, nawet jeśli pusty std::string asNextStop; // nazwa następnego punktu zatrzymania wg rozkładu diff --git a/DynObj.cpp b/DynObj.cpp index 5d56d0d3..a0bcac82 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -4436,7 +4436,7 @@ void TDynamicObject::RenderSounds() { // youBy: dzwiek ostrych lukow i ciasnych zwrotek if( ( ts.R * ts.R > 1 ) - && ( MoverParameters->Vel > 0 ) ) { + && ( MoverParameters->Vel > 5.0 ) ) { // scale volume with curve radius and vehicle speed volume = MoverParameters->AccN * MoverParameters->AccN @@ -4638,11 +4638,6 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co mdModel = TModelsManager::GetModel(asModel, true); if (ReplacableSkin != "none") { - std::string nowheretexture = TextureTest( "nowhere" ); // na razie prymitywnie - if( false == nowheretexture.empty() ) { - m_materialdata.replacable_skins[ 4 ] = GfxRenderer.Fetch_Material( nowheretexture ); - } - if (m_materialdata.multi_textures > 0) { // jeśli model ma 4 tekstury // check for the pipe method first @@ -4679,6 +4674,10 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co else { m_materialdata.replacable_skins[ 1 ] = GfxRenderer.Fetch_Material( ReplacableSkin ); } + + // potentially set blank destination texture + DestinationSet( {}, {} ); + if( GfxRenderer.Material( m_materialdata.replacable_skins[ 1 ] ).has_alpha ) { // tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych m_materialdata.textures_alpha = 0x31310031; diff --git a/Event.cpp b/Event.cpp index 176b5cbc..c97b35f9 100644 --- a/Event.cpp +++ b/Event.cpp @@ -514,13 +514,19 @@ getvalues_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad ) void getvalues_event::run_() { - WriteLog( "Type: GetValues" ); + auto const *cell { m_input.data_cell() }; + + WriteLog( "Type: GetValues - " + + cell->name() + " - [" + + cell->Text() + "] [" + + to_string( cell->Value1(), 2 ) + "] [" + + to_string( cell->Value2(), 2 ) + "]" ); if( m_activator == nullptr ) { return; } - m_input.data_cell()->PutCommand( + cell->PutCommand( m_activator->Mechanik, - &( m_input.data_cell()->location() ) ); + &( cell->location() ) ); // potwierdzenie wykonania dla serwera (odczyt semafora już tak nie działa) if( Global.iMultiplayer ) { diff --git a/Train.cpp b/Train.cpp index 2a9e8a92..c9479341 100644 --- a/Train.cpp +++ b/Train.cpp @@ -6433,7 +6433,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName) rsRunningNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax ); rsRunningNoise.owner( DynamicObject ); - rsRunningNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax ); +// rsRunningNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax ); rsRunningNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax ); } else if( token == "huntingnoise:" ) { @@ -6441,7 +6441,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName) rsHuntingNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax ); rsHuntingNoise.owner( DynamicObject ); - rsHuntingNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax ); +// rsHuntingNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax ); rsHuntingNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax ); } @@ -7359,7 +7359,7 @@ void TTrain::set_cab_controls( int const Cab ) { if (ggBrakeOperationModeCtrl.SubModel != nullptr) { ggBrakeOperationModeCtrl.PutValue( (mvOccupied->BrakeOpModeFlag > 0 ? - log2(mvOccupied->BrakeOpModeFlag) : + std::log2(mvOccupied->BrakeOpModeFlag) : 0)); } // alarm chain diff --git a/version.h b/version.h index 4a74c1c6..8fa9c26e 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 19 -#define VERSION_MINOR 116 +#define VERSION_MINOR 119 #define VERSION_REVISION 0