Hello!
I believe this is one of those occasions that C++'s conditional operator really improves readability.
This
if (DeltaRotator.Yaw < 180)
{
Turret->Rotate(DeltaRotator.Yaw);
}
else
{
Turret->Rotate(-DeltaRotator.Yaw);
}
can be refactored as
Turret->Rotate(DeltaRotator.Yaw < 180 ? DeltaRotator.Yaw : -DeltaRotator.Yaw);
// or
Turret->Rotate(DeltaRotator.Yaw * (DeltaRotator.Yaw < 180 ? 1 : -1)); // Slightly more complicated :)
I know it doesn’t make any difference but in my opinion the code looks simpler and neater this way.