16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 01:39:19 +02:00

Added hints about cab(de)activation, reworked cab activation gauge, fixes for AI to use it

This commit is contained in:
Królik Uszasty
2022-02-20 00:34:35 +01:00
parent fe455e3131
commit 3da4a42156
6 changed files with 48 additions and 5 deletions

View File

@@ -2765,6 +2765,7 @@ bool TController::PrepareEngine()
ReactionTime = ( mvOccupied->Vel < 5 ? PrepareTime : EasyReactionTime ); // react faster with rolling start ReactionTime = ( mvOccupied->Vel < 5 ? PrepareTime : EasyReactionTime ); // react faster with rolling start
cue_action( locale::string::driver_hint_batteryon ); cue_action( locale::string::driver_hint_batteryon );
cue_action( locale::string::driver_hint_cabactivation );
cue_action( locale::string::driver_hint_radioon ); cue_action( locale::string::driver_hint_radioon );
if( has_diesel_engine() ) { if( has_diesel_engine() ) {
@@ -5994,9 +5995,13 @@ TController::determine_consist_state() {
// ABu-160305 testowanie gotowości do jazdy // ABu-160305 testowanie gotowości do jazdy
// Ra: przeniesione z DynObj, skład użytkownika też jest testowany, żeby mu przekazać, że ma odhamować // Ra: przeniesione z DynObj, skład użytkownika też jest testowany, żeby mu przekazać, że ma odhamować
if ((mvOccupied->CabActive == 0) || (mvOccupied->CabActive == mvOccupied->CabOccupied)) if (mvOccupied->CabActive == 0)
{ {
mvOccupied->CabActivisation(true); cue_action( locale::string::driver_hint_cabactivation );
}
else if ((mvOccupied->CabActive == -mvOccupied->CabOccupied) || (!mvOccupied->CabMaster))
{
cue_action( locale::string::driver_hint_cabdeactivation );
} }
int index = double(BrakeAccTableSize) * (mvOccupied->Vel / mvOccupied->Vmax); int index = double(BrakeAccTableSize) * (mvOccupied->Vel / mvOccupied->Vmax);

View File

@@ -11913,6 +11913,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
} }
} }
DirAbsolute = DirActive * CabActive; DirAbsolute = DirActive * CabActive;
CabMaster = false;
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype ); OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
} }
else if (Command == "AutoRelaySwitch") else if (Command == "AutoRelaySwitch")

View File

@@ -2388,7 +2388,9 @@ void TTrain::OnCommand_cabactivationenable(TTrain *Train, command_data const &Co
if (Command.action == GLFW_PRESS) { if (Command.action == GLFW_PRESS) {
// visual feedback // visual feedback
Train->ggCabActivationButton.UpdateValue(1.0f, Train->dsbSwitch); if (Train->ggCabActivationButton.type() == TGaugeType::push) {
Train->ggCabActivationButton.UpdateValue(1.0f, Train->dsbSwitch);
}
Train->mvOccupied->CabActivisation(); Train->mvOccupied->CabActivisation();
@@ -2409,7 +2411,9 @@ void TTrain::OnCommand_cabactivationdisable(TTrain *Train, command_data const &C
// TBD, TODO: ewentualnie zablokować z FIZ, np. w samochodach się nie odłącza akumulatora // TBD, TODO: ewentualnie zablokować z FIZ, np. w samochodach się nie odłącza akumulatora
if (Command.action == GLFW_PRESS) { if (Command.action == GLFW_PRESS) {
// visual feedback // visual feedback
Train->ggCabActivationButton.UpdateValue(0.0f, Train->dsbSwitch); if (Train->ggCabActivationButton.type() == TGaugeType::push) {
Train->ggCabActivationButton.UpdateValue(0.0f, Train->dsbSwitch);
}
Train->mvOccupied->CabDeactivisation(); Train->mvOccupied->CabDeactivisation();
} }
@@ -7680,6 +7684,10 @@ bool TTrain::Update( double const Deltatime )
ggBatteryButton.Update(); ggBatteryButton.Update();
ggBatteryOnButton.Update(); ggBatteryOnButton.Update();
ggBatteryOffButton.Update(); ggBatteryOffButton.Update();
if ((ggCabActivationButton.SubModel != nullptr) && (ggCabActivationButton.type() != TGaugeType::push))
{
ggCabActivationButton.UpdateValue((mvOccupied->CabMaster) && (mvOccupied->CabOccupied == mvOccupied->CabActive) ? 1.0 : 0.0);
}
ggCabActivationButton.Update(); ggCabActivationButton.Update();
ggWaterPumpBreakerButton.Update(); ggWaterPumpBreakerButton.Update();
@@ -9142,7 +9150,7 @@ void TTrain::set_cab_controls( int const Cab ) {
// battery // battery
ggCabActivationButton.PutValue( ggCabActivationButton.PutValue(
(ggCabActivationButton.type() == TGaugeType::push ? 0.5f : (ggCabActivationButton.type() == TGaugeType::push ? 0.5f :
mvOccupied->CabActive == mvOccupied->CabOccupied ? 1.f : (mvOccupied->CabActive == mvOccupied->CabOccupied) && mvOccupied->CabMaster ? 1.f :
0.f)); 0.f));
// line breaker // line breaker
if( ggMainButton.SubModel != nullptr ) { // instead of single main button there can be on/off pair if( ggMainButton.SubModel != nullptr ) { // instead of single main button there can be on/off pair

View File

@@ -100,6 +100,29 @@ TController::cue_action( locale::string const Action, float const Actionparamete
return ( ( mvOccupied->BatteryStart != start_t::manual ) || ( mvOccupied->Power24vIsAvailable == false ) ); } ); return ( ( mvOccupied->BatteryStart != start_t::manual ) || ( mvOccupied->Power24vIsAvailable == false ) ); } );
break; break;
} }
// battery
case locale::string::driver_hint_cabactivation: {
if (AIControllFlag) {
mvOccupied->CabActivisation();
}
remove_hint( locale::string::driver_hint_cabdeactivation );
hint(
Action,
[this](float const Parameter) -> bool {
return ( ( mvOccupied->AutomaticCabActivation ) || ( ( mvOccupied->CabMaster == true ) && ( mvOccupied->CabActive == mvOccupied->CabOccupied ) ) ); } );
break;
}
case locale::string::driver_hint_cabdeactivation: {
if (AIControllFlag) {
mvOccupied->CabDeactivisation();
}
remove_hint( locale::string::driver_hint_cabactivation );
hint(
Action,
[this](float const Parameter) -> bool {
return ( ( mvOccupied->AutomaticCabActivation ) || ( ( mvOccupied->CabMaster == false ) && ( mvOccupied->CabActive == 0 ) ) ); } );
break;
}
// radio // radio
case locale::string::driver_hint_radioon: { case locale::string::driver_hint_radioon: {
if( AIControllFlag ) { if( AIControllFlag ) {

View File

@@ -59,6 +59,8 @@ init() {
"Hints", "Hints",
"Switch on battery", "Switch on battery",
"Switch off battery", "Switch off battery",
"Activate cabin",
"Deactivate cabin",
"Switch on radio", "Switch on radio",
"Switch off radio", "Switch off radio",
"Tune into channel %.0f", "Tune into channel %.0f",
@@ -372,6 +374,8 @@ init() {
"Podpowiedzi", "Podpowiedzi",
"Zalaczyc akumulatory", "Zalaczyc akumulatory",
"Wylaczyc akumulatory", "Wylaczyc akumulatory",
"Aktywowac kabine",
"Zdezaktywowac kabine",
"Zalaczyc radio", "Zalaczyc radio",
"Wylaczyc radio", "Wylaczyc radio",
"Ustawic radio na kanal %.0f", "Ustawic radio na kanal %.0f",

View File

@@ -48,6 +48,8 @@ enum string {
driver_hint_header, driver_hint_header,
driver_hint_batteryon, driver_hint_batteryon,
driver_hint_batteryoff, driver_hint_batteryoff,
driver_hint_cabactivation,
driver_hint_cabdeactivation,
driver_hint_radioon, driver_hint_radioon,
driver_hint_radiooff, driver_hint_radiooff,
driver_hint_radiochannel, driver_hint_radiochannel,