mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 07:07:05 +01:00
refactor(ai): the cab and the whois event are no longer friends of the AI, its public fields are private
TTrain and whois_event reached into the private members of TController as its
friends; they read what the AI knows of its consist and its route through
queries now (ConsistDoorsOpen(), ConsistConverterOverloaded(), ConsistLength(),
DesiredVelocity(), NextSignalVelocity(), BrakesReleaseLevel(), ...), and the cab
changes the radio channel through SetRadioChannel() rather than a reference to
the AI's field. The reversers of the consist, the stations of the timetable and
the obstacle ahead are public queries and operations.
The public fields of TController are private: whether the AI drives
(AIControllFlag()), the masks of the running without current the vehicles of
the consist set (MarkOverhead(), the same bits TDynamicObject::OverheadTrack()
set itself), the most deceleration of the blended brakes (MedAmax(),
SetMedAmax()), and the positions the driving aid panels show. Only the four
debug and timetable panels stay friends.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
+100
-100
@@ -82,7 +82,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
switch( Action ) {
|
||||
// battery
|
||||
case driver_hint::batteryon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->BatterySwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::batteryoff );
|
||||
@@ -93,7 +93,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::batteryoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->BatterySwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::batteryon );
|
||||
@@ -105,7 +105,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// battery
|
||||
case driver_hint::cabactivation: {
|
||||
if (AIControllFlag && occupied->lowVoltage.Is24vAvailable()) {
|
||||
if (aiControlled && occupied->lowVoltage.Is24vAvailable()) {
|
||||
occupied->CabActivisation();
|
||||
CheckVehicles();
|
||||
}
|
||||
@@ -117,7 +117,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::cabdeactivation: {
|
||||
if (AIControllFlag) {
|
||||
if (aiControlled) {
|
||||
occupied->CabDeactivisation();
|
||||
}
|
||||
remove_hint( driver_hint::cabactivation );
|
||||
@@ -129,7 +129,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// radio
|
||||
case driver_hint::radioon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->SetRadio(true);
|
||||
}
|
||||
remove_hint( driver_hint::radiooff );
|
||||
@@ -140,7 +140,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::radiofuseon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->SetRadioFuse(true);
|
||||
}
|
||||
hint(
|
||||
@@ -150,7 +150,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::radiochannel: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
iRadioChannel = static_cast<int>( Actionparameter );
|
||||
}
|
||||
hint(
|
||||
@@ -161,7 +161,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::radiooff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->SetRadio(false);
|
||||
}
|
||||
remove_hint( driver_hint::radioon );
|
||||
@@ -173,7 +173,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// oil pump
|
||||
case driver_hint::oilpumpon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->OilPumpSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::oilpumpoff );
|
||||
@@ -185,7 +185,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::oilpumpoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->OilPumpSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::oilpumpon );
|
||||
@@ -198,7 +198,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// fuel pump
|
||||
case driver_hint::fuelpumpon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->FuelPumpSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::fuelpumpoff );
|
||||
@@ -210,7 +210,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::fuelpumpoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->FuelPumpSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::fuelpumpon );
|
||||
@@ -223,7 +223,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// pantographs
|
||||
case driver_hint::pantographairsourcesetmain: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pantographUnit->pantographAir.ConnectToMainReservoir(true);
|
||||
}
|
||||
remove_hint( driver_hint::pantographairsourcesetauxiliary );
|
||||
@@ -234,7 +234,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographairsourcesetauxiliary: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pantographUnit->pantographAir.ConnectToMainReservoir(false);
|
||||
}
|
||||
remove_hint( driver_hint::pantographcompressoron );
|
||||
@@ -245,7 +245,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographcompressoron: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pantographUnit->pantographAir.SwitchCompressor(true);
|
||||
}
|
||||
remove_hint( driver_hint::pantographcompressoroff );
|
||||
@@ -256,7 +256,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographcompressoroff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pantographUnit->pantographAir.SwitchCompressor(false);
|
||||
}
|
||||
remove_hint( driver_hint::pantographcompressoron );
|
||||
@@ -267,7 +267,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographsvalveon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->OperatePantographsValve( operation_t::enable );
|
||||
}
|
||||
remove_hint( driver_hint::pantographsvalveoff );
|
||||
@@ -278,7 +278,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::frontpantographvalveon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->OperatePantographValve( VehicleEnd::front, operation_t::enable );
|
||||
}
|
||||
remove_hint( driver_hint::frontpantographvalveoff );
|
||||
@@ -290,7 +290,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::frontpantographvalveoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->OperatePantographValve( VehicleEnd::front, operation_t::disable );
|
||||
}
|
||||
remove_hint( driver_hint::frontpantographvalveon );
|
||||
@@ -301,7 +301,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearpantographvalveon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->OperatePantographValve( VehicleEnd::rear, operation_t::enable );
|
||||
}
|
||||
remove_hint( driver_hint::rearpantographvalveoff );
|
||||
@@ -313,7 +313,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearpantographvalveoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->OperatePantographValve( VehicleEnd::rear, operation_t::disable );
|
||||
}
|
||||
remove_hint( driver_hint::rearpantographvalveon );
|
||||
@@ -325,7 +325,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// converter
|
||||
case driver_hint::converteron: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->ConverterSwitch( true );
|
||||
// the local switch of the converter too, where the line contactors wait for the vehicle's own converter
|
||||
// (LineContactorsInterlock): left off by the human driver, that vehicle would never take power
|
||||
@@ -344,7 +344,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::converteroff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->ConverterSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::converteron );
|
||||
@@ -356,7 +356,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// relays
|
||||
case driver_hint::primaryconverteroverloadreset: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->RelayReset( relay_t::primaryconverteroverload );
|
||||
}
|
||||
hint(
|
||||
@@ -366,7 +366,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::maincircuitgroundreset: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->RelayReset( relay_t::maincircuitground );
|
||||
}
|
||||
hint(
|
||||
@@ -376,7 +376,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractionnmotoroverloadreset: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->RelayReset( relay_t::tractionnmotoroverload );
|
||||
}
|
||||
hint(
|
||||
@@ -387,7 +387,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// line breaker
|
||||
case driver_hint::linebreakerclose: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->MainSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::linebreakeropen );
|
||||
@@ -398,7 +398,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::linebreakeropen: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->MainSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::linebreakerclose );
|
||||
@@ -411,7 +411,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// compressor
|
||||
case driver_hint::compressoron: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->CompressorSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::compressoroff );
|
||||
@@ -422,7 +422,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::compressoroff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->CompressorSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::compressoron );
|
||||
@@ -433,7 +433,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::frontmotorblowerson: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->MotorBlowersSwitchOff( false, VehicleEnd::front );
|
||||
occupied->MotorBlowersSwitch( true, VehicleEnd::front );
|
||||
}
|
||||
@@ -446,7 +446,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearmotorblowerson: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->MotorBlowersSwitchOff( false, VehicleEnd::rear );
|
||||
occupied->MotorBlowersSwitch( true, VehicleEnd::rear );
|
||||
}
|
||||
@@ -460,7 +460,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// spring brake
|
||||
case driver_hint::springbrakeon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->SpringBrakeActivate( true );
|
||||
}
|
||||
remove_hint( driver_hint::springbrakeoff );
|
||||
@@ -471,7 +471,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::springbrakeoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->SpringBrakeActivate( false );
|
||||
}
|
||||
remove_hint( driver_hint::springbrakeon );
|
||||
@@ -483,7 +483,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// manual brake
|
||||
case driver_hint::manualbrakon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->IncManualBrakeLevel( ManualBrakePosNo );
|
||||
}
|
||||
remove_hint( driver_hint::manualbrakoff );
|
||||
@@ -494,7 +494,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::manualbrakoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->DecManualBrakeLevel( ManualBrakePosNo );
|
||||
}
|
||||
remove_hint( driver_hint::manualbrakon );
|
||||
@@ -506,7 +506,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// master controller
|
||||
case driver_hint::mastercontrollersetidle: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
while( mvControlling->RList[mvControlling->MainCtrlPos()].Mn == 0
|
||||
&& mvControlling->IncMainCtrl(1) ) {
|
||||
// all work is done in the loop header
|
||||
@@ -520,7 +520,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::mastercontrollersetseriesmode: {
|
||||
if (AIControllFlag && mvControlling->RList[ mvControlling->MainCtrlPos() ].Bn > 1) {
|
||||
if (aiControlled && mvControlling->RList[ mvControlling->MainCtrlPos() ].Bn > 1) {
|
||||
// limit yourself to series mode
|
||||
if( mvControlling->ScndCtrlPos() ) {
|
||||
mvControlling->DecScndCtrl( 2 );
|
||||
@@ -538,7 +538,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::mastercontrollersetzerospeed: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
ZeroSpeed();
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
@@ -549,7 +549,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::mastercontrollersetreverserunlock: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
while( false == mvControlling->EIMDirectionChangeAllow()
|
||||
&& mvControlling->DecMainCtrl(1) ) {
|
||||
// all work is done in the loop header
|
||||
@@ -564,7 +564,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractiveforcedecrease: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
DecSpeed();
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
@@ -580,7 +580,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractiveforceincrease: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
IncSpeed();
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
@@ -598,7 +598,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::bufferscompress: {
|
||||
if (AIControllFlag && std::abs( mvControlling->Ft ) < 50000.0) {
|
||||
if (aiControlled && std::abs( mvControlling->Ft ) < 50000.0) {
|
||||
IncSpeed();
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
@@ -610,7 +610,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
|
||||
case driver_hint::secondcontrollersetzero: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->DecScndCtrl( 2 );
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
@@ -622,7 +622,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
|
||||
case driver_hint::waterpumpon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterPumpSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::waterpumpoff );
|
||||
@@ -634,7 +634,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterpumpoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterPumpSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::waterpumpon );
|
||||
@@ -646,7 +646,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterpumpbreakeron: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterPumpBreakerSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::waterpumpbreakeroff );
|
||||
@@ -658,7 +658,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterpumpbreakeroff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterPumpBreakerSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::waterpumpbreakeron );
|
||||
@@ -670,7 +670,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheateron: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterHeaterSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::waterheateroff );
|
||||
@@ -682,7 +682,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheateroff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterHeaterSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::waterheateron );
|
||||
@@ -694,7 +694,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheaterbreakeron: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterHeaterBreakerSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::waterheaterbreakeroff );
|
||||
@@ -706,7 +706,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheaterbreakeroff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterHeaterBreakerSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::waterheaterbreakeron );
|
||||
@@ -718,7 +718,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::watercircuitslinkon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterCircuitsLinkSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::watercircuitslinkoff );
|
||||
@@ -729,7 +729,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::watercircuitslinkoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->WaterCircuitsLinkSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::watercircuitslinkon );
|
||||
@@ -796,7 +796,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// driver_hint_brakingforcesetzero
|
||||
// driver_hint_brakingforcelap
|
||||
case driver_hint::trainbrakesetpipeunlock: {
|
||||
if (AIControllFlag && occupied->brakes.pipeLock.unlockHandlePosition != -3) {
|
||||
if (aiControlled && occupied->brakes.pipeLock.unlockHandlePosition != -3) {
|
||||
while( BrakeCtrlPosition >= occupied->brakes.pipeLock.unlockHandlePosition
|
||||
&& BrakeLevelAdd(-1) ) {
|
||||
// all work is done in the header
|
||||
@@ -810,7 +810,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::trainbrakerelease: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
// occupied->BrakeLevelSet( occupied->Handle->GetPos( bh_RP ) );
|
||||
BrakeLevelSet( gbh_RP );
|
||||
}
|
||||
@@ -823,7 +823,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::trainbrakeapply: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach powino zostać wyłączone)
|
||||
if( BrakeSystem == TBrakeSystem::ElectroPneumatic && false == ForcePNBrake ) {
|
||||
occupied->BrakeLevelSet( occupied->brakes.driverValve->GetPos( bh_EPB ) );
|
||||
@@ -840,7 +840,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforcedecrease: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
auto const brakingcontrolschange { DecBrake() };
|
||||
// set optional delay between brake adjustments
|
||||
if( brakingcontrolschange && Actionparameter > 0 ) {
|
||||
@@ -856,7 +856,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforceincrease: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
auto const brakingcontrolschange { IncBrake() };
|
||||
// set optional delay between brake adjustments
|
||||
if( brakingcontrolschange && Actionparameter > 0 ) {
|
||||
@@ -876,7 +876,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforcesetzero: { // releases both train and independent brake
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
while( true == DecBrake() ) {
|
||||
// all work is done in the loop condition
|
||||
}
|
||||
@@ -889,7 +889,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforcelap: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
LapBrake();
|
||||
}
|
||||
remove_train_brake_hints();
|
||||
@@ -899,7 +899,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// independent brake
|
||||
case driver_hint::independentbrakeapply: {
|
||||
if (AIControllFlag && occupied->brakes.IndependentPosition() < 1.0) {
|
||||
if (aiControlled && occupied->brakes.IndependentPosition() < 1.0) {
|
||||
occupied->IncLocalBrakeLevel( LocalBrakePosNo );
|
||||
if (occupied->EIMCtrlEmergency) {
|
||||
occupied->DecLocalBrakeLevel(1);
|
||||
@@ -914,7 +914,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::independentbrakerelease: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
ZeroLocalBrake();
|
||||
}
|
||||
remove_hint( driver_hint::independentbrakeapply );
|
||||
@@ -926,7 +926,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// reverser
|
||||
case driver_hint::directionforward: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
OrderDirectionChange( 1, occupied );
|
||||
}
|
||||
remove_reverser_hints();
|
||||
@@ -937,7 +937,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionbackward: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
OrderDirectionChange( -1, occupied );
|
||||
}
|
||||
remove_reverser_hints();
|
||||
@@ -948,7 +948,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionother: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
// DirectionForward( occupied->DirAbsolute < 0 );
|
||||
OrderDirectionChange( iDirectionOrder, occupied );
|
||||
DirectionChange();
|
||||
@@ -961,7 +961,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionnone: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
ZeroDirection();
|
||||
}
|
||||
remove_reverser_hints();
|
||||
@@ -973,7 +973,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// anti-slip systems
|
||||
case driver_hint::sandingon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->Sandbox( true );
|
||||
}
|
||||
remove_hint( driver_hint::sandingoff );
|
||||
@@ -984,7 +984,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::sandingoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->Sandbox( false );
|
||||
}
|
||||
remove_hint( driver_hint::sandingon );
|
||||
@@ -995,7 +995,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::antislip: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
mvControlling->AntiSlippingButton();
|
||||
}
|
||||
hint(
|
||||
@@ -1006,7 +1006,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// horns
|
||||
case driver_hint::hornon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->SetWarningSignal(static_cast<int>( Actionparameter ));
|
||||
}
|
||||
remove_hint( driver_hint::hornoff );
|
||||
@@ -1018,7 +1018,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::hornoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->SetWarningSignal(0);
|
||||
}
|
||||
/*
|
||||
@@ -1033,7 +1033,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// door locks
|
||||
case driver_hint::consistdoorlockson: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->LockDoors( true );
|
||||
}
|
||||
// TODO: remove other door lock hints
|
||||
@@ -1045,7 +1045,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// departure signal
|
||||
case driver_hint::departuresignalon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->signal_departure( true );
|
||||
}
|
||||
remove_hint( driver_hint::departuresignaloff );
|
||||
@@ -1056,7 +1056,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::departuresignaloff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->signal_departure( false );
|
||||
}
|
||||
remove_hint( driver_hint::departuresignalon );
|
||||
@@ -1068,7 +1068,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// consist doors
|
||||
case driver_hint::doorrightopen: {
|
||||
if( AIControllFlag
|
||||
if( aiControlled
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::right, true );
|
||||
}
|
||||
@@ -1080,7 +1080,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorrightclose: {
|
||||
if( AIControllFlag
|
||||
if( aiControlled
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::right, false );
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftopen: {
|
||||
if( AIControllFlag
|
||||
if( aiControlled
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::left, true );
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftclose: {
|
||||
if( AIControllFlag
|
||||
if( aiControlled
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::left, false );
|
||||
}
|
||||
@@ -1116,7 +1116,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorrightpermiton: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pVehicle->physics->PermitDoors( VehicleSide::right, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightpermitoff );
|
||||
@@ -1127,7 +1127,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorrightpermitoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pVehicle->physics->PermitDoors( VehicleSide::right, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightpermiton );
|
||||
@@ -1138,7 +1138,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftpermiton: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pVehicle->physics->PermitDoors( VehicleSide::left, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftpermitoff );
|
||||
@@ -1149,7 +1149,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftpermitoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pVehicle->physics->PermitDoors( VehicleSide::left, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftpermiton );
|
||||
@@ -1161,7 +1161,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// doorsteps, as the timetable asks (eu07/maszyna#95)
|
||||
case driver_hint::doorstepon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->PermitDoorStep( true );
|
||||
}
|
||||
remove_hint( driver_hint::doorstepoff );
|
||||
@@ -1172,7 +1172,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorstepoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->PermitDoorStep( false );
|
||||
}
|
||||
remove_hint( driver_hint::doorstepon );
|
||||
@@ -1184,7 +1184,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// consist lights
|
||||
case driver_hint::consistlightson: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->CompartmentLightsSwitch( true );
|
||||
occupied->CompartmentLightsSwitchOff( false );
|
||||
}
|
||||
@@ -1197,7 +1197,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::consistlightsoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->CompartmentLightsSwitch( false );
|
||||
occupied->CompartmentLightsSwitchOff( true );
|
||||
}
|
||||
@@ -1211,7 +1211,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// consist heating
|
||||
case driver_hint::consistheatingon: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->HeatingSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::consistheatingoff );
|
||||
@@ -1222,7 +1222,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::consistheatingoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->HeatingSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::consistheatingon );
|
||||
@@ -1234,7 +1234,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
|
||||
case driver_hint::securitysystemreset: {
|
||||
if (AIControllFlag && occupied->SecuritySystem.is_blinking())
|
||||
if (aiControlled && occupied->SecuritySystem.is_blinking())
|
||||
occupied->SecuritySystemReset();
|
||||
hint(
|
||||
Action,
|
||||
@@ -1243,7 +1243,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::shpsystemreset: {
|
||||
if (AIControllFlag && occupied->SecuritySystem.is_cabsignal_blinking())
|
||||
if (aiControlled && occupied->SecuritySystem.is_cabsignal_blinking())
|
||||
occupied->SecuritySystem.cabsignal_reset();
|
||||
hint(
|
||||
Action,
|
||||
@@ -1253,7 +1253,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::couplingadapterattach: {
|
||||
// TODO: run also for potential settings-based virtual assistant
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pVehicles[ VehicleEnd::front ]->attach_coupler_adapter( EndOf( static_cast<int>(Actionparameter) ) );
|
||||
}
|
||||
hint(
|
||||
@@ -1264,7 +1264,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::couplingadapterremove: {
|
||||
if( AIControllFlag || Global.AITrainman ) {
|
||||
if( aiControlled || Global.AITrainman ) {
|
||||
pVehicles[ VehicleEnd::front ]->remove_coupler_adapter( EndOf( static_cast<int>(Actionparameter) ) );
|
||||
}
|
||||
hint(
|
||||
@@ -1276,7 +1276,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// lights
|
||||
case driver_hint::headcodepc1: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pVehicles[ VehicleEnd::front ]->RaLightsSet( light::headlight_left | light::headlight_right | light::headlight_upper, -1 );
|
||||
}
|
||||
remove_hint( driver_hint::headcodepc2 );
|
||||
@@ -1289,7 +1289,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::headcodepc2: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
pVehicles[ VehicleEnd::front ]->RaLightsSet( light::redmarker_left | light::headlight_right | light::headlight_upper, -1 );
|
||||
}
|
||||
remove_hint( driver_hint::headcodepc1 );
|
||||
@@ -1304,7 +1304,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
case driver_hint::headcodetb1: {
|
||||
// HACK: the 'front' and 'rear' of the consist is determined by current consist direction
|
||||
// since direction shouldn't affect Tb1 light configuration, we 'counter' this behaviour by virtually swapping end vehicles
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
if( occupied->DirActive >= 0 ) { Lights( light::headlight_right, light::headlight_left ); }
|
||||
else { Lights( light::headlight_left, light::headlight_right ); }
|
||||
}
|
||||
@@ -1321,7 +1321,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::headcodepc5: {
|
||||
if( AIControllFlag
|
||||
if( aiControlled
|
||||
|| ( Global.AITrainman && false == pVehicles[VehicleEnd::rear]->is_connected(pVehicle, Coupling::control) ) ) {
|
||||
pVehicles[ VehicleEnd::rear ]->RaLightsSet( -1, light::redmarker_left | light::redmarker_right | light::rearendsignals );
|
||||
}
|
||||
@@ -1334,7 +1334,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::lightsoff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
Lights( 0, 0 );
|
||||
}
|
||||
remove_hint( driver_hint::headcodepc1 );
|
||||
@@ -1351,7 +1351,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// releaser
|
||||
case driver_hint::releaseron: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->BrakeReleaser( 1 );
|
||||
}
|
||||
remove_hint( driver_hint::releaseroff );
|
||||
@@ -1362,7 +1362,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
break;
|
||||
}
|
||||
case driver_hint::releaseroff: {
|
||||
if( AIControllFlag ) {
|
||||
if( aiControlled ) {
|
||||
occupied->BrakeReleaser( 0 );
|
||||
}
|
||||
remove_hint( driver_hint::releaseron );
|
||||
|
||||
Reference in New Issue
Block a user