diff --git a/Driver.cpp b/Driver.cpp index ee217d5f..c0eb8210 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -892,10 +892,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 } @@ -970,21 +969,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 @@ -1912,9 +1903,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; + } } } @@ -6208,6 +6202,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 01070b48..fc3bcd69 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -4437,7 +4437,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 @@ -4639,11 +4639,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 @@ -4681,6 +4676,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 dd938bfe..58d4f790 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/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 3168cdc9..0e21d733 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -3183,18 +3183,7 @@ bool TMoverParameters::DecBrakePress(double &brake, double PressLimit, double dp bool TMoverParameters::BrakeDelaySwitch(int BDS) { bool rBDS; - // if (BrakeCtrlPosNo > 0) - if (BrakeHandle == TBrakeHandle::MHZ_EN57) - { - if ((BDS != BrakeOpModeFlag) && ((BDS & BrakeOpModes) > 0)) - { - BrakeOpModeFlag = BDS; - rBDS = true; - } - else - rBDS = false; - } - else if (Hamulec->SetBDF(BDS)) + if (Hamulec->SetBDF(BDS)) { BrakeDelayFlag = BDS; rBDS = true; diff --git a/Train.cpp b/Train.cpp index 345f3951..b33b15d3 100644 --- a/Train.cpp +++ b/Train.cpp @@ -6424,7 +6424,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:" ) { @@ -6432,7 +6432,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 ); } @@ -7351,7 +7351,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/scene.cpp b/scene.cpp index cdc06b43..1fc6f706 100644 --- a/scene.cpp +++ b/scene.cpp @@ -762,7 +762,7 @@ basic_section::insert( shape_node Shape ) { // re-calculate section radius, in case shape geometry extends outside the section's boundaries m_area.radius = std::max( m_area.radius, - static_cast( glm::length( m_area.center - shapedata.area.center ) + shapedata.area.radius ) ); + static_cast( glm::length( m_area.center - shapedata.area.center ) + Shape.radius() ) ); if( ( true == shapedata.translucent ) || ( shapedata.rangesquared_max <= 90000.0 ) diff --git a/scenenode.h b/scenenode.h index 65be6507..05431fec 100644 --- a/scenenode.h +++ b/scenenode.h @@ -140,6 +140,7 @@ public: shapenode_data const & data() const; // get bounding radius + // NOTE: use this method instead of direct access to the data member, due to lazy radius evaluation float radius(); private: diff --git a/version.h b/version.h index 491e77d5..9f2c4b1f 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION_INFO "M7 14.01.2018, based on tmj-6f48a6e5" +#define VERSION_INFO "M7 19.01.2018, based on tmj-330e52d4"