mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 13:19:19 +02:00
vehicle configuration ai hints section, pantograph setup ai hint, vehicle screens drawing optimization
This commit is contained in:
18
Driver.cpp
18
Driver.cpp
@@ -4714,6 +4714,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// jeśli nie trzeba opuszczać pantografów
|
// jeśli nie trzeba opuszczać pantografów
|
||||||
|
if( mvOccupied->AIHintPantstate == 0 ) {
|
||||||
// jazda na tylnym
|
// jazda na tylnym
|
||||||
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) {
|
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) {
|
||||||
// jak jedzie w kierunku sprzęgu 0
|
// jak jedzie w kierunku sprzęgu 0
|
||||||
@@ -4734,7 +4735,23 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if( mvOccupied->Vel > 5 ) {
|
if( mvOccupied->Vel > 5 ) {
|
||||||
|
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
|
// opuszczenie przedniego po rozpędzeniu się o ile jest więcej niż jeden
|
||||||
if( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) {
|
if( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) {
|
||||||
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) // jak jedzie w kierunku sprzęgu 0
|
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) // jak jedzie w kierunku sprzęgu 0
|
||||||
@@ -4752,6 +4769,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: refactor this calculation into a subroutine
|
// TODO: refactor this calculation into a subroutine
|
||||||
auto const useseriesmodevoltage {
|
auto const useseriesmodevoltage {
|
||||||
|
|||||||
@@ -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 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 iLights[2]; // bity zapalonych świateł tutaj, żeby dało się liczyć pobór prądu
|
||||||
|
|
||||||
|
int AIHintPantstate{ 0 }; // suggested pantograph setup
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab);
|
TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab);
|
||||||
// obsługa sprzęgów
|
// obsługa sprzęgów
|
||||||
@@ -1777,6 +1779,7 @@ private:
|
|||||||
void LoadFIZ_Switches( std::string const &Input );
|
void LoadFIZ_Switches( std::string const &Input );
|
||||||
void LoadFIZ_MotorParamTable( std::string const &Input );
|
void LoadFIZ_MotorParamTable( std::string const &Input );
|
||||||
void LoadFIZ_Circuit( 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_RList( std::string const &Input );
|
||||||
void LoadFIZ_UCList(std::string const &Input);
|
void LoadFIZ_UCList(std::string const &Input);
|
||||||
void LoadFIZ_DList( std::string const &Input );
|
void LoadFIZ_DList( std::string const &Input );
|
||||||
|
|||||||
@@ -8912,6 +8912,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( issection( "AI:", inputline ) ) {
|
||||||
|
startBPT = false;
|
||||||
|
fizlines.emplace( "AI", inputline );
|
||||||
|
LoadFIZ_AI( inputline );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( issection( "RList:", inputline ) )
|
if( issection( "RList:", inputline ) )
|
||||||
{
|
{
|
||||||
startBPT = false;
|
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 ) {
|
void TMoverParameters::LoadFIZ_RList( std::string const &Input ) {
|
||||||
|
|
||||||
extract_value( RlistSize, "Size", Input, "" );
|
extract_value( RlistSize, "Size", Input, "" );
|
||||||
|
|||||||
@@ -6908,7 +6908,8 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
// screens
|
// screens
|
||||||
fScreenTimer += Deltatime;
|
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
|
&& ( false == FreeFlyModeFlag ) ) { // don't bother if we're outside
|
||||||
fScreenTimer = 0.f;
|
fScreenTimer = 0.f;
|
||||||
for( auto const &screen : m_screens ) {
|
for( auto const &screen : m_screens ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user