I want to overload a UFUNCTION CanFire() with CanFire(bool, bool)
UFUNCTION(BlueprintCallable, Category = "Status|Get")
// Check if character meets the requirements to fire
bool CanFire() const;
UFUNCTION(BlueprintCallable, Category = "Status|Get")
/* Check if character meets the requirements to fire
* @param bCheckMovement : true to check movement, otherwise false
* @param bFalseIfFiring : true to account for current fire state, otherwise false
*/
bool CanFire(bool bCheckMovement, bool bFalseIfFiring) const;
////////// .cpp //////////
// Check if character meets the requirements to fire
bool ADHCharacter::CanFire() const
{
return GetCurrentWeaponInfo().CanFire();
}
/* Check if character meets the requirements to fire
* @param bCheckMovement : true to check movement, otherwise false
* @param bFalseIfFiring : true to account for current fire state, otherwise false
*/
bool ADHCharacter::CanFire(bool bCheckMovement, bool bFalseIfFiring) const
{
if (!((bCheckMovement && bIsSprinting) && (bFalseIfFiring && bIsFiring))) return GetCurrentWeaponInfo().CanFire();
else return false;
}
However, this creates an error on compile:
1> D:/Library Storage/Documents/Unreal Projects/DistantHome/Source/DistantHome/Public/Player/DHCharacter.h(173) : 'CanFire' conflicts with 'Function /Script/DistantHome.DHCharacter:CanFire'
So how do I overload a UFUNCTION?
I want to avoid:
#define CAN_FIRE CanFire(false, true)