vehicle controllers ai logic fixes, minor refactoring

This commit is contained in:
tmj-fstate
2019-03-19 22:38:46 +01:00
parent 3edd22e9fa
commit fe6789778f
6 changed files with 154 additions and 103 deletions

View File

@@ -782,8 +782,8 @@ void TTrain::OnCommand_jointcontrollerset( TTrain *Train, command_data const &Co
clamp(
1.0 - ( Command.param1 * 2 ),
0.0, 1.0 ) );
if( Train->mvControlled->MainCtrlPos > 0 ) {
Train->set_master_controller( 0 );
if( Train->mvControlled->MainCtrlPowerPos() > 0 ) {
Train->set_master_controller( Train->mvControlled->MainCtrlZeroPos() );
}
}
}
@@ -839,7 +839,7 @@ void TTrain::OnCommand_mastercontrollerdecrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->ggJointCtrl.SubModel != nullptr )
&& ( Train->mvControlled->MainCtrlPos == 0 ) ) {
&& ( Train->mvControlled->IsMainCtrlZero() ) ) {
OnCommand_independentbrakeincrease( Train, Command );
}
else {
@@ -859,7 +859,7 @@ void TTrain::OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->ggJointCtrl.SubModel != nullptr )
&& ( Train->mvControlled->MainCtrlPos == 0 ) ) {
&& ( Train->mvControlled->IsMainCtrlZero() ) ) {
OnCommand_independentbrakeincreasefast( Train, Command );
}
else {