diff --git a/Camera.cpp b/Camera.cpp index 21350fb0..bfeb103a 100644 --- a/Camera.cpp +++ b/Camera.cpp @@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/. #include "utilities.h" #include "Console.h" #include "Timer.h" +#include "Driver.h" #include "DynObj.h" #include "MOVER.h" @@ -188,7 +189,8 @@ void TCamera::Update() // attached movement position update auto movement { Velocity * -2.0 }; movement.y = -movement.y; - if( m_owner->MoverParameters->CabOccupied < 0 ) { + if( ( m_owner->ctOwner ) + && ( m_owner->ctOwner->Vehicle()->MoverParameters->CabOccupied < 0 ) ) { movement *= -1.f; movement.y = -movement.y; } diff --git a/Driver.cpp b/Driver.cpp index c0882d8e..c7a939b5 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -861,7 +861,8 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN double v; // prędkość double d; // droga double d_to_next_sem = 10000.0; //ustaiwamy na pewno dalej niż widzi AI - IsAtPassengerStop = false; + IsAtPassengerStop = false; + auto IsScheduledPassengerStopVisible { false }; TCommandType go = TCommandType::cm_Unknown; eSignNext = NULL; // te flagi są ustawiane tutaj, w razie potrzeby @@ -879,7 +880,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN // first 19 chars of the command is expected to be "PassengerStopPoint:" so we skip them if ( ToLower(sSpeedTable[i].evEvent->input_text()).compare( 19, sizeof(asNextStop), ToLower(asNextStop)) != 0 ) { // jeśli nazwa nie jest zgodna - if (sSpeedTable[i].fDist < 300.0 && sSpeedTable[i].fDist > 0) // tylko jeśli W4 jest blisko, przy dwóch może zaczać szaleć + if( ( false == IsScheduledPassengerStopVisible ) // check if our next scheduled stop didn't show up earlier in the scan + && ( sSpeedTable[i].fDist < ( 1.15 * fBrakeDist + 300 ) ) + && ( sSpeedTable[i].fDist > 0 ) ) // tylko jeśli W4 jest blisko, przy dwóch może zaczać szaleć { // porównuje do następnej stacji, więc trzeba przewinąć do poprzedniej // nastepnie ustawić następną na aktualną tak żeby prawidłowo ją obsłużył w następnym kroku @@ -896,6 +899,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN } else if (iDrivigFlags & moveStopPoint) // jeśli pomijanie W4, to nie sprawdza czasu odjazdu { // tylko gdy nazwa zatrzymania się zgadza + IsScheduledPassengerStopVisible = true; // block potential timetable rewind if the next stop shows up later in the scan if (false == TrainParams.IsStop()) { // jeśli nie ma tu postoju sSpeedTable[i].fVelNext = -1; // maksymalna prędkość w tym miejscu diff --git a/Logs.cpp b/Logs.cpp index 612d489f..f37e2eee 100644 --- a/Logs.cpp +++ b/Logs.cpp @@ -51,7 +51,7 @@ std::string filename_scenery() { void WriteLog( const char *str, logtype const Type ) { if( str == nullptr ) { return; } - if( true == TestFlag( Global.DisabledLogTypes, Type ) ) { return; } + if( true == TestFlag( Global.DisabledLogTypes, static_cast( Type ) ) ) { return; } if (Global.iWriteLogEnabled & 1) { if( !output.is_open() ) { @@ -79,7 +79,7 @@ void WriteLog( const char *str, logtype const Type ) { void ErrorLog( const char *str, logtype const Type ) { if( str == nullptr ) { return; } - if( true == TestFlag( Global.DisabledLogTypes, Type ) ) { return; } + if( true == TestFlag( Global.DisabledLogTypes, static_cast( Type ) ) ) { return; } if (!errors.is_open()) { diff --git a/Logs.h b/Logs.h index c4bd93ce..3ea8ccee 100644 --- a/Logs.h +++ b/Logs.h @@ -11,7 +11,7 @@ http://mozilla.org/MPL/2.0/. #include -enum logtype : unsigned int { +enum class logtype : unsigned int { generic = ( 1 << 0 ), file = ( 1 << 1 ), @@ -20,7 +20,8 @@ enum logtype : unsigned int { // lua = ( 1 << 4 ), material = ( 1 << 5 ), shader = ( 1 << 6 ), - net = ( 1 << 7 ) + net = ( 1 << 7 ), + sound = ( 1 << 8 ), }; void WriteLog( const char *str, logtype const Type = logtype::generic ); diff --git a/application.cpp b/application.cpp index 2f89472e..3d026496 100644 --- a/application.cpp +++ b/application.cpp @@ -819,7 +819,7 @@ eu07_application::init_gfx() { // legacy render path GfxRenderer = std::make_unique(); Global.GfxFramebufferSRGB = false; - Global.DisabledLogTypes |= logtype::material; + Global.DisabledLogTypes |= static_cast( logtype::material ); } if( false == GfxRenderer->Init( m_windows.front() ) ) { diff --git a/audio.cpp b/audio.cpp index 558f325e..609bcbf2 100644 --- a/audio.cpp +++ b/audio.cpp @@ -27,6 +27,8 @@ namespace audio { openal_buffer::openal_buffer( std::string const &Filename ) : name( Filename ) { + WriteLog( "Loading sound data from \"" + Filename + "\"", logtype::sound ); + ::alGenBuffers( 1, &id ); // fetch audio data if( Filename.substr( Filename.rfind( '.' ) ) == ".wav" ) { diff --git a/driveruipanels.cpp b/driveruipanels.cpp index 8b4bb3fd..4c8c7b37 100644 --- a/driveruipanels.cpp +++ b/driveruipanels.cpp @@ -88,9 +88,9 @@ drivingaid_panel::update() { std::snprintf( m_buffer.data(), m_buffer.size(), locale::strings[ locale::string::driver_aid_throttle ].c_str(), - driver->Controlling()->MainCtrlPos, - driver->Controlling()->ScndCtrlPos, - ( mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : 'N' ), + ( mover->EIMCtrlType > 0 ? std::max( 0, static_cast( 100.4 * mover->eimic_real ) ) : driver->Controlling()->MainCtrlPos ), + ( mover->EIMCtrlType > 0 ? driver->Controlling()->MainCtrlPos : driver->Controlling()->ScndCtrlPos ), + ( mover->SpeedCtrlUnit.IsActive ? 'T' : mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : 'N' ), expandedtext.c_str()); text_lines.emplace_back( m_buffer.data(), Global.UITextColor ); @@ -106,10 +106,12 @@ drivingaid_panel::update() { mover->PipePress * 100 ); expandedtext = m_buffer.data(); } + auto const basicbraking { mover->fBrakeCtrlPos }; + auto const eimicbraking { std::max( 0.0, -100.0 * mover->eimic_real ) }; std::snprintf( m_buffer.data(), m_buffer.size(), locale::strings[ locale::string::driver_aid_brakes ].c_str(), - mover->fBrakeCtrlPos, + ( mover->EIMCtrlType == 0 ? basicbraking : mover->EIMCtrlType == 3 ? ( mover->UniCtrlIntegratedBrakeCtrl ? eimicbraking : basicbraking ) : eimicbraking ), mover->LocalBrakePosA * LocalBrakePosNo, ( mover->SlippingWheels ? '!' : ' ' ), expandedtext.c_str() ); diff --git a/translation.cpp b/translation.cpp index 4a874618..bb3ea160 100644 --- a/translation.cpp +++ b/translation.cpp @@ -27,11 +27,11 @@ init() { { "en", { "Driving Aid", - "Throttle: %2d+%d %c%s", + "Throttle: %3d+%d %c%s", " Speed: %d km/h (limit %d km/h%s)%s", ", new limit: %d km/h in %.1f km", " Grade: %.1f%%%%", - "Brakes: %4.1f+%-2.0f%c%s", + "Brakes: %5.1f+%-2.0f%c%s", " Pressure: %.2f kPa (train pipe: %.2f kPa)", "!ALERTER! ", "!SHP!", @@ -229,11 +229,11 @@ init() { { "pl", { "Pomocnik", - "Nastawnik: %2d+%d %c%s", + "Nastawnik: %3d+%d %c%s", " Predkosc: %d km/h (limit %d km/h%s)%s", ", nowy limit: %d km/h za %.1f km", " Nachylenie: %.1f%%%%", - "Hamulce: %4.1f+%-2.0f%c%s", + "Hamulce: %5.1f+%-2.0f%c%s", " Cisnienie: %.2f kPa (przewod glowny: %.2f kPa)", "!CZUWAK! ", "!SHP!", diff --git a/version.h b/version.h index dbf6be39..a82522d4 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 20 -#define VERSION_MINOR 525 +#define VERSION_MINOR 604 #define VERSION_REVISION 0