16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 01:19:19 +02:00

minor ai tweaks, minor bug fixes

This commit is contained in:
tmj-fstate
2018-06-13 16:52:42 +02:00
parent 457de678c3
commit c2f0df9a0b
3 changed files with 11 additions and 10 deletions

View File

@@ -4783,7 +4783,7 @@ TController::UpdateSituation(double dt) {
} }
else { else {
// przy dużej różnicy wysoki stopień (1,00 potrzebnego opoznienia) // przy dużej różnicy wysoki stopień (1,00 potrzebnego opoznienia)
if( ( std::max( 75.0, fMaxProximityDist ) + fBrakeDist * braking_distance_multiplier( VelNext ) ) >= ( ActualProximityDist - fMaxProximityDist ) ) { if( ( std::max( 100.0, fMaxProximityDist ) + fBrakeDist * braking_distance_multiplier( VelNext ) ) >= ( ActualProximityDist - fMaxProximityDist ) ) {
// don't slow down prematurely; as long as we have room to come to a full stop at a safe distance, we're good // don't slow down prematurely; as long as we have room to come to a full stop at a safe distance, we're good
// ensure some minimal coasting speed, otherwise a vehicle entering this zone at very low speed will be crawling forever // ensure some minimal coasting speed, otherwise a vehicle entering this zone at very low speed will be crawling forever
auto const brakingpointoffset = VelNext * braking_distance_multiplier( VelNext ); auto const brakingpointoffset = VelNext * braking_distance_multiplier( VelNext );

View File

@@ -6559,11 +6559,12 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
std::max( goalvolume, currentvolume - changerate ) : std::max( goalvolume, currentvolume - changerate ) :
std::min( goalvolume, currentvolume + changerate ) ); std::min( goalvolume, currentvolume + changerate ) );
if( volume > 0.05 ) {
engine_turbo engine_turbo
.pitch( 0.4 + engine_turbo_pitch * 0.4 ) .pitch( 0.4 + engine_turbo_pitch * 0.4 )
.gain( volume ) .gain( volume );
.play( sound_flags::exclusive | sound_flags::looping );
if( volume > 0.05 ) {
engine_turbo.play( sound_flags::exclusive | sound_flags::looping );
} }
else { else {
engine_turbo.stop(); engine_turbo.stop();
@@ -6597,7 +6598,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
if( ( true == Vehicle.Mains ) if( ( true == Vehicle.Mains )
&& ( false == motors.empty() ) ) { && ( false == motors.empty() ) ) {
if( std::fabs( Vehicle.enrot ) > 0.01 ) { if( std::abs( Vehicle.enrot ) > 0.01 ) {
auto const &motor { motors.front() }; auto const &motor { motors.front() };
// frequency calculation // frequency calculation

View File

@@ -4345,7 +4345,7 @@ bool TTrain::Update( double const Deltatime )
tor = DynamicObject->GetTrack(); // McZapkie-180203 tor = DynamicObject->GetTrack(); // McZapkie-180203
// McZapkie: predkosc wyswietlana na tachometrze brana jest z obrotow kol // McZapkie: predkosc wyswietlana na tachometrze brana jest z obrotow kol
float maxtacho = 3; auto const maxtacho { 3.0 };
fTachoVelocity = static_cast<float>( std::min( std::abs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot), mvControlled->Vmax * 1.05) ); fTachoVelocity = static_cast<float>( std::min( std::abs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot), mvControlled->Vmax * 1.05) );
{ // skacze osobna zmienna { // skacze osobna zmienna
float ff = simulation::Time.data().wSecond; // skacze co sekunde - pol sekundy float ff = simulation::Time.data().wSecond; // skacze co sekunde - pol sekundy
@@ -4361,12 +4361,12 @@ bool TTrain::Update( double const Deltatime )
} }
if (fTachoVelocity > 1) // McZapkie-270503: podkrecanie tachometru if (fTachoVelocity > 1) // McZapkie-270503: podkrecanie tachometru
{ {
if (fTachoCount < maxtacho) // szybciej zacznij stukac
fTachoCount += Deltatime * 3; // szybciej zacznij stukac fTachoCount = std::min( maxtacho, fTachoCount + Deltatime * 3 );
} }
else if( fTachoCount > 0 ) { else if( fTachoCount > 0 ) {
// schodz powoli - niektore haslery to ze 4 sekundy potrafia stukac // schodz powoli - niektore haslery to ze 4 sekundy potrafia stukac
fTachoCount -= Deltatime * 0.66; fTachoCount = std::max( 0.0, fTachoCount - Deltatime * 0.66 );
} }
// Ra 2014-09: napięcia i prądy muszą być ustalone najpierw, bo wysyłane są ewentualnie na PoKeys // Ra 2014-09: napięcia i prądy muszą być ustalone najpierw, bo wysyłane są ewentualnie na PoKeys