@@ -414,7 +414,6 @@ void ACarPawn::Tick(float Delta)
414
414
415
415
void ACarPawn::updateCarControls ()
416
416
{
417
- const msr::airlib::CarApiBase::CarControls* current_controls = nullptr ;
418
417
if (wrapper_->getRemoteControlID () >= 0 && joystick_state_.is_initialized ) {
419
418
joystick_.getJoyStickState (0 , joystick_state_);
420
419
@@ -442,25 +441,25 @@ void ACarPawn::updateCarControls()
442
441
}
443
442
444
443
UAirBlueprintLib::LogMessageString (" Control Mode: " , " Wheel/Joystick" , LogDebugLevel::Informational);
445
- current_controls = & joystick_controls_;
444
+ current_controls_ = joystick_controls_;
446
445
}
447
446
else {
448
447
UAirBlueprintLib::LogMessageString (" Control Mode: " , " Keyboard" , LogDebugLevel::Informational);
449
- current_controls = & keyboard_controls_;
448
+ current_controls_ = keyboard_controls_;
450
449
}
451
450
452
451
if (!api_->isApiControlEnabled ()) {
453
- api_->setCarControls (* current_controls );
452
+ api_->setCarControls (current_controls_ );
454
453
}
455
454
else {
456
455
UAirBlueprintLib::LogMessageString (" Control Mode: " , " API" , LogDebugLevel::Informational);
457
- current_controls = & api_->getCarControls ();
456
+ current_controls_ = api_->getCarControls ();
458
457
}
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);
464
463
}
465
464
466
465
void ACarPawn::BeginPlay ()
@@ -552,9 +551,9 @@ std::string ACarPawn::getLogString()
552
551
553
552
std::string logString = std::to_string (timestamp_millis).append (" \t " )
554
553
.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 " )
558
557
.append (gear).append (" \t " );
559
558
560
559
return logString;
0 commit comments