Skip to content

Commit

Permalink
[#60] Eliminate FGameplayTag::GetTag()
Browse files Browse the repository at this point in the history
This was identical to `FGameplayTag::RequestGameplayTag()` in the
`FName` case, and not that much extra effort to invoke `FName()`
ourselves in the `FString` case, so it doesn't make sense for this to
exist.
  • Loading branch information
GuyPaddock committed Jul 19, 2024
1 parent cbb091d commit 4eee547
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ FGameplayTag FPF2AttackAttributeStatics::GetDamageTypeForDamageAttribute(const F
{
if (Pair.Value == Attribute.AttributeName)
{
FoundTag = PF2GameplayAbilityUtilities::GetTag(Pair.Key);
FoundTag = FGameplayTag::RequestGameplayTag(Pair.Key);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ bool UPF2AbilitySystemComponent::DeactivatePassiveGameplayEffects(const FName We

Query.EffectTagQuery =
FGameplayTagQuery::MakeQuery_MatchAnyTags(
FGameplayTagContainer(PF2GameplayAbilityUtilities::GetTag(WeightGroup))
FGameplayTagContainer(FGameplayTag::RequestGameplayTag(WeightGroup))
);

NumRemoved = this->RemoveActiveEffects(Query);
Expand Down Expand Up @@ -785,7 +785,7 @@ void UPF2AbilitySystemComponent::ActivatePassiveGameplayEffect(
// Ensure that the GE spec is tagged with its weight no matter how the weight was set (either through API or through
// a tag in the InheritableGameplayEffectTags field on the GE definition class itself). Without this, only the tag
// from the GE definition spec would pass through.
GameplayEffectSpec->AddDynamicAssetTag(PF2GameplayAbilityUtilities::GetTag(WeightGroup));
GameplayEffectSpec->AddDynamicAssetTag(FGameplayTag::RequestGameplayTag(WeightGroup));

// Special case: If the GE being activated is our "dummy" GE for dynamic tags, apply tags to it.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
#include "Utilities/PF2GameplayAbilityUtilities.h"

FPF2TemlCalculation::FPF2TemlCalculation(const FString& TagPrefix, const FGameplayEffectSpec& Spec) :
FPF2TemlCalculation(PF2GameplayAbilityUtilities::GetTag(TagPrefix), Spec)
FPF2TemlCalculation(FName(TagPrefix), Spec)
{
}

FPF2TemlCalculation::FPF2TemlCalculation(const FName TagPrefix, const FGameplayEffectSpec& Spec) :
FPF2TemlCalculation(PF2GameplayAbilityUtilities::GetTag(TagPrefix), Spec)
FPF2TemlCalculation(FGameplayTag::RequestGameplayTag(TagPrefix), Spec)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include "CharacterStats/PF2CharacterAbilitySystemInterface.h"

#include "GameplayTags/GameplayEffects/WeightGroups.h"

/**
* Utility logic for working with Gameplay Abilities.
*/
Expand All @@ -32,7 +34,7 @@ namespace PF2GameplayAbilityUtilities
FName GetWeightGroupOfGameplayEffect(const TSubclassOf<UGameplayEffect> GameplayEffect, const FName DefaultWeight)
{
FName WeightGroup;
const FGameplayTag WeightTagParent = GetTag(FName(TEXT("PF2.GameplayEffect.WeightGroup")));
const FGameplayTag WeightTagParent = Pf2TagGameplayEffectWeightGroups;
const UGameplayEffect* Effect = GameplayEffect.GetDefaultObject();

const FGameplayTagContainer WeightTags = Effect->GetAssetTags().Filter(FGameplayTagContainer(WeightTagParent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,6 @@ class UPF2CharacterAttributeSet;
*/
namespace PF2GameplayAbilityUtilities
{
/**
* Gets the specified tag out of the tags known to the project.
*
* The tag must already exist in one of the INI files under Config/Tags; otherwise, this will trigger an error.
*
* @param TagName
* The name of the tag, as an FName.
*
* @return
* The desired tag.
*/
FORCEINLINE OPENPF2GAMEFRAMEWORK_API FGameplayTag GetTag(const FName& TagName)
{
return FGameplayTag::RequestGameplayTag(TagName);
}

/**
* Gets the specified tag out of the tags known to the project.
*
* The tag must already exist in one of the INI files under Config/Tags; otherwise, this will trigger an error.
*
* @param TagName
* The name of the tag, as a string.
*
* @return
* The desired tag.
*/
FORCEINLINE OPENPF2GAMEFRAMEWORK_API FGameplayTag GetTag(const FString& TagName)
{
return GetTag(FName(TagName));
}

/**
* Checks if a tag with the given name or prefix is present.
*
Expand Down
4 changes: 2 additions & 2 deletions Source/OpenPF2Tests/Private/Tests/PF2SpecBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ FActiveGameplayEffectHandle FPF2SpecBase::InitializeAttributeAndApplyEffect(

void FPF2SpecBase::ApplyUnreplicatedTag(const FString& TagName) const
{
this->TestPawnAsc->AddLooseGameplayTag(PF2GameplayAbilityUtilities::GetTag(TagName));
this->TestPawnAsc->AddLooseGameplayTag(FGameplayTag::RequestGameplayTag(FName(TagName)));
}

void FPF2SpecBase::RemoveUnreplicatedTag(const FString& TagName) const
{
this->TestPawnAsc->RemoveLooseGameplayTag(PF2GameplayAbilityUtilities::GetTag(TagName));
this->TestPawnAsc->RemoveLooseGameplayTag(FGameplayTag::RequestGameplayTag(FName(TagName)));
}

void FPF2SpecBase::TestCharacterHasCondition(const TScriptInterface<IPF2CharacterInterface>& Character,
Expand Down

0 comments on commit 4eee547

Please sign in to comment.