16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 17:29:18 +02:00

possible nullptr workaround, but without understanding

This commit is contained in:
milek7
2022-04-09 21:09:32 +02:00
parent fda53415e8
commit 020fa3ab05

View File

@@ -258,12 +258,14 @@ void state_manager::process_commands() {
// TODO: support for primary mode request passed as commanddata.param1 // TODO: support for primary mode request passed as commanddata.param1
if( !sameconsist && isincharge ) { if( !sameconsist && isincharge ) {
// oddajemy dotychczasowy AI // oddajemy dotychczasowy AI
if (currentvehicle->Mechanik != nullptr)
currentvehicle->Mechanik->TakeControl( true ); currentvehicle->Mechanik->TakeControl( true );
} }
if( sameconsist && !aidriveractive ) { if( sameconsist && !aidriveractive ) {
// since we're consist owner we can simply move to the destination vehicle // since we're consist owner we can simply move to the destination vehicle
senderlocaltrain->MoveToVehicle( targetvehicle ); senderlocaltrain->MoveToVehicle( targetvehicle );
if (senderlocaltrain->Dynamic()->Mechanik != nullptr)
senderlocaltrain->Dynamic()->Mechanik->TakeControl( false, true ); senderlocaltrain->Dynamic()->Mechanik->TakeControl( false, true );
} }
} }