basic heating power cable implementation, door permit preset logic tweaks, timetable ui panel tweaks

This commit is contained in:
tmj-fstate
2019-06-15 18:46:59 +02:00
parent b75a4d6075
commit 6ba274befc
4 changed files with 31 additions and 16 deletions

View File

@@ -1562,25 +1562,27 @@ void TMoverParameters::HeatingCheck( double const Timestep ) {
// ...detailed check if we're still here
auto const heatingpowerthreshold { 0.1 };
// start with external power sources
auto voltage { GetTrainsetVoltage() };
auto voltage { 0.0 };
// then try internal ones
auto localvoltage { 0.0 };
switch( HeatingPowerSource.SourceType ) {
case TPowerSource::Generator: {
localvoltage = HeatingPowerSource.EngineGenerator.voltage;
voltage = HeatingPowerSource.EngineGenerator.voltage;
break;
}
case TPowerSource::PowerCable: {
if( HeatingPowerSource.PowerType == TPowerType::ElectricPower ) {
voltage = GetTrainsetVoltage();
}
break;
}
case TPowerSource::Main: {
localvoltage = ( true == Mains ? Voltage : 0.0 );
voltage = ( true == Mains ? Voltage : 0.0 );
break;
}
default: {
break;
}
}
if( std::abs( localvoltage ) > std::abs( voltage ) ) {
voltage = localvoltage;
}
Heating = ( std::abs( voltage ) > heatingpowerthreshold );
@@ -7082,8 +7084,8 @@ bool TMoverParameters::ChangeDoorPermitPreset( int const Change, range_t const N
Doors.permit_preset = clamp<int>( Doors.permit_preset + Change, 0, Doors.permit_presets.size() - 1 );
auto const doors { Doors.permit_presets[ Doors.permit_preset ] };
auto const permitleft = doors & 1;
auto const permitright = doors & 2;
auto const permitleft { ( ( doors & 1 ) != 0 ) };
auto const permitright { ( ( doors & 2 ) != 0 ) };
PermitDoors( ( CabNo > 0 ? side::left : side::right ), permitleft, Notify );
PermitDoors( ( CabNo > 0 ? side::right : side::left ), permitright, Notify );
@@ -9763,6 +9765,11 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
&& ( HeatingPowerSource.SourceType == TPowerSource::NotDefined ) ) {
HeatingPowerSource.SourceType = TPowerSource::Main;
}
if( ( HeatingPowerSource.SourceType == TPowerSource::NotDefined )
&& ( HeatingPower > 0 ) ) {
HeatingPowerSource.SourceType = TPowerSource::PowerCable;
HeatingPowerSource.PowerType = TPowerType::ElectricPower;
}
// checking ready flag
// to dac potem do init

View File

@@ -5037,6 +5037,10 @@ void TTrain::OnCommand_cabchangeforward( TTrain *Train, command_data const &Comm
1 );
}
}
// HACK: match consist door permit state with the preset in the active cab
if( Train->ggDoorPermitPresetButton.SubModel != nullptr ) {
Train->mvOccupied->ChangeDoorPermitPreset( 0 );
}
}
}
@@ -5053,6 +5057,10 @@ void TTrain::OnCommand_cabchangebackward( TTrain *Train, command_data const &Com
1 );
}
}
// HACK: match consist door permit state with the preset in the active cab
if( Train->ggDoorPermitPresetButton.SubModel != nullptr ) {
Train->mvOccupied->ChangeDoorPermitPreset( 0 );
}
}
}
@@ -7656,7 +7664,7 @@ void TTrain::set_cab_controls( int const Cab ) {
TimetableLightActive ?
1.f :
0.f ) );
// doors
// doors permits
if( ggDoorLeftPermitButton.type() != TGaugeType::push ) {
ggDoorLeftPermitButton.PutValue( mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::left : side::right ) ].open_permit ? 1.f : 0.f );
}
@@ -7664,6 +7672,7 @@ void TTrain::set_cab_controls( int const Cab ) {
ggDoorRightPermitButton.PutValue( mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::right : side::left ) ].open_permit ? 1.f : 0.f );
}
ggDoorPermitPresetButton.PutValue( mvOccupied->Doors.permit_preset );
// door controls
ggDoorLeftButton.PutValue( mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::left : side::right ) ].is_closed ? 0.f : 1.f );
ggDoorRightButton.PutValue( mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::right : side::left ) ].is_closed ? 0.f : 1.f );
// door lock

View File

@@ -35,7 +35,7 @@ driver_ui::driver_ui() {
m_scenariopanel.size_max = { Global.iWindowWidth * 0.95, Global.iWindowHeight * 0.95 };
m_timetablepanel.title = locale::strings[ locale::string::driver_timetable_header ];
m_timetablepanel.size_min = { 435, 110 };
m_timetablepanel.size_min = { 435, 70 };
m_timetablepanel.size_max = { 435, Global.iWindowHeight * 0.95 };
m_transcriptspanel.title = locale::strings[ locale::string::driver_transcripts_header ];

View File

@@ -266,23 +266,23 @@ timetable_panel::update() {
auto const *table = owner->TrainTimetable();
if( table == nullptr ) { return; }
{ // destination
// destination
{
auto textline = Bezogonkow( owner->Relation(), true );
if( false == textline.empty() ) {
textline += " (" + Bezogonkow( owner->TrainName(), true ) + ")";
}
text_lines.emplace_back( textline, Global.UITextColor );
}
{ // next station
if( false == is_expanded ) {
// next station
auto const nextstation = owner->NextStop();
if( false == nextstation.empty() ) {
// jeśli jest podana relacja, to dodajemy punkt następnego zatrzymania
auto textline = " -> " + nextstation;
text_lines.emplace_back( textline, Global.UITextColor );
text_lines.emplace_back( "", Global.UITextColor );
}
}
@@ -310,7 +310,6 @@ timetable_panel::update() {
static_cast<int>( consistlength ) );
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
text_lines.emplace_back( "", Global.UITextColor );
}
if( 0 == table->StationCount ) {