From e3284575d41ba9c3b090f703309d16159157f7ae Mon Sep 17 00:00:00 2001 From: Sixze <16257871+Sixze@users.noreply.github.com> Date: Sat, 28 Aug 2021 00:09:16 +0300 Subject: [PATCH] Minor code improvements --- ALS/Source/ALS/Private/AlsCharacter.cpp | 12 ++++++++---- ALS/Source/ALS/Public/ControlRig/AlsRigUnit_Math.h | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ALS/Source/ALS/Private/AlsCharacter.cpp b/ALS/Source/ALS/Private/AlsCharacter.cpp index 899ac991c..12df351ba 100644 --- a/ALS/Source/ALS/Private/AlsCharacter.cpp +++ b/ALS/Source/ALS/Private/AlsCharacter.cpp @@ -402,8 +402,9 @@ bool AAlsCharacter::CanSprint() const return LocomotionState.bHasInput && (RotationMode != EAlsRotationMode::Aiming || bSprintHasPriorityOverAiming) && + // ReSharper disable once CppRedundantParentheses ((ViewMode != EAlsViewMode::FirstPerson && - (DesiredRotationMode == EAlsRotationMode::VelocityDirection || bRotateToVelocityWhenSprinting)) || + (DesiredRotationMode == EAlsRotationMode::VelocityDirection || bRotateToVelocityWhenSprinting)) || FMath::Abs(FRotator::NormalizeAxis(LocomotionState.InputYawAngle - ViewState.SmoothRotation.Yaw)) < 50.0f); } @@ -487,6 +488,7 @@ void AAlsCharacter::RefreshRotationMode() return; } + // ReSharper disable once CppRedundantParentheses if ((bSprinting && DesiredRotationMode == EAlsRotationMode::Aiming) || DesiredRotationMode == EAlsRotationMode::VelocityDirection) { @@ -865,8 +867,9 @@ void AAlsCharacter::RefreshGroundedActorRotation(const float DeltaTime) // Not moving. + // ReSharper disable once CppRedundantParentheses if ((!TryRefreshCustomGroundedNotMovingActorRotation(DeltaTime) && - RotationMode == EAlsRotationMode::Aiming) || ViewMode == EAlsViewMode::FirstPerson) + RotationMode == EAlsRotationMode::Aiming) || ViewMode == EAlsViewMode::FirstPerson) { RefreshGroundedNotMovingAimingActorRotation(DeltaTime); } @@ -1811,7 +1814,7 @@ void AAlsCharacter::TryStartRolling(const float PlayRate) { StartRolling(PlayRate, LocomotionState.bHasInput && (RollingSettings.bRotateToInputOnStart || - (RollingSettings.bRotateToInputDuringRoll && RollingSettings.InputInterpolationSpeed <= 0.0f)) + RollingSettings.bRotateToInputDuringRoll && RollingSettings.InputInterpolationSpeed <= 0.0f) ? LocomotionState.InputYawAngle : LocomotionState.Rotation.Yaw); } @@ -1820,8 +1823,9 @@ void AAlsCharacter::TryStartRolling(const float PlayRate) bool AAlsCharacter::IsRollingAllowedToStart(const UAnimMontage* Montage) const { return LocomotionAction == EAlsLocomotionAction::None || + // ReSharper disable once CppRedundantParentheses (LocomotionAction == EAlsLocomotionAction::Rolling && - !GetMesh()->GetAnimInstance()->Montage_IsPlaying(Montage)); + !GetMesh()->GetAnimInstance()->Montage_IsPlaying(Montage)); } void AAlsCharacter::StartRolling(const float PlayRate, const float TargetYawAngle) diff --git a/ALS/Source/ALS/Public/ControlRig/AlsRigUnit_Math.h b/ALS/Source/ALS/Public/ControlRig/AlsRigUnit_Math.h index 9c7d57cc5..e88d7e022 100644 --- a/ALS/Source/ALS/Public/ControlRig/AlsRigUnit_Math.h +++ b/ALS/Source/ALS/Public/ControlRig/AlsRigUnit_Math.h @@ -26,10 +26,10 @@ struct ALS_API FAlsRigUnit_CalculatePoleVector : public FAlsRigUnit_MathBase FRigElementKey ItemC; UPROPERTY(Meta = (Input)) - bool bInitial; + bool bInitial{false}; UPROPERTY(Meta = (Output)) - bool bSuccess; + bool bSuccess{false}; UPROPERTY(Meta = (Output)) FVector StartLocation{FVector::ZeroVector};