mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 00:59:18 +02:00
air temperature readout for python scripts, scenarion inspector ui mode
This commit is contained in:
4
Event.h
4
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 );
|
||||
|
||||
@@ -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)
|
||||
|
||||
83
Train.cpp
83
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 },
|
||||
|
||||
35
uilayer.cpp
35
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user