From bfb12981f5700e1627e1e223c743f6e5b3742574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Sun, 9 Sep 2018 15:14:20 +0200 Subject: [PATCH] First attempt of driver's helper - commands sound for braking --- Driver.cpp | 18 ++++++++++++++++++ Train.cpp | 4 ++++ Train.h | 1 + 3 files changed, 23 insertions(+) diff --git a/Driver.cpp b/Driver.cpp index ac448ff4..599f9940 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -5154,6 +5154,24 @@ TController::UpdateSituation(double dt) { ( mvControlling->CategoryFlag == 2 ? -2.0 : -0.9 ), ( mvControlling->CategoryFlag == 2 ? 2.0 : 0.9 ) ); + + if ((-AccDesired > fBrake_a0[0] + 8 * fBrake_a1[0]) && (HelperState == 0)) + { + HelperState = 1; + } + if ((-AccDesired > fBrake_a0[0] + 12 * fBrake_a1[0]) && (HelperState == 1)) + { + HelperState = 2; + } + if ((-AccDesired > 0) && (HelperState == 2) && (-ActualProximityDist > 5)) + { + HelperState = 3; + } + if ((-AccDesired < fBrake_a0[0] + 2 * fBrake_a1[0]) && (HelperState > 0) && (vel>1)) + { + HelperState = 0; + } + if (AIControllFlag) { // część wykonawcza tylko dla AI, dla człowieka jedynie napisy diff --git a/Train.cpp b/Train.cpp index 69c173fc..ae84a1bf 100644 --- a/Train.cpp +++ b/Train.cpp @@ -5880,6 +5880,8 @@ bool TTrain::Update( double const Deltatime ) ggHornLowButton.Update(); ggHornHighButton.Update(); ggWhistleButton.Update(); + ggHelperButton.UpdateValue(DynamicObject->Mechanik->HelperState); + ggHelperButton.Update(); for( auto &universal : ggUniversals ) { universal.Update(); } @@ -7054,6 +7056,7 @@ void TTrain::clear_cab_controls() ggHornLowButton.Clear(); ggHornHighButton.Clear(); ggWhistleButton.Clear(); + ggHelperButton.Clear(); ggNextCurrentButton.Clear(); for( auto &universal : ggUniversals ) { universal.Clear(); @@ -7649,6 +7652,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con { "hornlow_bt:", ggHornLowButton }, { "hornhigh_bt:", ggHornHighButton }, { "whistle_bt:", ggWhistleButton }, + { "helper_bt:", ggHelperButton }, { "fuse_bt:", ggFuseButton }, { "converterfuse_bt:", ggConverterFuseButton }, { "stlinoff_bt:", ggStLinOffButton }, diff --git a/Train.h b/Train.h index ac14e6ef..bf82e75e 100644 --- a/Train.h +++ b/Train.h @@ -422,6 +422,7 @@ public: // reszta może by?publiczna TGauge ggHornLowButton; TGauge ggHornHighButton; TGauge ggWhistleButton; + TGauge ggHelperButton; TGauge ggNextCurrentButton; std::array ggUniversals; // NOTE: temporary arrangement until we have dynamically built control table