mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-24 00:49:18 +02:00
basic heating power cable implementation, door permit preset logic tweaks, timetable ui panel tweaks
This commit is contained in:
@@ -1562,25 +1562,27 @@ void TMoverParameters::HeatingCheck( double const Timestep ) {
|
|||||||
// ...detailed check if we're still here
|
// ...detailed check if we're still here
|
||||||
auto const heatingpowerthreshold { 0.1 };
|
auto const heatingpowerthreshold { 0.1 };
|
||||||
// start with external power sources
|
// start with external power sources
|
||||||
auto voltage { GetTrainsetVoltage() };
|
auto voltage { 0.0 };
|
||||||
// then try internal ones
|
// then try internal ones
|
||||||
auto localvoltage { 0.0 };
|
|
||||||
switch( HeatingPowerSource.SourceType ) {
|
switch( HeatingPowerSource.SourceType ) {
|
||||||
case TPowerSource::Generator: {
|
case TPowerSource::Generator: {
|
||||||
localvoltage = HeatingPowerSource.EngineGenerator.voltage;
|
voltage = HeatingPowerSource.EngineGenerator.voltage;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TPowerSource::PowerCable: {
|
||||||
|
if( HeatingPowerSource.PowerType == TPowerType::ElectricPower ) {
|
||||||
|
voltage = GetTrainsetVoltage();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TPowerSource::Main: {
|
case TPowerSource::Main: {
|
||||||
localvoltage = ( true == Mains ? Voltage : 0.0 );
|
voltage = ( true == Mains ? Voltage : 0.0 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( std::abs( localvoltage ) > std::abs( voltage ) ) {
|
|
||||||
voltage = localvoltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
Heating = ( std::abs( voltage ) > heatingpowerthreshold );
|
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 );
|
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 doors { Doors.permit_presets[ Doors.permit_preset ] };
|
||||||
auto const permitleft = doors & 1;
|
auto const permitleft { ( ( doors & 1 ) != 0 ) };
|
||||||
auto const permitright = doors & 2;
|
auto const permitright { ( ( doors & 2 ) != 0 ) };
|
||||||
|
|
||||||
PermitDoors( ( CabNo > 0 ? side::left : side::right ), permitleft, Notify );
|
PermitDoors( ( CabNo > 0 ? side::left : side::right ), permitleft, Notify );
|
||||||
PermitDoors( ( CabNo > 0 ? side::right : side::left ), permitright, 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::NotDefined ) ) {
|
||||||
HeatingPowerSource.SourceType = TPowerSource::Main;
|
HeatingPowerSource.SourceType = TPowerSource::Main;
|
||||||
}
|
}
|
||||||
|
if( ( HeatingPowerSource.SourceType == TPowerSource::NotDefined )
|
||||||
|
&& ( HeatingPower > 0 ) ) {
|
||||||
|
HeatingPowerSource.SourceType = TPowerSource::PowerCable;
|
||||||
|
HeatingPowerSource.PowerType = TPowerType::ElectricPower;
|
||||||
|
}
|
||||||
|
|
||||||
// checking ready flag
|
// checking ready flag
|
||||||
// to dac potem do init
|
// to dac potem do init
|
||||||
|
|||||||
11
Train.cpp
11
Train.cpp
@@ -5037,6 +5037,10 @@ void TTrain::OnCommand_cabchangeforward( TTrain *Train, command_data const &Comm
|
|||||||
1 );
|
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 );
|
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 ?
|
TimetableLightActive ?
|
||||||
1.f :
|
1.f :
|
||||||
0.f ) );
|
0.f ) );
|
||||||
// doors
|
// doors permits
|
||||||
if( ggDoorLeftPermitButton.type() != TGaugeType::push ) {
|
if( ggDoorLeftPermitButton.type() != TGaugeType::push ) {
|
||||||
ggDoorLeftPermitButton.PutValue( mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::left : side::right ) ].open_permit ? 1.f : 0.f );
|
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 );
|
ggDoorRightPermitButton.PutValue( mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::right : side::left ) ].open_permit ? 1.f : 0.f );
|
||||||
}
|
}
|
||||||
ggDoorPermitPresetButton.PutValue( mvOccupied->Doors.permit_preset );
|
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 );
|
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 );
|
ggDoorRightButton.PutValue( mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::right : side::left ) ].is_closed ? 0.f : 1.f );
|
||||||
// door lock
|
// door lock
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ driver_ui::driver_ui() {
|
|||||||
m_scenariopanel.size_max = { Global.iWindowWidth * 0.95, Global.iWindowHeight * 0.95 };
|
m_scenariopanel.size_max = { Global.iWindowWidth * 0.95, Global.iWindowHeight * 0.95 };
|
||||||
|
|
||||||
m_timetablepanel.title = locale::strings[ locale::string::driver_timetable_header ];
|
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_timetablepanel.size_max = { 435, Global.iWindowHeight * 0.95 };
|
||||||
|
|
||||||
m_transcriptspanel.title = locale::strings[ locale::string::driver_transcripts_header ];
|
m_transcriptspanel.title = locale::strings[ locale::string::driver_transcripts_header ];
|
||||||
|
|||||||
@@ -266,23 +266,23 @@ timetable_panel::update() {
|
|||||||
auto const *table = owner->TrainTimetable();
|
auto const *table = owner->TrainTimetable();
|
||||||
if( table == nullptr ) { return; }
|
if( table == nullptr ) { return; }
|
||||||
|
|
||||||
{ // destination
|
// destination
|
||||||
|
{
|
||||||
auto textline = Bezogonkow( owner->Relation(), true );
|
auto textline = Bezogonkow( owner->Relation(), true );
|
||||||
if( false == textline.empty() ) {
|
if( false == textline.empty() ) {
|
||||||
textline += " (" + Bezogonkow( owner->TrainName(), true ) + ")";
|
textline += " (" + Bezogonkow( owner->TrainName(), true ) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
text_lines.emplace_back( textline, Global.UITextColor );
|
text_lines.emplace_back( textline, Global.UITextColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // next station
|
if( false == is_expanded ) {
|
||||||
|
// next station
|
||||||
auto const nextstation = owner->NextStop();
|
auto const nextstation = owner->NextStop();
|
||||||
if( false == nextstation.empty() ) {
|
if( false == nextstation.empty() ) {
|
||||||
// jeśli jest podana relacja, to dodajemy punkt następnego zatrzymania
|
// jeśli jest podana relacja, to dodajemy punkt następnego zatrzymania
|
||||||
auto textline = " -> " + nextstation;
|
auto textline = " -> " + nextstation;
|
||||||
|
|
||||||
text_lines.emplace_back( textline, Global.UITextColor );
|
text_lines.emplace_back( textline, Global.UITextColor );
|
||||||
text_lines.emplace_back( "", Global.UITextColor );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +310,6 @@ timetable_panel::update() {
|
|||||||
static_cast<int>( consistlength ) );
|
static_cast<int>( consistlength ) );
|
||||||
|
|
||||||
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
|
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
|
||||||
text_lines.emplace_back( "", Global.UITextColor );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( 0 == table->StationCount ) {
|
if( 0 == table->StationCount ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user