mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
vehicle configuration ai hints section, pantograph setup ai hint, vehicle screens drawing optimization
This commit is contained in:
74
Driver.cpp
74
Driver.cpp
@@ -4714,40 +4714,58 @@ TController::UpdateSituation(double dt) {
|
||||
}
|
||||
else {
|
||||
// jeśli nie trzeba opuszczać pantografów
|
||||
// jazda na tylnym
|
||||
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) {
|
||||
// jak jedzie w kierunku sprzęgu 0
|
||||
if( ( mvControlling->PantRearVolt == 0.0 )
|
||||
// filter out cases with single _other_ working pantograph so we don't try to raise something we can't
|
||||
&& ( ( mvControlling->PantographVoltage == 0.0 )
|
||||
|| ( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) ) ) {
|
||||
mvControlling->OperatePantographValve( end::rear, operation_t::enable );
|
||||
if( mvOccupied->AIHintPantstate == 0 ) {
|
||||
// jazda na tylnym
|
||||
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) {
|
||||
// jak jedzie w kierunku sprzęgu 0
|
||||
if( ( mvControlling->PantRearVolt == 0.0 )
|
||||
// filter out cases with single _other_ working pantograph so we don't try to raise something we can't
|
||||
&& ( ( mvControlling->PantographVoltage == 0.0 )
|
||||
|| ( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) ) ) {
|
||||
mvControlling->OperatePantographValve( end::rear, operation_t::enable );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// jak jedzie w kierunku sprzęgu 0
|
||||
if( ( mvControlling->PantFrontVolt == 0.0 )
|
||||
// filter out cases with single _other_ working pantograph so we don't try to raise something we can't
|
||||
&& ( ( mvControlling->PantographVoltage == 0.0 )
|
||||
|| ( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) ) ) {
|
||||
mvControlling->OperatePantographValve( end::front, operation_t::enable );
|
||||
else {
|
||||
// jak jedzie w kierunku sprzęgu 0
|
||||
if( ( mvControlling->PantFrontVolt == 0.0 )
|
||||
// filter out cases with single _other_ working pantograph so we don't try to raise something we can't
|
||||
&& ( ( mvControlling->PantographVoltage == 0.0 )
|
||||
|| ( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) ) ) {
|
||||
mvControlling->OperatePantographValve( end::front, operation_t::enable );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( mvOccupied->Vel > 5 ) {
|
||||
// opuszczenie przedniego po rozpędzeniu się o ile jest więcej niż jeden
|
||||
if( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) {
|
||||
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) // jak jedzie w kierunku sprzęgu 0
|
||||
{ // poczekać na podniesienie tylnego
|
||||
if( ( mvControlling->PantFrontVolt != 0.0 )
|
||||
&& ( mvControlling->PantRearVolt != 0.0 ) ) { // czy jest napięcie zasilające na tylnym?
|
||||
mvControlling->OperatePantographValve( end::front, operation_t::disable ); // opuszcza od sprzęgu 0
|
||||
if( mvOccupied->AIHintPantstate != 0 ) {
|
||||
// use suggested pantograph setup
|
||||
auto const pantographsetup { mvOccupied->AIHintPantstate };
|
||||
mvControlling->OperatePantographValve(
|
||||
end::front,
|
||||
( pantographsetup & ( 1 << 0 ) ?
|
||||
operation_t::enable :
|
||||
operation_t::disable ) );
|
||||
mvControlling->OperatePantographValve(
|
||||
end::rear,
|
||||
( pantographsetup & ( 1 << 1 ) ?
|
||||
operation_t::enable :
|
||||
operation_t::disable ) );
|
||||
}
|
||||
else {
|
||||
// opuszczenie przedniego po rozpędzeniu się o ile jest więcej niż jeden
|
||||
if( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) {
|
||||
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) // jak jedzie w kierunku sprzęgu 0
|
||||
{ // poczekać na podniesienie tylnego
|
||||
if( ( mvControlling->PantFrontVolt != 0.0 )
|
||||
&& ( mvControlling->PantRearVolt != 0.0 ) ) { // czy jest napięcie zasilające na tylnym?
|
||||
mvControlling->OperatePantographValve( end::front, operation_t::disable ); // opuszcza od sprzęgu 0
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // poczekać na podniesienie przedniego
|
||||
if( ( mvControlling->PantRearVolt != 0.0 )
|
||||
&& ( mvControlling->PantFrontVolt != 0.0 ) ) { // czy jest napięcie zasilające na przednim?
|
||||
mvControlling->OperatePantographValve( end::rear, operation_t::disable ); // opuszcza od sprzęgu 1
|
||||
else { // poczekać na podniesienie przedniego
|
||||
if( ( mvControlling->PantRearVolt != 0.0 )
|
||||
&& ( mvControlling->PantFrontVolt != 0.0 ) ) { // czy jest napięcie zasilające na przednim?
|
||||
mvControlling->OperatePantographValve( end::rear, operation_t::disable ); // opuszcza od sprzęgu 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1534,6 +1534,8 @@ public:
|
||||
int iProblem = 0; // flagi problemów z taborem, aby AI nie musiało porównywać; 0=może jechać
|
||||
int iLights[2]; // bity zapalonych świateł tutaj, żeby dało się liczyć pobór prądu
|
||||
|
||||
int AIHintPantstate{ 0 }; // suggested pantograph setup
|
||||
|
||||
public:
|
||||
TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab);
|
||||
// obsługa sprzęgów
|
||||
@@ -1777,6 +1779,7 @@ private:
|
||||
void LoadFIZ_Switches( std::string const &Input );
|
||||
void LoadFIZ_MotorParamTable( std::string const &Input );
|
||||
void LoadFIZ_Circuit( std::string const &Input );
|
||||
void LoadFIZ_AI( std::string const &Input );
|
||||
void LoadFIZ_RList( std::string const &Input );
|
||||
void LoadFIZ_UCList(std::string const &Input);
|
||||
void LoadFIZ_DList( std::string const &Input );
|
||||
|
||||
@@ -8912,6 +8912,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
||||
continue;
|
||||
}
|
||||
|
||||
if( issection( "AI:", inputline ) ) {
|
||||
startBPT = false;
|
||||
fizlines.emplace( "AI", inputline );
|
||||
LoadFIZ_AI( inputline );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( issection( "RList:", inputline ) )
|
||||
{
|
||||
startBPT = false;
|
||||
@@ -10151,6 +10158,11 @@ void TMoverParameters::LoadFIZ_Circuit( std::string const &Input ) {
|
||||
|
||||
}
|
||||
|
||||
void TMoverParameters::LoadFIZ_AI( std::string const &Input ) {
|
||||
|
||||
extract_value( AIHintPantstate, "Pantstate", Input, "" );
|
||||
}
|
||||
|
||||
void TMoverParameters::LoadFIZ_RList( std::string const &Input ) {
|
||||
|
||||
extract_value( RlistSize, "Size", Input, "" );
|
||||
|
||||
@@ -6908,7 +6908,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
// screens
|
||||
fScreenTimer += Deltatime;
|
||||
if( ( fScreenTimer > Global.PythonScreenUpdateRate * 0.001f )
|
||||
if( ( this == simulation::Train ) // no point in drawing screens for vehicles other than our own
|
||||
&& ( fScreenTimer > Global.PythonScreenUpdateRate * 0.001f )
|
||||
&& ( false == FreeFlyModeFlag ) ) { // don't bother if we're outside
|
||||
fScreenTimer = 0.f;
|
||||
for( auto const &screen : m_screens ) {
|
||||
|
||||
Reference in New Issue
Block a user