diff --git a/DynObj.cpp b/DynObj.cpp index 1e1393de..15930bdc 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -4562,7 +4562,8 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName, } if( !MoverParameters->LoadAccepted.empty() ) { - if( MoverParameters->EnginePowerSource.SourceType == CurrentCollector ) { + if( ( MoverParameters->EnginePowerSource.SourceType == CurrentCollector ) + && ( asLoadName == "pantstate" ) ) { // wartość niby "pantstate" - nazwa dla formalności, ważna jest ilość if( MoverParameters->Load == 1 ) { MoverParameters->PantFront( true ); diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 36ef0e90..47017c54 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -669,6 +669,7 @@ struct heat_data { // bool okienko { true }; // window in the engine compartment // system configuration bool auxiliary_water_circuit { false }; // cooling system has an extra water circuit + double fan_speed { 0.075 }; // cooling fan rpm; either fraction of engine rpm, or absolute value if negative // heat exchange factors double kw { 0.35 }; double kv { 0.6 }; diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 1222137e..5c7ef166 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -1616,7 +1616,7 @@ void TMoverParameters::OilPumpCheck( double const Timestep ) { OilPump.pressure_target = ( enrot > 0.1 ? interpolate( minpressure, OilPump.pressure_maximum, static_cast( clamp( enrot / maxrevolutions, 0.0, 1.0 ) ) ) * OilPump.resource_amount : - true == OilPump.is_active ? minpressure : + true == OilPump.is_active ? std::min( minpressure + 0.1f, OilPump.pressure_maximum ) : // slight pressure margin to give time to switch off the pump and start the engine 0.f ); if( OilPump.pressure_present < OilPump.pressure_target ) { @@ -6453,7 +6453,7 @@ void TMoverParameters::dizel_Heat( double const dt ) { && ( dizel_heat.water_aux.config.temp_cooling > 0 ) && ( dizel_heat.temperatura2 > dizel_heat.water_aux.config.temp_cooling - ( dizel_heat.water_aux.is_warm ? 8 : 0 ) ) ) ); auto const PTC2 { ( dizel_heat.water_aux.is_warm /*or PTC2p*/ ? 1 : 0 ) }; - dizel_heat.rpmwz2 = PTC2 * 80 * rpm / ( ( 0.5 * rpm ) + 500 ); + dizel_heat.rpmwz2 = PTC2 * ( dizel_heat.fan_speed >= 0 ? ( rpm * dizel_heat.fan_speed ) : ( dizel_heat.fan_speed * -1 ) ); dizel_heat.zaluzje2 = ( dizel_heat.water_aux.config.shutters ? ( PTC2 == 1 ) : true ); // no shutters is an equivalent to having them open auto const zaluzje2 { ( dizel_heat.zaluzje2 ? 1 : 0 ) }; // auxiliary water circuit heat transfer values @@ -6481,7 +6481,7 @@ void TMoverParameters::dizel_Heat( double const dt ) { && ( dizel_heat.water.config.temp_cooling > 0 ) && ( dizel_heat.temperatura1 > dizel_heat.water.config.temp_cooling - ( dizel_heat.water.is_warm ? 8 : 0 ) ) ) ); auto const PTC1 { ( dizel_heat.water.is_warm /*or PTC1p*/ ? 1 : 0 ) }; - dizel_heat.rpmwz = PTC1 * 80 * rpm / ( ( 0.5 * rpm ) + 500 ); + dizel_heat.rpmwz = PTC1 * ( dizel_heat.fan_speed >= 0 ? ( rpm * dizel_heat.fan_speed ) : ( dizel_heat.fan_speed * -1 ) ); dizel_heat.zaluzje1 = ( dizel_heat.water.config.shutters ? ( PTC1 == 1 ) : true ); // no shutters is an equivalent to having them open auto const zaluzje1 { ( dizel_heat.zaluzje1 ? 1 : 0 ) }; // primary water circuit heat transfer values @@ -8502,6 +8502,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &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_max, "OilMaxTemperature", Input, "" ); + extract_value( dizel_heat.fan_speed, "WaterCoolingFanSpeed", Input, "" ); // water heater extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" ); extract_value( WaterHeater.config.temp_max, "HeaterMaxTemperature", Input, "" ); diff --git a/Model3d.cpp b/Model3d.cpp index d3215806..2fe12510 100644 --- a/Model3d.cpp +++ b/Model3d.cpp @@ -1241,8 +1241,6 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic) LoadFromBinFile(asBinary, dynamic); asBinary = ""; // wyłączenie zapisu Init(); - // cache the file name, in case someone wants it later - m_filename = name + ".e3d"; } else { @@ -1253,10 +1251,10 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic) // pojazdy dopiero po ustawieniu animacji Init(); // generowanie siatek i zapis E3D } - // cache the file name, in case someone wants it later - m_filename = name + ".t3d"; } } + // cache the file name, in case someone wants it later + m_filename = name; bool const result = Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem if (false == result) diff --git a/Train.cpp b/Train.cpp index f298e28c..e72dc35b 100644 --- a/Train.cpp +++ b/Train.cpp @@ -206,6 +206,7 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = { { user_command::mubrakingindicatortoggle, &TTrain::OnCommand_mubrakingindicatortoggle }, { user_command::reverserincrease, &TTrain::OnCommand_reverserincrease }, { user_command::reverserdecrease, &TTrain::OnCommand_reverserdecrease }, + { user_command::reverserforwardhigh, &TTrain::OnCommand_reverserforwardhigh }, { user_command::reverserforward, &TTrain::OnCommand_reverserforward }, { user_command::reverserneutral, &TTrain::OnCommand_reverserneutral }, { user_command::reverserbackward, &TTrain::OnCommand_reverserbackward }, @@ -1464,9 +1465,20 @@ void TTrain::OnCommand_reverserdecrease( TTrain *Train, command_data const &Comm } } +void TTrain::OnCommand_reverserforwardhigh( TTrain *Train, command_data const &Command ) { + + if( Command.action == GLFW_PRESS ) { + + OnCommand_reverserforward( Train, Command ); + OnCommand_reverserincrease( Train, Command ); + } +} + void TTrain::OnCommand_reverserforward( TTrain *Train, command_data const &Command ) { if( Command.action == GLFW_PRESS ) { + // HACK: try to move the reverser one position back, in case it's set to "high forward" + OnCommand_reverserdecrease( Train, Command ); if( Train->mvOccupied->ActiveDir < 1 ) { diff --git a/Train.h b/Train.h index 7b0243c0..10416620 100644 --- a/Train.h +++ b/Train.h @@ -196,6 +196,7 @@ class TTrain static void OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data const &Command ); static void OnCommand_reverserincrease( TTrain *Train, command_data const &Command ); static void OnCommand_reverserdecrease( TTrain *Train, command_data const &Command ); + static void OnCommand_reverserforwardhigh( TTrain *Train, command_data const &Command ); static void OnCommand_reverserforward( TTrain *Train, command_data const &Command ); static void OnCommand_reverserneutral( TTrain *Train, command_data const &Command ); static void OnCommand_reverserbackward( TTrain *Train, command_data const &Command ); diff --git a/command.cpp b/command.cpp index bcc640d7..85d33b61 100644 --- a/command.cpp +++ b/command.cpp @@ -60,6 +60,7 @@ commanddescription_sequence Commands_descriptions = { { "sandboxactivate", command_target::vehicle }, { "reverserincrease", command_target::vehicle }, { "reverserdecrease", command_target::vehicle }, + { "reverserforwardhigh", command_target::vehicle }, { "reverserforward", command_target::vehicle }, { "reverserneutral", command_target::vehicle }, { "reverserbackward", command_target::vehicle }, diff --git a/command.h b/command.h index 547ea93c..d44e90fd 100644 --- a/command.h +++ b/command.h @@ -54,6 +54,7 @@ enum class user_command { sandboxactivate, reverserincrease, reverserdecrease, + reverserforwardhigh, reverserforward, reverserneutral, reverserbackward, diff --git a/keyboardinput.cpp b/keyboardinput.cpp index e12d1072..acede6ab 100644 --- a/keyboardinput.cpp +++ b/keyboardinput.cpp @@ -249,6 +249,8 @@ keyboard_input::default_bindings() { { GLFW_KEY_D }, // reverserdecrease { GLFW_KEY_R }, + // reverserforwardhigh + { -1 }, // reverserforward { -1 }, // reverserneutral diff --git a/material.cpp b/material.cpp index 3bd748d5..0cfad9d4 100644 --- a/material.cpp +++ b/material.cpp @@ -14,14 +14,6 @@ http://mozilla.org/MPL/2.0/. #include "utilities.h" #include "globals.h" -// helper, returns potential path part from provided file name -std::string path( std::string const &Filename ) { - return ( - Filename.rfind( '/' ) != std::string::npos ? - Filename.substr( 0, Filename.rfind( '/' ) + 1 ) : - "" ); -} - bool opengl_material::deserialize( cParser &Input, bool const Loadnow ) { diff --git a/utilities.cpp b/utilities.cpp index 1bb7fb98..af1deec4 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -377,3 +377,13 @@ replace_slashes( std::string &Filename ) { std::begin( Filename ), std::end( Filename ), '\\', '/' ); } + +// returns potential path part from provided file name +std::string +substr_path( std::string const &Filename ) { + + return ( + Filename.rfind( '/' ) != std::string::npos ? + Filename.substr( 0, Filename.rfind( '/' ) + 1 ) : + "" ); +} diff --git a/utilities.h b/utilities.h index d8344859..3bd9f9e8 100644 --- a/utilities.h +++ b/utilities.h @@ -192,6 +192,9 @@ erase_extension( std::string &Filename ); void replace_slashes( std::string &Filename ); +// returns potential path part from provided file name +std::string substr_path( std::string const &Filename ); + template void SafeDelete( Type_ &Pointer ) { delete Pointer; @@ -229,6 +232,8 @@ template Type_ min_speed( Type_ const Left, Type_ const Right ) { + if( Left == Right ) { return Left; } + return std::min( ( Left != -1 ? Left : diff --git a/version.h b/version.h index 036ce179..7166095d 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 18 -#define VERSION_MINOR 527 +#define VERSION_MINOR 531 #define VERSION_REVISION 0