mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 19:49:19 +02:00
build 180531. configurable cooling fans rotation rate, additional reverser position command, minor bug fixes
This commit is contained in:
@@ -4562,7 +4562,8 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
|||||||
}
|
}
|
||||||
if( !MoverParameters->LoadAccepted.empty() ) {
|
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ść
|
// wartość niby "pantstate" - nazwa dla formalności, ważna jest ilość
|
||||||
if( MoverParameters->Load == 1 ) {
|
if( MoverParameters->Load == 1 ) {
|
||||||
MoverParameters->PantFront( true );
|
MoverParameters->PantFront( true );
|
||||||
|
|||||||
@@ -669,6 +669,7 @@ struct heat_data {
|
|||||||
// bool okienko { true }; // window in the engine compartment
|
// bool okienko { true }; // window in the engine compartment
|
||||||
// system configuration
|
// system configuration
|
||||||
bool auxiliary_water_circuit { false }; // cooling system has an extra water circuit
|
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
|
// heat exchange factors
|
||||||
double kw { 0.35 };
|
double kw { 0.35 };
|
||||||
double kv { 0.6 };
|
double kv { 0.6 };
|
||||||
|
|||||||
@@ -1616,7 +1616,7 @@ void TMoverParameters::OilPumpCheck( double const Timestep ) {
|
|||||||
|
|
||||||
OilPump.pressure_target = (
|
OilPump.pressure_target = (
|
||||||
enrot > 0.1 ? interpolate( minpressure, OilPump.pressure_maximum, static_cast<float>( clamp( enrot / maxrevolutions, 0.0, 1.0 ) ) ) * OilPump.resource_amount :
|
enrot > 0.1 ? interpolate( minpressure, OilPump.pressure_maximum, static_cast<float>( 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 );
|
0.f );
|
||||||
|
|
||||||
if( OilPump.pressure_present < OilPump.pressure_target ) {
|
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.water_aux.config.temp_cooling > 0 )
|
||||||
&& ( dizel_heat.temperatura2 > dizel_heat.water_aux.config.temp_cooling - ( dizel_heat.water_aux.is_warm ? 8 : 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 ) };
|
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
|
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 ) };
|
auto const zaluzje2 { ( dizel_heat.zaluzje2 ? 1 : 0 ) };
|
||||||
// auxiliary water circuit heat transfer values
|
// 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.water.config.temp_cooling > 0 )
|
||||||
&& ( dizel_heat.temperatura1 > dizel_heat.water.config.temp_cooling - ( dizel_heat.water.is_warm ? 8 : 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 ) };
|
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
|
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 ) };
|
auto const zaluzje1 { ( dizel_heat.zaluzje1 ? 1 : 0 ) };
|
||||||
// primary water circuit heat transfer values
|
// 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.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.fan_speed, "WaterCoolingFanSpeed", Input, "" );
|
||||||
// water heater
|
// water heater
|
||||||
extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" );
|
extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" );
|
||||||
extract_value( WaterHeater.config.temp_max, "HeaterMaxTemperature", Input, "" );
|
extract_value( WaterHeater.config.temp_max, "HeaterMaxTemperature", Input, "" );
|
||||||
|
|||||||
@@ -1241,8 +1241,6 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
|
|||||||
LoadFromBinFile(asBinary, dynamic);
|
LoadFromBinFile(asBinary, dynamic);
|
||||||
asBinary = ""; // wyłączenie zapisu
|
asBinary = ""; // wyłączenie zapisu
|
||||||
Init();
|
Init();
|
||||||
// cache the file name, in case someone wants it later
|
|
||||||
m_filename = name + ".e3d";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1253,10 +1251,10 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
|
|||||||
// pojazdy dopiero po ustawieniu animacji
|
// pojazdy dopiero po ustawieniu animacji
|
||||||
Init(); // generowanie siatek i zapis E3D
|
Init(); // generowanie siatek i zapis E3D
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// cache the file name, in case someone wants it later
|
// cache the file name, in case someone wants it later
|
||||||
m_filename = name + ".t3d";
|
m_filename = name;
|
||||||
}
|
|
||||||
}
|
|
||||||
bool const result =
|
bool const result =
|
||||||
Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem
|
Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem
|
||||||
if (false == result)
|
if (false == result)
|
||||||
|
|||||||
12
Train.cpp
12
Train.cpp
@@ -206,6 +206,7 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::mubrakingindicatortoggle, &TTrain::OnCommand_mubrakingindicatortoggle },
|
{ user_command::mubrakingindicatortoggle, &TTrain::OnCommand_mubrakingindicatortoggle },
|
||||||
{ user_command::reverserincrease, &TTrain::OnCommand_reverserincrease },
|
{ user_command::reverserincrease, &TTrain::OnCommand_reverserincrease },
|
||||||
{ user_command::reverserdecrease, &TTrain::OnCommand_reverserdecrease },
|
{ user_command::reverserdecrease, &TTrain::OnCommand_reverserdecrease },
|
||||||
|
{ user_command::reverserforwardhigh, &TTrain::OnCommand_reverserforwardhigh },
|
||||||
{ user_command::reverserforward, &TTrain::OnCommand_reverserforward },
|
{ user_command::reverserforward, &TTrain::OnCommand_reverserforward },
|
||||||
{ user_command::reverserneutral, &TTrain::OnCommand_reverserneutral },
|
{ user_command::reverserneutral, &TTrain::OnCommand_reverserneutral },
|
||||||
{ user_command::reverserbackward, &TTrain::OnCommand_reverserbackward },
|
{ 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 ) {
|
void TTrain::OnCommand_reverserforward( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
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 ) {
|
if( Train->mvOccupied->ActiveDir < 1 ) {
|
||||||
|
|
||||||
|
|||||||
1
Train.h
1
Train.h
@@ -196,6 +196,7 @@ class TTrain
|
|||||||
static void OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_reverserincrease( 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_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_reverserforward( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_reverserneutral( 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 );
|
static void OnCommand_reverserbackward( TTrain *Train, command_data const &Command );
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "sandboxactivate", command_target::vehicle },
|
{ "sandboxactivate", command_target::vehicle },
|
||||||
{ "reverserincrease", command_target::vehicle },
|
{ "reverserincrease", command_target::vehicle },
|
||||||
{ "reverserdecrease", command_target::vehicle },
|
{ "reverserdecrease", command_target::vehicle },
|
||||||
|
{ "reverserforwardhigh", command_target::vehicle },
|
||||||
{ "reverserforward", command_target::vehicle },
|
{ "reverserforward", command_target::vehicle },
|
||||||
{ "reverserneutral", command_target::vehicle },
|
{ "reverserneutral", command_target::vehicle },
|
||||||
{ "reverserbackward", command_target::vehicle },
|
{ "reverserbackward", command_target::vehicle },
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ enum class user_command {
|
|||||||
sandboxactivate,
|
sandboxactivate,
|
||||||
reverserincrease,
|
reverserincrease,
|
||||||
reverserdecrease,
|
reverserdecrease,
|
||||||
|
reverserforwardhigh,
|
||||||
reverserforward,
|
reverserforward,
|
||||||
reverserneutral,
|
reverserneutral,
|
||||||
reverserbackward,
|
reverserbackward,
|
||||||
|
|||||||
@@ -249,6 +249,8 @@ keyboard_input::default_bindings() {
|
|||||||
{ GLFW_KEY_D },
|
{ GLFW_KEY_D },
|
||||||
// reverserdecrease
|
// reverserdecrease
|
||||||
{ GLFW_KEY_R },
|
{ GLFW_KEY_R },
|
||||||
|
// reverserforwardhigh
|
||||||
|
{ -1 },
|
||||||
// reverserforward
|
// reverserforward
|
||||||
{ -1 },
|
{ -1 },
|
||||||
// reverserneutral
|
// reverserneutral
|
||||||
|
|||||||
@@ -14,14 +14,6 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "globals.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
|
bool
|
||||||
opengl_material::deserialize( cParser &Input, bool const Loadnow ) {
|
opengl_material::deserialize( cParser &Input, bool const Loadnow ) {
|
||||||
|
|
||||||
|
|||||||
@@ -377,3 +377,13 @@ replace_slashes( std::string &Filename ) {
|
|||||||
std::begin( Filename ), std::end( 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 ) :
|
||||||
|
"" );
|
||||||
|
}
|
||||||
|
|||||||
@@ -192,6 +192,9 @@ erase_extension( std::string &Filename );
|
|||||||
void
|
void
|
||||||
replace_slashes( std::string &Filename );
|
replace_slashes( std::string &Filename );
|
||||||
|
|
||||||
|
// returns potential path part from provided file name
|
||||||
|
std::string substr_path( std::string const &Filename );
|
||||||
|
|
||||||
template <typename Type_>
|
template <typename Type_>
|
||||||
void SafeDelete( Type_ &Pointer ) {
|
void SafeDelete( Type_ &Pointer ) {
|
||||||
delete Pointer;
|
delete Pointer;
|
||||||
@@ -229,6 +232,8 @@ template <typename Type_>
|
|||||||
Type_
|
Type_
|
||||||
min_speed( Type_ const Left, Type_ const Right ) {
|
min_speed( Type_ const Left, Type_ const Right ) {
|
||||||
|
|
||||||
|
if( Left == Right ) { return Left; }
|
||||||
|
|
||||||
return std::min(
|
return std::min(
|
||||||
( Left != -1 ?
|
( Left != -1 ?
|
||||||
Left :
|
Left :
|
||||||
|
|||||||
Reference in New Issue
Block a user