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

Merge branch 'MaSzyna-EU07:master' into lua-refactor

This commit is contained in:
jakubg1
2026-04-15 18:08:42 +02:00
committed by GitHub
6 changed files with 52 additions and 2 deletions

View File

@@ -1056,7 +1056,7 @@ class TMoverParameters
bool is_warm{false}; // fluid is too hot bool is_warm{false}; // fluid is too hot
bool is_hot{false}; // fluid temperature crossed cooling threshold bool is_hot{false}; // fluid temperature crossed cooling threshold
bool is_flowing{false}; // fluid is being pushed through the circuit bool is_flowing{false}; // fluid is being pushed through the circuit
} water, water_aux, oil; } water, water_aux, oil, engine;
// output, state of affected devices // output, state of affected devices
bool PA{false}; // malfunction flag bool PA{false}; // malfunction flag
float rpmw{0.0}; // current main circuit fan revolutions float rpmw{0.0}; // current main circuit fan revolutions
@@ -1077,6 +1077,9 @@ class TMoverParameters
float temperatura1{50.0}; float temperatura1{50.0};
float temperatura2{40.0}; float temperatura2{40.0};
float powerfactor{1.0}; // coefficient of heat generation for engines other than su45 float powerfactor{1.0}; // coefficient of heat generation for engines other than su45
// engine overheat threshold
float engine_max_temp{-1}; // maximum acceptable engine temperature, triggers overheat lamp when exceeded
bool engine_is_hot{false}; // engine temperature crossed cooling threshold
}; };
struct spring_brake struct spring_brake

View File

@@ -8156,6 +8156,10 @@ void TMoverParameters::dizel_Heat( double const dt ) {
dizel_heat.oil.is_hot = ( dizel_heat.oil.is_hot = (
( dizel_heat.oil.config.temp_max > 0 ) ( dizel_heat.oil.config.temp_max > 0 )
&& ( dizel_heat.To > dizel_heat.oil.config.temp_max - ( dizel_heat.oil.is_hot ? 8 : 0 ) ) ); && ( dizel_heat.To > dizel_heat.oil.config.temp_max - ( dizel_heat.oil.is_hot ? 8 : 0 ) ) );
// engine overheat check
dizel_heat.engine_is_hot = (
( dizel_heat.engine_max_temp > 0 )
&& ( dizel_heat.Ts > dizel_heat.engine_max_temp - ( dizel_heat.engine_is_hot ? 8 : 0 ) ) );
auto const PT = ( auto const PT = (
( false == dizel_heat.water.is_cold ) ( false == dizel_heat.water.is_cold )
@@ -8163,7 +8167,8 @@ void TMoverParameters::dizel_Heat( double const dt ) {
&& ( false == dizel_heat.water_aux.is_cold ) && ( false == dizel_heat.water_aux.is_cold )
&& ( false == dizel_heat.water_aux.is_hot ) && ( false == dizel_heat.water_aux.is_hot )
&& ( false == dizel_heat.oil.is_cold ) && ( false == dizel_heat.oil.is_cold )
&& ( false == dizel_heat.oil.is_hot ) /* && ( false == awaria_termostatow ) */ ) /* || PTp */; && ( false == dizel_heat.oil.is_hot )
&& ( false == dizel_heat.engine.is_hot ) /* && ( false == awaria_termostatow ) */ ) /* || PTp */;
auto const PPT = ( false == PT ) /* && ( false == PPTp ) */; auto const PPT = ( false == PT ) /* && ( false == PPTp ) */;
dizel_heat.PA = ( /* ( ( !zamkniecie or niedomkniecie ) and !WBD ) || */ PPT /* || nurnik || ( woda < 7 ) */ ) /* && ( !PAp ) */; dizel_heat.PA = ( /* ( ( !zamkniecie or niedomkniecie ) and !WBD ) || */ PPT /* || nurnik || ( woda < 7 ) */ ) /* && ( !PAp ) */;
@@ -11236,6 +11241,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
extract_value( dizel_heat.water_aux.config.shutters, "WaterAuxShutters", Input, "" ); extract_value( dizel_heat.water_aux.config.shutters, "WaterAuxShutters", Input, "" );
extract_value( dizel_heat.oil.config.temp_min, "OilMinTemperature", Input, "" ); extract_value( dizel_heat.oil.config.temp_min, "OilMinTemperature", Input, "" );
extract_value( dizel_heat.oil.config.temp_max, "OilMaxTemperature", Input, "" ); extract_value( dizel_heat.oil.config.temp_max, "OilMaxTemperature", Input, "" );
extract_value( dizel_heat.engine_max_temp, "EngineMaxTemperature", Input, "" );
extract_value( dizel_heat.fan_speed, "WaterCoolingFanSpeed", Input, "" ); extract_value( dizel_heat.fan_speed, "WaterCoolingFanSpeed", Input, "" );
// water heater // water heater
extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" ); extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" );

View File

@@ -91,6 +91,8 @@ std::vector<std::string> scenarioloader_ui::get_random_trivia()
int i = RandomInt(0, static_cast<int>(triviaData.size()) - 1); int i = RandomInt(0, static_cast<int>(triviaData.size()) - 1);
std::string triviaStr = triviaData[i]["text"]; std::string triviaStr = triviaData[i]["text"];
std::string background = triviaData[i]["background"]; std::string background = triviaData[i]["background"];
if (triviaData[i].contains("scenery"))
sceneryName = triviaData[i]["scenery"];
// divide trivia into multiple lines - UTF-8 safe implementation // divide trivia into multiple lines - UTF-8 safe implementation
// Different languages need different character limits due to character width differences // Different languages need different character limits due to character width differences
@@ -275,6 +277,15 @@ void scenarioloader_ui::render_()
draw_list->AddText(text_pos, IM_COL32_WHITE, line.c_str()); draw_list->AddText(text_pos, IM_COL32_WHITE, line.c_str());
} }
} }
// Scenery name
// Draw only if defined
if (!sceneryName.empty())
{
ImVec2 text_size = ImGui::CalcTextSize(sceneryName.c_str());
ImVec2 text_pos = ImVec2(screen_size.x - 16 - text_size.x, 16);
draw_list->AddText(text_pos, IM_COL32_WHITE, sceneryName.c_str());
}
// Progress bar at the bottom of the screen // Progress bar at the bottom of the screen
const auto p1 = ImVec2(0, Global.window_size.y - 2); const auto p1 = ImVec2(0, Global.window_size.y - 2);

View File

@@ -30,4 +30,9 @@ private:
std::vector<std::string> get_random_trivia(); std::vector<std::string> get_random_trivia();
void generate_gradient_tex(); void generate_gradient_tex();
void load_wheel_frames(); void load_wheel_frames();
/// <summary>
/// Scenery name for eligable trivias
/// </summary>
std::string sceneryName;
}; };

View File

@@ -7926,6 +7926,11 @@ bool TTrain::Update( double const Deltatime )
btLampkaRearRightEndLight.Turn( ( mvOccupied->iLights[ end::rear ] & light::redmarker_right ) != 0 ); btLampkaRearRightEndLight.Turn( ( mvOccupied->iLights[ end::rear ] & light::redmarker_right ) != 0 );
// others // others
btLampkaMalfunction.Turn( mvControlled->dizel_heat.PA ); btLampkaMalfunction.Turn( mvControlled->dizel_heat.PA );
// overheat indicator lamps
btLampkaOilOverheat.Turn( mvControlled->dizel_heat.oil.is_hot );
btLampkaWaterOverheat.Turn( mvControlled->dizel_heat.water.is_hot );
btLampkaWaterAuxOverheat.Turn( mvControlled->dizel_heat.water_aux.is_hot );
btLampkaEngineOverheat.Turn( mvControlled->dizel_heat.engine_is_hot );
btLampkaMotorBlowers.Turn( ( mvControlled->MotorBlowers[ end::front ].is_active ) && ( mvControlled->MotorBlowers[ end::rear ].is_active ) ); btLampkaMotorBlowers.Turn( ( mvControlled->MotorBlowers[ end::front ].is_active ) && ( mvControlled->MotorBlowers[ end::rear ].is_active ) );
btLampkaCoolingFans.Turn( mvControlled->RventRot > 1.0 ); btLampkaCoolingFans.Turn( mvControlled->RventRot > 1.0 );
btLampkaTempomat.Turn( mvOccupied->SpeedCtrlUnit.IsActive ); btLampkaTempomat.Turn( mvOccupied->SpeedCtrlUnit.IsActive );
@@ -7966,6 +7971,11 @@ bool TTrain::Update( double const Deltatime )
btLampkaBrakeProfileR.Turn( false ); btLampkaBrakeProfileR.Turn( false );
btLampkaSpringBrakeActive.Turn( false ); btLampkaSpringBrakeActive.Turn( false );
btLampkaSpringBrakeInactive.Turn( false ); btLampkaSpringBrakeInactive.Turn( false );
// overheat indicator lamps off
btLampkaOilOverheat.Turn( false );
btLampkaWaterOverheat.Turn( false );
btLampkaWaterAuxOverheat.Turn( false );
btLampkaEngineOverheat.Turn( false );
btLampkaMaxSila.Turn( false ); btLampkaMaxSila.Turn( false );
btLampkaPrzekrMaxSila.Turn( false ); btLampkaPrzekrMaxSila.Turn( false );
btLampkaRadio.Turn( false ); btLampkaRadio.Turn( false );
@@ -9756,6 +9766,11 @@ void TTrain::clear_cab_controls()
btLampkaNadmWent.Clear(9); btLampkaNadmWent.Clear(9);
btLampkaWysRozr.Clear(((mvControlled->TrainType & dt_ET22) != 0) ? -1 : 10); // ET22 nie ma tej lampki btLampkaWysRozr.Clear(((mvControlled->TrainType & dt_ET22) != 0) ? -1 : 10); // ET22 nie ma tej lampki
btLampkaOgrzewanieSkladu.Clear(11); btLampkaOgrzewanieSkladu.Clear(11);
// overheat indicator lamps
btLampkaOilOverheat.Clear(-1);
btLampkaWaterOverheat.Clear(-1);
btLampkaWaterAuxOverheat.Clear(-1);
btLampkaEngineOverheat.Clear(-1);
btHaslerBrakes.Clear(12); // ciśnienie w cylindrach do odbijania na haslerze btHaslerBrakes.Clear(12); // ciśnienie w cylindrach do odbijania na haslerze
btHaslerCurrent.Clear(13); // prąd na silnikach do odbijania na haslerze btHaslerCurrent.Clear(13); // prąd na silnikach do odbijania na haslerze
// Numer 14 jest używany dla buczka SHP w update_sounds() // Numer 14 jest używany dla buczka SHP w update_sounds()
@@ -10425,6 +10440,11 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
{ "i-mainbreakerblinking:", btLampkaMainBreakerBlinkingIfReady }, { "i-mainbreakerblinking:", btLampkaMainBreakerBlinkingIfReady },
{ "i-vent_ovld:", btLampkaNadmWent }, { "i-vent_ovld:", btLampkaNadmWent },
{ "i-comp_ovld:", btLampkaNadmSpr }, { "i-comp_ovld:", btLampkaNadmSpr },
// overheat indicator lamps
{ "i-oil_overheat:", btLampkaOilOverheat },
{ "i-water_overheat:", btLampkaWaterOverheat },
{ "i-wateraux_overheat:", btLampkaWaterAuxOverheat },
{ "i-engine_overheat:", btLampkaEngineOverheat },
{ "i-resistors:", btLampkaOpory }, { "i-resistors:", btLampkaOpory },
{ "i-no_resistors:", btLampkaBezoporowa }, { "i-no_resistors:", btLampkaBezoporowa },
{ "i-no_resistors_b:", btLampkaBezoporowaB }, { "i-no_resistors_b:", btLampkaBezoporowaB },

View File

@@ -761,6 +761,11 @@ public: // reszta może by?publiczna
TButton btLampkaBrakeProfileR; // rapid brake acting speed TButton btLampkaBrakeProfileR; // rapid brake acting speed
TButton btLampkaSpringBrakeActive; TButton btLampkaSpringBrakeActive;
TButton btLampkaSpringBrakeInactive; TButton btLampkaSpringBrakeInactive;
// overheat indicator lamps
TButton btLampkaOilOverheat;
TButton btLampkaWaterOverheat;
TButton btLampkaWaterAuxOverheat;
TButton btLampkaEngineOverheat;
// KURS90 // KURS90
TButton btLampkaBoczniki; TButton btLampkaBoczniki;
TButton btLampkaMaxSila; TButton btLampkaMaxSila;