mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
Merge branch 'master' into master
This commit is contained in:
@@ -4359,62 +4359,61 @@ void TController::Doors( bool const Open, int const Side ) {
|
||||
if( ( false == doors_permit_active() )
|
||||
&& ( false == doors_open() ) ) {
|
||||
iDrivigFlags &= ~moveDoorOpened;
|
||||
iDrivigFlags &= ~moveDepartureWarned;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mvOccupied->Doors.has_warning && !TestFlag(iDrivigFlags, moveDepartureWarned))
|
||||
{
|
||||
if (!mvOccupied->DepartureSignal)
|
||||
{
|
||||
// Not warned yet, not warning yet - start the warning signal.
|
||||
cue_action( driver_hint::departuresignalon ); // załącenie bzyczka
|
||||
fActionTime = Random( -0.3, -0.8 ); // 0.3-0.8 second buzzer
|
||||
return;
|
||||
}
|
||||
// Not warned yet, warning now - stop the warning signal and mark it as done.
|
||||
cue_action( driver_hint::departuresignaloff );
|
||||
fActionTime = Random( 0.0, -0.2 ); // Wait just a bit more before departing
|
||||
iDrivigFlags |= moveDepartureWarned;
|
||||
return;
|
||||
}
|
||||
|
||||
if( true == doors_open() ) {
|
||||
if( ( true == mvOccupied->Doors.has_warning )
|
||||
&& ( false == mvOccupied->DepartureSignal )
|
||||
&& ( true == TestFlag( iDrivigFlags, moveDoorOpened ) ) ) {
|
||||
cue_action( driver_hint::departuresignalon ); // załącenie bzyczka
|
||||
fActionTime = -1.5 - 0.1 * Random( 10 ); // 1.5-2.5 second wait
|
||||
// consist-wide remote signals to close doors
|
||||
if( ( pVehicle->MoverParameters->Doors.close_control == control_t::conductor )
|
||||
|| ( pVehicle->MoverParameters->Doors.close_control == control_t::driver )
|
||||
|| ( pVehicle->MoverParameters->Doors.close_control == control_t::mixed ) ) {
|
||||
cue_action( driver_hint::doorrightclose );
|
||||
cue_action( driver_hint::doorleftclose );
|
||||
}
|
||||
}
|
||||
if( true == doors_permit_active() ) {
|
||||
cue_action( driver_hint::doorrightpermitoff );
|
||||
cue_action( driver_hint::doorleftpermitoff );
|
||||
}
|
||||
// if applicable close manually-operated doors in vehicles which may ignore remote signals
|
||||
{
|
||||
const auto *vehicle = pVehicles[ end::front ]; // pojazd na czole składu
|
||||
while( vehicle != nullptr ) {
|
||||
// zamykanie drzwi w pojazdach - flaga zezwolenia była by lepsza
|
||||
auto const ismanualdoor {
|
||||
( vehicle->MoverParameters->Doors.auto_velocity == -1.f )
|
||||
&& ( ( vehicle->MoverParameters->Doors.close_control == control_t::passenger )
|
||||
|| ( vehicle->MoverParameters->Doors.close_control == control_t::mixed ) ) };
|
||||
|
||||
if( ( false == AIControllFlag ) || ( fActionTime > -0.5 ) ) {
|
||||
// ai doesn't close the door until it's free to depart, but human driver has free reign to do stupid things
|
||||
if( true == doors_open() ) {
|
||||
// consist-wide remote signals to close doors
|
||||
if( ( pVehicle->MoverParameters->Doors.close_control == control_t::conductor )
|
||||
|| ( pVehicle->MoverParameters->Doors.close_control == control_t::driver )
|
||||
|| ( pVehicle->MoverParameters->Doors.close_control == control_t::mixed ) ) {
|
||||
cue_action( driver_hint::doorrightclose );
|
||||
cue_action( driver_hint::doorleftclose );
|
||||
if( ( true == ismanualdoor )
|
||||
&& ( ( vehicle->LoadExchangeTime() == 0.f )
|
||||
|| ( vehicle->MoverParameters->Vel > EU07_AI_MOVEMENT ) ) ) {
|
||||
vehicle->MoverParameters->OperateDoors( side::right, false, range_t::local );
|
||||
vehicle->MoverParameters->OperateDoors( side::left, false, range_t::local );
|
||||
}
|
||||
}
|
||||
if( true == doors_permit_active() ) {
|
||||
cue_action( driver_hint::doorrightpermitoff );
|
||||
cue_action( driver_hint::doorleftpermitoff );
|
||||
}
|
||||
// if applicable close manually-operated doors in vehicles which may ignore remote signals
|
||||
{
|
||||
auto *vehicle = pVehicles[ end::front ]; // pojazd na czole składu
|
||||
while( vehicle != nullptr ) {
|
||||
// zamykanie drzwi w pojazdach - flaga zezwolenia była by lepsza
|
||||
auto const ismanualdoor {
|
||||
( vehicle->MoverParameters->Doors.auto_velocity == -1.f )
|
||||
&& ( ( vehicle->MoverParameters->Doors.close_control == control_t::passenger )
|
||||
|| ( vehicle->MoverParameters->Doors.close_control == control_t::mixed ) ) };
|
||||
|
||||
if( ( true == ismanualdoor )
|
||||
&& ( ( vehicle->LoadExchangeTime() == 0.f )
|
||||
|| ( vehicle->MoverParameters->Vel > EU07_AI_MOVEMENT ) ) ) {
|
||||
vehicle->MoverParameters->OperateDoors( side::right, false, range_t::local );
|
||||
vehicle->MoverParameters->OperateDoors( side::left, false, range_t::local );
|
||||
}
|
||||
vehicle = vehicle->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
|
||||
}
|
||||
}
|
||||
fActionTime = -2.0 - 0.1 * Random( 15 ); // 2.0-3.5 sec wait, +potentially 0.5 remaining
|
||||
iDrivigFlags &= ~moveDoorOpened; // zostały zamknięte - nie wykonywać drugi raz
|
||||
|
||||
if( ( true == mvOccupied->DepartureSignal )
|
||||
&& ( Random( 100 ) < Random( 100 ) ) ) {
|
||||
// potentially turn off the warning before actual departure
|
||||
// TBD, TODO: dedicated buzzer duration counter?
|
||||
cue_action( driver_hint::departuresignaloff );
|
||||
vehicle = vehicle->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
|
||||
}
|
||||
}
|
||||
fActionTime = Random( -1.0, -3.5 ); // 1.0-3.5 sec wait
|
||||
iDrivigFlags &= ~moveDoorOpened; // zostały zamknięte - nie wykonywać drugi raz
|
||||
iDrivigFlags &= ~moveDepartureWarned;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,8 @@ enum TMovementStatus
|
||||
movePushPull = 0x40000, // zmiana czoła przez zmianę kabiny - nie odczepiać przy zmianie kierunku
|
||||
moveSignalFound = 0x80000, // na drodze skanowania został znaleziony semafor
|
||||
moveStopPointFound = 0x100000, // stop point detected ahead
|
||||
moveGuardOpenDoor = 0x200000 // time for opening a door before departure
|
||||
moveGuardOpenDoor = 0x200000, // time for opening a door before departure
|
||||
moveDepartureWarned = 0x400000 // driver has already warned about the doors being closed (only for manual warning - i.e. EN57-ish)
|
||||
/*
|
||||
moveSemaphorWasElapsed = 0x100000, // minięty został semafor
|
||||
moveTrainInsideStation = 0x200000, // pociąg między semaforem a rozjazdami lub następnym semaforem
|
||||
|
||||
@@ -4265,27 +4265,6 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
MoverParameters->InactiveCabPantsCheck = false;
|
||||
}
|
||||
|
||||
|
||||
if (MoverParameters->DerailReason > 0)
|
||||
{
|
||||
switch (MoverParameters->DerailReason)
|
||||
{
|
||||
case 1:
|
||||
ErrorLog("Bad driving: " + asName + " derailed due to end of track");
|
||||
break;
|
||||
case 2:
|
||||
ErrorLog("Bad driving: " + asName + " derailed due to too high speed");
|
||||
break;
|
||||
case 3:
|
||||
ErrorLog("Bad dynamic: " + asName + " derailed due to track width");
|
||||
break; // błąd w scenerii
|
||||
case 4:
|
||||
ErrorLog("Bad dynamic: " + asName + " derailed due to wrong track type");
|
||||
break; // błąd w scenerii
|
||||
}
|
||||
MoverParameters->DerailReason = 0; //żeby tylko raz
|
||||
}
|
||||
|
||||
if( MoverParameters->LoadStatus ) {
|
||||
LoadUpdate(); // zmiana modelu ładunku
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user