diff --git a/Event.h b/Event.h index 6ae2fa92..27bad969 100644 --- a/Event.h +++ b/Event.h @@ -132,6 +132,10 @@ public: bool insert( TEventLauncher *Launcher ) { return m_launchers.insert( Launcher ); } + // returns first event in the queue + TEvent * + begin() { + return QueryRootEvent; } // legacy method, returns pointer to specified event, or null TEvent * FindEvent( std::string const &Name ); diff --git a/Globals.cpp b/Globals.cpp index 4c1e9048..df17cb64 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -322,7 +322,9 @@ global_settings::ConfigParse(cParser &Parser) { // selected device for audio renderer Parser.getTokens(); Parser >> AirTemperature; - AirTemperature = clamp( AirTemperature, -15.f, 45.f ); + if( false == DebugModeFlag ) { + AirTemperature = clamp( AirTemperature, -15.f, 45.f ); + } } else if( token == "scalespeculars" ) { // whether strength of specular highlights should be adjusted (generally needed for legacy 3d models) diff --git a/Train.cpp b/Train.cpp index 3124b6e0..e805954e 100644 --- a/Train.cpp +++ b/Train.cpp @@ -535,6 +535,7 @@ PyObject *TTrain::GetTrainState() { PyDict_SetItemString( dict, "hours", PyGetInt( simulation::Time.data().wHour ) ); PyDict_SetItemString( dict, "minutes", PyGetInt( simulation::Time.data().wMinute ) ); PyDict_SetItemString( dict, "seconds", PyGetInt( simulation::Time.second() ) ); + PyDict_SetItemString( dict, "air_temperature", PyGetInt( Global.AirTemperature ) ); return dict; } @@ -6396,44 +6397,60 @@ void TTrain::set_cab_controls() { ggRadioChannelSelector.PutValue( iRadioChannel - 1 ); // pantographs if( mvOccupied->PantSwitchType != "impulse" ) { - ggPantFrontButton.PutValue( - ( mvControlled->PantFrontUp ? - 1.0 : - 0.0 ) ); - ggPantFrontButtonOff.PutValue( - ( mvControlled->PantFrontUp ? - 0.0 : - 1.0 ) ); + if( ggPantFrontButton.SubModel ) { + ggPantFrontButton.PutValue( + ( mvControlled->PantFrontUp ? + 1.0 : + 0.0 ) ); + } + if( ggPantFrontButtonOff.SubModel ) { + ggPantFrontButtonOff.PutValue( + ( mvControlled->PantFrontUp ? + 0.0 : + 1.0 ) ); + } // NOTE: currently we animate the selectable pantograph control for both pantographs // TODO: implement actual selection control, and refactor handling this control setup in a separate method - ggPantSelectedButton.PutValue( - ( mvControlled->PantFrontUp ? - 1.0 : - 0.0 ) ); - ggPantSelectedDownButton.PutValue( - ( mvControlled->PantFrontUp ? - 0.0 : - 1.0 ) ); + if( ggPantSelectedButton.SubModel ) { + ggPantSelectedButton.PutValue( + ( mvControlled->PantFrontUp ? + 1.0 : + 0.0 ) ); + } + if( ggPantSelectedDownButton.SubModel ) { + ggPantSelectedDownButton.PutValue( + ( mvControlled->PantFrontUp ? + 0.0 : + 1.0 ) ); + } } if( mvOccupied->PantSwitchType != "impulse" ) { - ggPantRearButton.PutValue( - ( mvControlled->PantRearUp ? - 1.0 : - 0.0 ) ); - ggPantRearButtonOff.PutValue( - ( mvControlled->PantRearUp ? - 0.0 : - 1.0 ) ); + if( ggPantRearButton.SubModel ) { + ggPantRearButton.PutValue( + ( mvControlled->PantRearUp ? + 1.0 : + 0.0 ) ); + } + if( ggPantRearButtonOff.SubModel ) { + ggPantRearButtonOff.PutValue( + ( mvControlled->PantRearUp ? + 0.0 : + 1.0 ) ); + } // NOTE: currently we animate the selectable pantograph control for both pantographs // TODO: implement actual selection control, and refactor handling this control setup in a separate method - ggPantSelectedButton.PutValue( - ( mvControlled->PantRearUp ? - 1.0 : - 0.0 ) ); - ggPantSelectedDownButton.PutValue( - ( mvControlled->PantRearUp ? - 0.0 : - 1.0 ) ); + if( ggPantSelectedButton.SubModel ) { + ggPantSelectedButton.PutValue( + ( mvControlled->PantRearUp ? + 1.0 : + 0.0 ) ); + } + if( ggPantSelectedDownButton.SubModel ) { + ggPantSelectedDownButton.PutValue( + ( mvControlled->PantRearUp ? + 0.0 : + 1.0 ) ); + } } // auxiliary compressor ggPantCompressorValve.PutValue( @@ -6750,7 +6767,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con { "horn_bt:", ggHornButton }, { "hornlow_bt:", ggHornLowButton }, { "hornhigh_bt:", ggHornHighButton }, - { "whistle_bt:", ggHornHighButton }, + { "whistle_bt:", ggWhistleButton }, { "fuse_bt:", ggFuseButton }, { "converterfuse_bt:", ggConverterFuseButton }, { "stlinoff_bt:", ggStLinOffButton }, diff --git a/uilayer.cpp b/uilayer.cpp index 3e81b53f..da030c78 100644 --- a/uilayer.cpp +++ b/uilayer.cpp @@ -184,6 +184,12 @@ ui_layer::on_key( int const Key, int const Action ) { return true; } + case GLFW_KEY_F11: { + // scenario inspector + Global.iTextMode = Key; + return true; + } + case GLFW_KEY_F12: { // coś tam jeszcze Global.iTextMode = Key; @@ -641,7 +647,34 @@ ui_layer::update() { case( GLFW_KEY_F10 ) : { - uitextline1 = ( "Press [Y] key to quit / Aby zakonczyc program, przycisnij klawisz [Y]." ); + uitextline1 = "Press [Y] key to quit / Aby zakonczyc program, przycisnij klawisz [Y]."; + + break; + } + + case( GLFW_KEY_F11 ): { + // scenario inspector + auto const time { Timer::GetTime() }; + auto const *event { simulation::Events.begin() }; + auto eventtableindex{ 0 }; + while( ( event != nullptr ) + && ( eventtableindex < 30 ) ) { + + if( ( false == event->m_ignored ) + && ( true == event->bEnabled ) ) { + + auto const delay { " " + to_string( std::max( 0.0, event->fStartTime - time ), 1 ) }; + auto const eventline = + "Delay: " + delay.substr( delay.length() - 6 ) + + ", Event: " + event->asName + + ( event->Activator ? " (by: " + event->Activator->asName + ")" : "" ) + + ( event->evJoined ? " (joint event)" : "" ); + + UITable->text_lines.emplace_back( eventline, Global.UITextColor ); + ++eventtableindex; + } + event = event->evNext; + } break; }