mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
minor ai heater logic tweak, vehicle preparation check tweak
This commit is contained in:
17
Driver.cpp
17
Driver.cpp
@@ -2459,6 +2459,7 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
// with the order established the virtual train manager can do their work
|
// with the order established the virtual train manager can do their work
|
||||||
p = pVehicles[ end::front ];
|
p = pVehicles[ end::front ];
|
||||||
ControlledEnginesCount = ( p->MoverParameters->Power > 1.0 ? 1 : 0 );
|
ControlledEnginesCount = ( p->MoverParameters->Power > 1.0 ? 1 : 0 );
|
||||||
|
auto hasheaters { false };
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
if( p != pVehicle ) {
|
if( p != pVehicle ) {
|
||||||
@@ -2470,6 +2471,7 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
if( p->MoverParameters->HeatingPower > 0 ) {
|
if( p->MoverParameters->HeatingPower > 0 ) {
|
||||||
p->MoverParameters->HeatingAllow = true;
|
p->MoverParameters->HeatingAllow = true;
|
||||||
p->MoverParameters->ConverterSwitch( true, range_t::local );
|
p->MoverParameters->ConverterSwitch( true, range_t::local );
|
||||||
|
hasheaters = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2526,16 +2528,18 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
cue_action( locale::string::driver_hint_consistdoorlockson );
|
cue_action( locale::string::driver_hint_consistdoorlockson );
|
||||||
// potentially enable train heating
|
// potentially enable train heating
|
||||||
{
|
{
|
||||||
// HACK: to account for su-45/46 shortcomings diesel-powered engines only activate heating in cold conditions
|
|
||||||
// TODO: take instead into account presence of converters in attached cars, once said presence is possible to specify
|
|
||||||
auto const ispassengertrain { ( IsPassengerTrain ) && ( iVehicles - ControlledEnginesCount > 0 ) };
|
auto const ispassengertrain { ( IsPassengerTrain ) && ( iVehicles - ControlledEnginesCount > 0 ) };
|
||||||
auto const isheatingcouplingactive { pVehicles[ end::front ]->is_connected( pVehicles[ end::rear ], coupling::heating ) };
|
// TODO: replace connection test with connection check between last engine and first car, specifically
|
||||||
|
auto const isheatingcouplingactive { (
|
||||||
|
ControlledEnginesCount == 1 ?
|
||||||
|
pVehicles[ end::front ]->is_connected( pVehicles[ end::rear ], coupling::heating ) :
|
||||||
|
true ) };
|
||||||
auto const isheatingneeded {
|
auto const isheatingneeded {
|
||||||
(is_emu() || is_dmu() ? true :
|
(is_emu() || is_dmu() ? true :
|
||||||
// false == isheatingcouplingactive ? false :
|
|
||||||
(OrderCurrentGet() & (Obey_train | Bank)) == 0 ? false :
|
(OrderCurrentGet() & (Obey_train | Bank)) == 0 ? false :
|
||||||
ispassengertrain ? (has_diesel_engine() ? (Global.AirTemperature < 10) : true) :
|
false == isheatingcouplingactive ? false :
|
||||||
false)};
|
ispassengertrain ? hasheaters :
|
||||||
|
false) };
|
||||||
if( mvControlling->HeatingAllow != isheatingneeded ) {
|
if( mvControlling->HeatingAllow != isheatingneeded ) {
|
||||||
cue_action(
|
cue_action(
|
||||||
isheatingneeded ?
|
isheatingneeded ?
|
||||||
@@ -2839,6 +2843,7 @@ bool TController::PrepareEngine()
|
|||||||
&& ( true == IsAnyCompressorEnabled )
|
&& ( true == IsAnyCompressorEnabled )
|
||||||
&& ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) )
|
&& ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) )
|
||||||
&& ( ( static_cast<int>( mvOccupied->fBrakeCtrlPos ) == static_cast<int>( mvOccupied->Handle->GetPos( bh_RP ) ) )
|
&& ( ( static_cast<int>( mvOccupied->fBrakeCtrlPos ) == static_cast<int>( mvOccupied->Handle->GetPos( bh_RP ) ) )
|
||||||
|
|| ( static_cast<int>( mvOccupied->fBrakeCtrlPos ) != static_cast<int>( mvOccupied->Handle->GetPos( bh_NP ) ) )
|
||||||
|| ( mvOccupied->BrakeHandle == TBrakeHandle::NoHandle ) );
|
|| ( mvOccupied->BrakeHandle == TBrakeHandle::NoHandle ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user