From 955e8915a5bc8250398948ef4db8592972c44e9d Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Fri, 31 Aug 2018 17:04:20 +0200 Subject: [PATCH] build 180831. vehicle debug panel content cleanup, configurable ui panel opacity, ai coasting logic tweaks --- Driver.cpp | 30 ++--- Globals.cpp | 6 + Globals.h | 1 + McZapkie/MOVER.h | 2 +- McZapkie/Mover.cpp | 2 +- drivermode.cpp | 2 +- driveruilayer.cpp | 9 -- driveruipanels.cpp | 312 ++++++++++++++++++++++----------------------- uilayer.cpp | 16 +-- version.h | 2 +- 10 files changed, 176 insertions(+), 206 deletions(-) diff --git a/Driver.cpp b/Driver.cpp index d8034036..55a114cb 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -5282,25 +5282,11 @@ TController::UpdateSituation(double dt) { } } } - // margines dla prędkości jest doliczany tylko jeśli oczekiwana prędkość jest większa od 5km/h - if( false == TestFlag( iDrivigFlags, movePress ) ) { - // jeśli nie dociskanie - if( AccDesired < -0.05 ) { - while( true == DecSpeed() ) { ; } // jeśli hamujemy, to nie przyspieszamy - } - else if( ( vel > VelDesired ) - || ( fAccGravity < -0.01 ? - AccDesired < 0.0 : - AbsAccS > AccDesired ) ) { - // jak za bardzo przyspiesza albo prędkość przekroczona - DecSpeed(); // pojedyncze cofnięcie pozycji, bo na zero to przesada - } - } // yB: usunięte różne dziwne warunki, oddzielamy część zadającą od wykonawczej // zwiekszanie predkosci // Ra 2F1H: jest konflikt histerezy pomiędzy nastawioną pozycją a uzyskiwanym // przyspieszeniem - utrzymanie pozycji powoduje przekroczenie przyspieszenia - if( AbsAccS < AccDesired ) { + if( ( AccDesired - AbsAccS > 0.01 ) ) { // jeśli przyspieszenie pojazdu jest mniejsze niż żądane oraz... if( vel < ( VelDesired == 1.0 ? // work around for trains getting stuck on tracks with speed limit = 1 @@ -5320,6 +5306,20 @@ TController::UpdateSituation(double dt) { } // yB: usunięte różne dziwne warunki, oddzielamy część zadającą od wykonawczej // zmniejszanie predkosci + // margines dla prędkości jest doliczany tylko jeśli oczekiwana prędkość jest większa od 5km/h + if( false == TestFlag( iDrivigFlags, movePress ) ) { + // jeśli nie dociskanie + if( AccDesired < -0.05 ) { + while( true == DecSpeed() ) { ; } // jeśli hamujemy, to nie przyspieszamy + } + else if( ( vel > VelDesired ) + || ( fAccGravity < -0.01 ? + AccDesired < 0.0 : + AbsAccS > AccDesired ) ) { + // jak za bardzo przyspiesza albo prędkość przekroczona + DecSpeed(); // pojedyncze cofnięcie pozycji, bo na zero to przesada + } + } if( mvOccupied->TrainType == dt_EZT ) { // właściwie, to warunek powinien być na działający EP // Ra: to dobrze hamuje EP w EZT diff --git a/Globals.cpp b/Globals.cpp index e55c7dc0..a766bd8c 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -593,6 +593,12 @@ global_settings::ConfigParse(cParser &Parser) { UITextColor = UITextColor / 255.f; UITextColor.a = 1.f; } + else if( token == "ui.bg.opacity" ) { + // czy grupować eventy o tych samych nazwach + Parser.getTokens(); + Parser >> UIBgOpacity; + UIBgOpacity = clamp( UIBgOpacity, 0.f, 1.f ); + } else if( token == "input.gamepad" ) { // czy grupować eventy o tych samych nazwach Parser.getTokens(); diff --git a/Globals.h b/Globals.h index c94a9282..963249b4 100644 --- a/Globals.h +++ b/Globals.h @@ -91,6 +91,7 @@ struct global_settings { int iTextMode{ 0 }; // tryb pracy wyświetlacza tekstowego int iScreenMode[ 12 ] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // numer ekranu wyświetlacza tekstowego glm::vec4 UITextColor { glm::vec4( 225.f / 255.f, 225.f / 255.f, 225.f / 255.f, 1.f ) }; // base color of UI text + float UIBgOpacity { 0.65f }; // opacity of ui windows std::string asLang{ "pl" }; // domyślny język - http://tools.ietf.org/html/bcp47 // gfx int iWindowWidth{ 800 }; diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index b3a60950..c4bc99e3 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1236,7 +1236,7 @@ public: double ManualBrakeRatio(void); double PipeRatio(void);/*ile napelniac*/ double RealPipeRatio(void);/*jak szybko*/ - double BrakeVP(void); + double BrakeVP(void) const; /*! przesylanie komend sterujacych*/ bool SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue); diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 72060b43..188a8f2b 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -989,7 +989,7 @@ double TMoverParameters::ManualBrakeRatio(void) // Q: 20160713 // Zwraca objętość // ***************************************************************************** -double TMoverParameters::BrakeVP(void) +double TMoverParameters::BrakeVP(void) const { if (BrakeVVolume > 0) return Volume / (10.0 * BrakeVVolume); diff --git a/drivermode.cpp b/drivermode.cpp index 01bec808..54ec80a8 100644 --- a/drivermode.cpp +++ b/drivermode.cpp @@ -332,7 +332,7 @@ driver_mode::on_key( int const Key, int const Scancode, int const Action, int co } } - if( Action == GLFW_PRESS ) { + if( Action != GLFW_RELEASE ) { OnKeyDown( Key ); diff --git a/driveruilayer.cpp b/driveruilayer.cpp index 19c1bd5b..8057011a 100644 --- a/driveruilayer.cpp +++ b/driveruilayer.cpp @@ -13,18 +13,9 @@ http://mozilla.org/MPL/2.0/. #include "globals.h" #include "translation.h" #include "simulation.h" -#include "simulationtime.h" -#include "event.h" -#include "camera.h" -#include "mtable.h" #include "train.h" -#include "driver.h" #include "animmodel.h" -#include "dynobj.h" -#include "model3d.h" #include "renderer.h" -#include "utilities.h" -#include "logs.h" driver_ui::driver_ui() { diff --git a/driveruipanels.cpp b/driveruipanels.cpp index b677c8aa..71d54c45 100644 --- a/driveruipanels.cpp +++ b/driveruipanels.cpp @@ -346,12 +346,13 @@ debug_panel::update_section_vehicle( std::vector &Output ) { auto const &mover { *m_input.mover }; // f3 data - auto textline = "Vehicle name: " + mover.Name; + auto textline = "Name: " + mover.Name; if( ( vehicle.Mechanik == nullptr ) && ( vehicle.ctOwner ) ) { // for cars other than leading unit indicate the leader textline += ", owned by " + vehicle.ctOwner->OwnerName(); } + textline += "\nLoad: " + to_string( mover.Load, 0 ) + ' ' + mover.LoadType; textline += "\nStatus: " + mover.EngineDescription( 0 ); if( mover.WheelFlat > 0.01 ) { textline += " Flat: " + to_string( mover.WheelFlat, 1 ) + " mm"; @@ -359,17 +360,16 @@ debug_panel::update_section_vehicle( std::vector &Output ) { // informacja o sprzęgach textline += - "\nC0:" + + "\nCouplers:\n front: " + ( vehicle.PrevConnected ? - vehicle.PrevConnected->name() + ":" + to_string( mover.Couplers[ 0 ].CouplingFlag ) + ( + vehicle.PrevConnected->name() + " [" + to_string( mover.Couplers[ 0 ].CouplingFlag ) + "]" + ( mover.Couplers[ 0 ].CouplingFlag == 0 ? " (" + to_string( mover.Couplers[ 0 ].CoupleDist, 1 ) + " m)" : "" ) : - "none" ); - textline += - " C1:" + + "none" ) + + "\n rear: " + ( vehicle.NextConnected ? - vehicle.NextConnected->name() + ":" + to_string( mover.Couplers[ 1 ].CouplingFlag ) + ( + vehicle.NextConnected->name() + " [" + to_string( mover.Couplers[ 1 ].CouplingFlag ) + "]" + ( mover.Couplers[ 1 ].CouplingFlag == 0 ? " (" + to_string( mover.Couplers[ 1 ].CoupleDist, 1 ) + " m)" : "" ) : @@ -378,8 +378,10 @@ debug_panel::update_section_vehicle( std::vector &Output ) { Output.emplace_back( textline, Global.UITextColor ); // equipment flags - textline = ( mover.Battery ? "B" : "." ); + textline = "Devices: "; + textline += ( mover.Battery ? "B" : "." ); textline += ( mover.Mains ? "M" : "." ); + textline += ( mover.FuseFlag ? "!" : "." ); textline += ( mover.PantRearUp ? ( mover.PantRearVolt > 0.0 ? "O" : "o" ) : "." ); textline += ( mover.PantFrontUp ? ( mover.PantFrontVolt > 0.0 ? "P" : "p" ) : "." ); textline += ( mover.PantPressLockActive ? "!" : ( mover.PantPressSwitchActive ? "*" : "." ) ); @@ -393,37 +395,13 @@ debug_panel::update_section_vehicle( std::vector &Output ) { textline += ( mover.CompressorGovernorLock ? "!" : "." ); if( ( m_input.train != nullptr ) && ( m_input.train->Dynamic() == m_input.vehicle ) ) { - textline += ( mover.Radio ? " R: " : " r: " ) + std::to_string( m_input.train->RadioChannel() ); + textline += " radio: " + ( mover.Radio ? std::to_string( m_input.train->RadioChannel() ) : "(off)" ); + } + if( ( mover.EngineType == TEngineType::DieselElectric ) + || ( mover.EngineType == TEngineType::DieselEngine ) ) { + textline += ", oil pressure: " + to_string( mover.OilPump.pressure_present, 2 ); } - textline += " Bdelay: "; - if( ( mover.BrakeDelayFlag & bdelay_G ) == bdelay_G ) - textline += "G"; - if( ( mover.BrakeDelayFlag & bdelay_P ) == bdelay_P ) - textline += "P"; - if( ( mover.BrakeDelayFlag & bdelay_R ) == bdelay_R ) - textline += "R"; - if( ( mover.BrakeDelayFlag & bdelay_M ) == bdelay_M ) - textline += "+Mg"; - textline += ", Load: " + to_string( mover.Load, 0 ) + " (" + to_string( mover.LoadFlag, 0 ) + ")"; - - textline += - "\nFt: " + to_string( - mover.Ft * 0.001f * ( - mover.ActiveCab ? mover.ActiveCab : - vehicle.ctOwner ? vehicle.ctOwner->Controlling()->ActiveCab : - 1 ), 1 ) - + ", Fb: " + to_string( mover.Fb * 0.001f, 1 ) - + ", Fr: " + to_string( mover.Adhesive( mover.RunningTrack.friction ), 2 ) - + ( mover.SlippingWheels ? " (!)" : "" ); - - textline += - "\nPant: " - + to_string( mover.PantPress, 2 ) - + ( mover.bPantKurek3 ? "-ZG" : "|ZG" ); - textline += - " TC:" - + to_string( mover.TotalCurrent, 0 ); auto const frontcouplerhighvoltage = to_string( mover.Couplers[ side::front ].power_high.voltage, 0 ) + "@" @@ -432,7 +410,8 @@ debug_panel::update_section_vehicle( std::vector &Output ) { to_string( mover.Couplers[ side::rear ].power_high.voltage, 0 ) + "@" + to_string( mover.Couplers[ side::rear ].power_high.current, 0 ); - textline += ", HV: "; + + textline += "\nPower transfers: "; if( mover.Couplers[ side::front ].power_high.local == false ) { textline += "(" + frontcouplerhighvoltage + ")-" @@ -448,91 +427,101 @@ debug_panel::update_section_vehicle( std::vector &Output ) { Output.emplace_back( textline, Global.UITextColor ); - textline = - "TrB: " + to_string( mover.BrakePress, 2 ) - + ", " + to_hex_str( mover.Hamulec->GetBrakeStatus(), 2 ); + textline = "Controllers:\n master: " + std::to_string( mover.MainCtrlPos ) + "(" + std::to_string( mover.MainCtrlActualPos ) + ")" + + ", secondary: " + + ( ( mover.ShuntMode && mover.EngineType == TEngineType::DieselElectric ) ? + to_string( mover.AnPos, 2 ) + " (shunt mode)" : + std::to_string( mover.ScndCtrlPos ) + "(" + std::to_string( mover.ScndCtrlActualPos ) + ")" ); - textline += - "; LcB: " + to_string( mover.LocBrakePress, 2 ) - + "; hat: " + to_string( mover.BrakeCtrlPos2, 2 ) - + "\npipes: " + to_string( mover.PipePress, 2 ) - + "/" + to_string( mover.ScndPipePress, 2 ) - + "/" + to_string( mover.EqvtPipePress, 2 ) - + "\nMT: " + to_string( mover.CompressedVolume, 3 ) - + ", BT: " + to_string( mover.Volume, 3 ) - + ", CtlP: " + to_string( mover.CntrlPipePress, 3 ) - + ", CtlT: " + to_string( mover.Hamulec->GetCRP(), 3 ); + textline += "\nEngine output: " + to_string( mover.EnginePower, 1 ); + textline += ", current: " + + ( mover.TrainType == dt_EZT ? + std::to_string( int( mover.ShowCurrent( 0 ) ) ) : + std::to_string( int( mover.Im ) ) ); - if( mover.ManualBrakePos > 0 ) { - - textline += "; manual brake on"; + textline += "\nRevolutions:\n engine: " + to_string( mover.enrot * 60, 0 ) + + ", motors: " + to_string( std::abs( mover.nrot ) * mover.Transmision.Ratio * 60, 0 ) + + ", ventilators: " + to_string( mover.RventRot * 60, 0 ) + + ", fans: " + to_string( mover.dizel_heat.rpmw, 0 ) + "+" + to_string( mover.dizel_heat.rpmw2, 0 ); + if( ( mover.EngineType == TEngineType::DieselElectric ) + || ( mover.EngineType == TEngineType::DieselEngine ) ) { + textline += + "\nTemperatures:\n engine: " + to_string( mover.dizel_heat.Ts, 2 ) + + ", oil: " + to_string( mover.dizel_heat.To, 2 ) + + ", water: " + to_string( mover.dizel_heat.temperatura1, 2 ) + + ( mover.WaterCircuitsLink ? "-" : "|" ) + + to_string( mover.dizel_heat.temperatura2, 2 ); } Output.emplace_back( textline, Global.UITextColor ); - // debug mode f1 data - textline = - "vel: " + to_string( vehicle.GetVelocity(), 2 ) + "/" + to_string( mover.nrot* M_PI * mover.WheelDiameter * 3.6, 2 ) - + " km/h;" - + " dist: " + to_string( mover.DistCounter, 2 ) + " km" - + "\npos: [" + to_string( vehicle.GetPosition().x, 2 ) + ", " + to_string( vehicle.GetPosition().y, 2 ) + ", " + to_string( vehicle.GetPosition().z, 2 ) + "]" - + "\nenpwr=" + to_string( mover.EnginePower, 1 ) - + "; enrot=" + to_string( mover.enrot * 60, 0 ) - + " tmrot=" + to_string( std::abs( mover.nrot ) * mover.Transmision.Ratio * 60, 0 ) - + "; ventrot=" + to_string( mover.RventRot * 60, 1 ) - + "; fanrot=" + to_string( mover.dizel_heat.rpmw, 1 ) + ", " + to_string( mover.dizel_heat.rpmw2, 1 ); + textline = "Brakes:\n train: " + to_string( mover.fBrakeCtrlPos, 2 ) + + ", independent: " + to_string( mover.LocalBrakePosA, 2 ) + + ", delay: "; + if( ( mover.BrakeDelayFlag & bdelay_G ) == bdelay_G ) + textline += "G"; + if( ( mover.BrakeDelayFlag & bdelay_P ) == bdelay_P ) + textline += "P"; + if( ( mover.BrakeDelayFlag & bdelay_R ) == bdelay_R ) + textline += "R"; + if( ( mover.BrakeDelayFlag & bdelay_M ) == bdelay_M ) + textline += "+Mg"; + textline += ", load flag: " + to_string( mover.LoadFlag, 0 ); +/* + if( mover.ManualBrakePos > 0 ) { + + textline += "; manual brake on"; + } +*/ + textline += "\nBrake cylinder pressures:\n train: " + to_string( mover.BrakePress, 2 ) + + ", independent: " + to_string( mover.LocBrakePress, 2 ) + + ", status: " + to_hex_str( mover.Hamulec->GetBrakeStatus(), 2 ); + + textline += "\nPipe pressures:\n brake: " + to_string( mover.PipePress, 2 ) + + " (hat: " + to_string( mover.BrakeCtrlPos2, 2 ) + ")" + + ", main: " + to_string( mover.ScndPipePress, 2 ) + + ", control: " + to_string( mover.CntrlPipePress, 2 ); + + textline += "\nTank pressures:\n brake: " + to_string( mover.Volume, 2 ) + + ", main: " + to_string( mover.Compressor, 2 ) + + ", control: " + to_string( mover.Hamulec->GetCRP(), 2 ); + if( mover.EnginePowerSource.SourceType == TPowerSource::CurrentCollector ) { + textline += ", pantograph: " + to_string( mover.PantPress, 2 ) + ( mover.bPantKurek3 ? "-MT" : "|MT" ); + } Output.emplace_back( textline, Global.UITextColor ); - textline = - "HamZ=" + to_string( mover.fBrakeCtrlPos, 2 ) - + "; HamP=" + to_string( mover.LocalBrakePosA, 2 ) - + "; NasJ=" + std::to_string( mover.MainCtrlPos ) + "(" + std::to_string( mover.MainCtrlActualPos ) + ")" - + ( ( mover.ShuntMode && mover.EngineType == TEngineType::DieselElectric ) ? - "; NasB=" + to_string( mover.AnPos, 2 ) : - "; NasB=" + std::to_string( mover.ScndCtrlPos ) + "(" + std::to_string( mover.ScndCtrlActualPos ) + ")" ) - + "\nI=" + - ( mover.TrainType == dt_EZT ? - std::to_string( int( mover.ShowCurrent( 0 ) ) ) : - std::to_string( int( mover.Im ) ) ) - + "; U=" + to_string( int( mover.RunningTraction.TractionVoltage + 0.5 ) ) - + "; R=" + - ( std::abs( mover.RunningShape.R ) > 10000.0 ? - "~0.0" : - to_string( mover.RunningShape.R, 1 ) ) - + " An=" + to_string( mover.AccN, 2 ); // przyspieszenie poprzeczne + textline = "Forces:\n tractive: " + to_string( + mover.Ft * 0.001f * ( + mover.ActiveCab ? mover.ActiveCab : + vehicle.ctOwner ? vehicle.ctOwner->Controlling()->ActiveCab : + 1 ) + 0.001f, 1 ) + + ", brake: " + to_string( mover.Fb * 0.001f, 1 ) + + ", friction: " + to_string( mover.Adhesive( mover.RunningTrack.friction ), 2 ) + + ( mover.SlippingWheels ? " (!)" : "" ); if( tprev != simulation::Time.data().wSecond ) { tprev = simulation::Time.data().wSecond; Acc = ( mover.Vel - VelPrev ) / 3.6; VelPrev = mover.Vel; } - textline += "; As=" + to_string( Acc, 2 ); // przyspieszenie wzdłużne - // uitextline2 += " eAngle=" + to_string( std::cos( mover.eAngle ), 2 ); - textline += "\noilP=" + to_string( mover.OilPump.pressure_present, 3 ); - textline += " oilT=" + to_string( mover.dizel_heat.To, 2 ); - textline += "; waterT=" + to_string( mover.dizel_heat.temperatura1, 2 ); - textline += ( mover.WaterCircuitsLink ? "-" : "|" ); - textline += to_string( mover.dizel_heat.temperatura2, 2 ); - textline += "; engineT=" + to_string( mover.dizel_heat.Ts, 2 ); + + textline += "\nAcceleration:\n tangential: " + to_string( Acc, 2 ) + + ", normal: " + to_string( mover.AccN, 2 ) + + " (path radius: " + ( std::abs( mover.RunningShape.R ) > 10000.0 ? + "~0.0" : + to_string( mover.RunningShape.R, 0 ) ) + ")"; + + textline += "\nVelocity: " + to_string( vehicle.GetVelocity(), 2 ) + " / " + to_string( mover.nrot* M_PI * mover.WheelDiameter * 3.6, 2 ) + + ", distance traveled: " + to_string( mover.DistCounter, 2 ) + + "\nPosition: [" + to_string( vehicle.GetPosition().x, 2 ) + ", " + to_string( vehicle.GetPosition().y, 2 ) + ", " + to_string( vehicle.GetPosition().z, 2 ) + "]"; Output.emplace_back( textline, Global.UITextColor ); - - textline = - "cyl.ham. " + to_string( mover.BrakePress, 2 ) - + "; prz.gl. " + to_string( mover.PipePress, 2 ) - + "; zb.gl. " + to_string( mover.CompressedVolume, 2 ) - // youBy - drugi wezyk - + "; p.zas. " + to_string( mover.ScndPipePress, 2 ); - +/* + textline = " TC:" + to_string( mover.TotalCurrent, 0 ); +*/ +/* // McZapkie: warto wiedziec w jakim stanie sa przelaczniki - if( mover.ConvOvldFlag ) - textline += " C! "; - else if( mover.FuseFlag ) - textline += " F! "; - else if( !mover.Mains ) - textline += " () "; - else { switch( mover.ActiveDir * ( mover.Imin == mover.IminLo ? @@ -544,9 +533,6 @@ debug_panel::update_section_vehicle( std::vector &Output ) { case -1: { textline += " <- "; break; } case -2: { textline += " << "; break; } } - } - - Output.emplace_back( textline, Global.UITextColor ); // McZapkie: komenda i jej parametry if( mover.CommandIn.Command != ( "" ) ) { @@ -554,9 +540,8 @@ debug_panel::update_section_vehicle( std::vector &Output ) { "C:" + mover.CommandIn.Command + " V1=" + to_string( mover.CommandIn.Value1, 0 ) + " V2=" + to_string( mover.CommandIn.Value2, 0 ); - - Output.emplace_back( textline, Global.UITextColor ); } +*/ } void @@ -572,63 +557,58 @@ debug_panel::update_section_engine( std::vector &Output ) { // engine data // induction motor data - if( mover.EngineType == TEngineType::ElectricInductionMotor ) { + if( mover.EngineType == TEngineType::ElectricInductionMotor ) { - Output.emplace_back( " eimc: eimv: press:", Global.UITextColor ); - for( int i = 0; i <= 20; ++i ) { + Output.emplace_back( " eimc: eimv: press:", Global.UITextColor ); + for( int i = 0; i <= 20; ++i ) { - std::string parameters = - mover.eimc_labels[ i ] + to_string( mover.eimc[ i ], 2, 9 ) - + " | " - + mover.eimv_labels[ i ] + to_string( mover.eimv[ i ], 2, 9 ); + std::string parameters = + mover.eimc_labels[ i ] + to_string( mover.eimc[ i ], 2, 9 ) + + " | " + + mover.eimv_labels[ i ] + to_string( mover.eimv[ i ], 2, 9 ); - if( i < 10 ) { - parameters += " | " + train.fPress_labels[i] + to_string( train.fPress[ i ][ 0 ], 2, 9 ); - } - else if( i == 12 ) { - parameters += " med:"; - } - else if( i >= 13 ) { - parameters += " | " + vehicle.MED_labels[ i - 13 ] + to_string( vehicle.MED[ 0 ][ i - 13 ], 2, 9 ); - } + if( i < 10 ) { + parameters += " | " + train.fPress_labels[ i ] + to_string( train.fPress[ i ][ 0 ], 2, 9 ); + } + else if( i == 12 ) { + parameters += " med:"; + } + else if( i >= 13 ) { + parameters += " | " + vehicle.MED_labels[ i - 13 ] + to_string( vehicle.MED[ 0 ][ i - 13 ], 2, 9 ); + } - Output.emplace_back( parameters, Global.UITextColor ); - } - } - if ( mover.EngineType == TEngineType::DieselEngine) { - std::string parameters = "param value"; - Output.emplace_back(parameters, Global.UITextColor); - parameters = "efill: " + to_string( mover.dizel_fill, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "etorq: " + to_string( mover.dizel_Torque, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "creal: " + to_string( mover.dizel_engage, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "cdesi: " + to_string( mover.dizel_engagestate, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "cdelt: " + to_string( mover.dizel_engagedeltaomega, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "gears: " + to_string( mover.dizel_automaticgearstatus, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hydro value"; - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hTCnI: " + to_string( mover.hydro_TC_nIn, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hTCnO: " + to_string( mover.hydro_TC_nOut, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hTCTM: " + to_string( mover.hydro_TC_TMRatio, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hTCTI: " + to_string( mover.hydro_TC_TorqueIn, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hTCTO: " + to_string( mover.hydro_TC_TorqueOut, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hTCfl: " + to_string( mover.hydro_TC_Fill, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - parameters = "hTCLR: " + to_string( mover.hydro_TC_LockupRate, 2, 9); - Output.emplace_back(parameters, Global.UITextColor); - //parameters = "hTCXX: " + to_string(mover->hydro_TC_nIn, 2, 9); - //engine_lines.emplace_back(parameters, Global.UITextColor); - } + Output.emplace_back( parameters, Global.UITextColor ); + } + } + if( mover.EngineType == TEngineType::DieselEngine ) { + + std::string parameterstext = "param value"; + std::vector< std::pair > const paramvalues { + { "efill: ", mover.dizel_fill }, + { "etorq: ", mover.dizel_Torque }, + { "creal: ", mover.dizel_engage }, + { "cdesi: ", mover.dizel_engagestate }, + { "cdelt: ", mover.dizel_engagedeltaomega }, + { "gears: ", mover.dizel_automaticgearstatus} }; + for( auto const ¶meter : paramvalues ) { + parameterstext += "\n" + parameter.first + to_string( parameter.second, 2, 9 ); + } + Output.emplace_back( parameterstext, Global.UITextColor ); + + parameterstext = "hydro value"; + std::vector< std::pair > const hydrovalues { + { "hTCnI: ", mover.hydro_TC_nIn }, + { "hTCnO: ", mover.hydro_TC_nOut }, + { "hTCTM: ", mover.hydro_TC_TMRatio }, + { "hTCTI: ", mover.hydro_TC_TorqueIn }, + { "hTCTO: ", mover.hydro_TC_TorqueOut }, + { "hTCfl: ", mover.hydro_TC_Fill }, + { "hTCLR: ", mover.hydro_TC_LockupRate } }; + for( auto const ¶meter : hydrovalues ) { + parameterstext += "\n" + parameter.first + to_string( parameter.second, 2, 9 ); + } + Output.emplace_back( parameterstext, Global.UITextColor ); + } } void @@ -699,6 +679,12 @@ debug_panel::update_section_ai( std::vector &Output ) { Output.emplace_back( textline, Global.UITextColor ); + // brakes + textline = + "Brakes:\n consist: " + to_string( mechanik.fReady, 2 ) + " or less"; + + Output.emplace_back( textline, Global.UITextColor ); + // ai driving flags std::vector const drivingflagnames { "StopCloser", "StopPoint", "Active", "Press", "Connect", "Primary", "Late", "StopHere", diff --git a/uilayer.cpp b/uilayer.cpp index 817d9a49..38495317 100644 --- a/uilayer.cpp +++ b/uilayer.cpp @@ -11,21 +11,7 @@ http://mozilla.org/MPL/2.0/. #include "uilayer.h" #include "globals.h" -#include "translation.h" -#include "simulation.h" -#include "simulationtime.h" -#include "event.h" -#include "camera.h" -#include "mtable.h" -#include "train.h" -#include "driver.h" -#include "sceneeditor.h" -#include "animmodel.h" -#include "dynobj.h" -#include "model3d.h" #include "renderer.h" -#include "utilities.h" -#include "logs.h" #include "imgui_impl_glfw.h" #include "imgui_impl_opengl2.h" @@ -96,7 +82,7 @@ ui_layer::init_colors() { // configure ui colours auto *style = &ImGui::GetStyle(); auto *colors = style->Colors; - auto const background { ImVec4( 38.0f / 255.0f, 38.0f / 255.0f, 38.0f / 255.0f, 0.65f ) }; + auto const background { ImVec4( 38.0f / 255.0f, 38.0f / 255.0f, 38.0f / 255.0f, Global.UIBgOpacity ) }; auto const accent { ImVec4( 44.0f / 255.0f, 88.0f / 255.0f, 72.0f / 255.0f, 0.75f ) }; auto const itembase { ImVec4( accent.x, accent.y, accent.z, 0.35f ) }; auto const itemhover { ImVec4( accent.x, accent.y, accent.z, 0.65f ) }; diff --git a/version.h b/version.h index 9b7e61b3..10c18563 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 18 -#define VERSION_MINOR 830 +#define VERSION_MINOR 831 #define VERSION_REVISION 0