@@ -414,7 +414,6 @@ void ACarPawn::Tick(float Delta)
414414
415415void ACarPawn::updateCarControls ()
416416{
417- const msr::airlib::CarApiBase::CarControls* current_controls = nullptr ;
418417 if (wrapper_->getRemoteControlID () >= 0 && joystick_state_.is_initialized ) {
419418 joystick_.getJoyStickState (0 , joystick_state_);
420419
@@ -442,25 +441,25 @@ void ACarPawn::updateCarControls()
442441 }
443442
444443 UAirBlueprintLib::LogMessageString (" Control Mode: " , " Wheel/Joystick" , LogDebugLevel::Informational);
445- current_controls = & joystick_controls_;
444+ current_controls_ = joystick_controls_;
446445 }
447446 else {
448447 UAirBlueprintLib::LogMessageString (" Control Mode: " , " Keyboard" , LogDebugLevel::Informational);
449- current_controls = & keyboard_controls_;
448+ current_controls_ = keyboard_controls_;
450449 }
451450
452451 if (!api_->isApiControlEnabled ()) {
453- api_->setCarControls (* current_controls );
452+ api_->setCarControls (current_controls_ );
454453 }
455454 else {
456455 UAirBlueprintLib::LogMessageString (" Control Mode: " , " API" , LogDebugLevel::Informational);
457- current_controls = & api_->getCarControls ();
456+ current_controls_ = api_->getCarControls ();
458457 }
459- UAirBlueprintLib::LogMessageString (" Accel: " , std::to_string (current_controls-> throttle ), LogDebugLevel::Informational);
460- UAirBlueprintLib::LogMessageString (" Break: " , std::to_string (current_controls-> brake ), LogDebugLevel::Informational);
461- UAirBlueprintLib::LogMessageString (" Steering: " , std::to_string (current_controls-> steering ), LogDebugLevel::Informational);
462- UAirBlueprintLib::LogMessageString (" Handbreak: " , std::to_string (current_controls-> handbrake ), LogDebugLevel::Informational);
463- UAirBlueprintLib::LogMessageString (" Target Gear: " , std::to_string (current_controls-> manual_gear ), LogDebugLevel::Informational);
458+ UAirBlueprintLib::LogMessageString (" Accel: " , std::to_string (current_controls_. throttle ), LogDebugLevel::Informational);
459+ UAirBlueprintLib::LogMessageString (" Break: " , std::to_string (current_controls_. brake ), LogDebugLevel::Informational);
460+ UAirBlueprintLib::LogMessageString (" Steering: " , std::to_string (current_controls_. steering ), LogDebugLevel::Informational);
461+ UAirBlueprintLib::LogMessageString (" Handbreak: " , std::to_string (current_controls_. handbrake ), LogDebugLevel::Informational);
462+ UAirBlueprintLib::LogMessageString (" Target Gear: " , std::to_string (current_controls_. manual_gear ), LogDebugLevel::Informational);
464463}
465464
466465void ACarPawn::BeginPlay ()
@@ -552,9 +551,9 @@ std::string ACarPawn::getLogString()
552551
553552 std::string logString = std::to_string (timestamp_millis).append (" \t " )
554553 .append (std::to_string (KPH_int).append (" \t " ))
555- .append (std::to_string (keyboard_controls_ .throttle )).append (" \t " )
556- .append (std::to_string (keyboard_controls_ .steering )).append (" \t " )
557- .append (std::to_string (keyboard_controls_ .brake )).append (" \t " )
554+ .append (std::to_string (current_controls_ .throttle )).append (" \t " )
555+ .append (std::to_string (current_controls_ .steering )).append (" \t " )
556+ .append (std::to_string (current_controls_ .brake )).append (" \t " )
558557 .append (gear).append (" \t " );
559558
560559 return logString;
0 commit comments