mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 08:09:19 +02:00
remove smooth brake control for levers other than FV4a
This commit is contained in:
@@ -524,10 +524,14 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
}
|
}
|
||||||
else if (token == "brakestep")
|
else if (token == "brakestep")
|
||||||
{
|
{
|
||||||
// krok zmiany hamulca dla klawiszy [Num3] i [Num9]
|
|
||||||
Parser.getTokens(1, false);
|
Parser.getTokens(1, false);
|
||||||
Parser >> fBrakeStep;
|
Parser >> fBrakeStep;
|
||||||
}
|
}
|
||||||
|
else if (token == "brakespeed")
|
||||||
|
{
|
||||||
|
Parser.getTokens(1, false);
|
||||||
|
Parser >> brake_speed;
|
||||||
|
}
|
||||||
else if (token == "joinduplicatedevents")
|
else if (token == "joinduplicatedevents")
|
||||||
{
|
{
|
||||||
// czy grupować eventy o tych samych nazwach
|
// czy grupować eventy o tych samych nazwach
|
||||||
|
|||||||
@@ -138,7 +138,8 @@ struct global_settings {
|
|||||||
int iFeedbackPort{ 0 }; // dodatkowy adres dla informacji zwrotnych
|
int iFeedbackPort{ 0 }; // dodatkowy adres dla informacji zwrotnych
|
||||||
bool InputGamepad{ true }; // whether gamepad support is enabled
|
bool InputGamepad{ true }; // whether gamepad support is enabled
|
||||||
bool InputMouse{ true }; // whether control pick mode can be activated
|
bool InputMouse{ true }; // whether control pick mode can be activated
|
||||||
double fBrakeStep{ 1.0 }; // krok zmiany hamulca dla klawiszy [Num3] i [Num9]
|
double fBrakeStep { 1.0 }; // krok zmiany hamulca innych niż FV4a dla klawiszy [Num3] i [Num9]
|
||||||
|
double brake_speed { 3.0 }; // prędkość przesuwu hamulca dla FV4a
|
||||||
// parametry kalibracyjne wejść z pulpitu
|
// parametry kalibracyjne wejść z pulpitu
|
||||||
double fCalibrateIn[ 6 ][ 6 ] = {
|
double fCalibrateIn[ 6 ][ 6 ] = {
|
||||||
{ 0, 1, 0, 0, 0, 0 },
|
{ 0, 1, 0, 0, 0, 0 },
|
||||||
|
|||||||
28
Train.cpp
28
Train.cpp
@@ -933,29 +933,19 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
||||||
if( Command.action == GLFW_REPEAT ) {
|
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == FV4a)
|
||||||
|
Train->mvOccupied->BrakeLevelAdd( Global.brake_speed * Command.time_delta );
|
||||||
if( Train->mvOccupied->BrakeHandle == FV4a ) {
|
else if (Command.action == GLFW_PRESS && Train->mvOccupied->BrakeHandle != FV4a)
|
||||||
Train->mvOccupied->BrakeLevelAdd( Global.fBrakeStep * Command.time_delta );
|
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos + Global.fBrakeStep );
|
||||||
}
|
|
||||||
else {
|
|
||||||
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos + Global.fBrakeStep * Command.time_delta );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command ) {
|
||||||
|
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == FV4a)
|
||||||
|
Train->mvOccupied->BrakeLevelAdd( -Global.brake_speed * Command.time_delta );
|
||||||
|
else if (Command.action == GLFW_PRESS && Train->mvOccupied->BrakeHandle != FV4a)
|
||||||
|
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos - Global.fBrakeStep );
|
||||||
|
|
||||||
if( Command.action == GLFW_REPEAT ) {
|
if (Command.action == GLFW_RELEASE) {
|
||||||
// press or hold
|
|
||||||
if( Train->mvOccupied->BrakeHandle == FV4a ) {
|
|
||||||
Train->mvOccupied->BrakeLevelAdd( -Global.fBrakeStep * Command.time_delta );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos - Global.fBrakeStep * Command.time_delta );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Command.action == GLFW_RELEASE) {
|
|
||||||
// release
|
// release
|
||||||
if( ( Train->mvOccupied->BrakeCtrlPos == -1 )
|
if( ( Train->mvOccupied->BrakeCtrlPos == -1 )
|
||||||
&& ( Train->mvOccupied->BrakeHandle == FVel6 )
|
&& ( Train->mvOccupied->BrakeHandle == FVel6 )
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ command_queue::push( command_data const &Command, std::size_t const Recipient )
|
|||||||
m_active_continuous.emplace(Command.command);
|
m_active_continuous.emplace(Command.command);
|
||||||
else if (Command.action == GLFW_RELEASE)
|
else if (Command.action == GLFW_RELEASE)
|
||||||
m_active_continuous.erase(Command.command);
|
m_active_continuous.erase(Command.command);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lookup = m_commands.emplace( Recipient, commanddata_sequence() );
|
auto lookup = m_commands.emplace( Recipient, commanddata_sequence() );
|
||||||
|
|||||||
Reference in New Issue
Block a user