Skip to content

Commit

Permalink
Merge branch 'main' into feature/CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciberusps committed Oct 24, 2024
2 parents 8002ad5 + d12fa13 commit a014f47
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
#include "BehaviorTree/BTTaskNode.h"
#include "BehaviorTree/BTCompositeNode.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Misc/EngineVersionComparison.h"
#include "GameFramework/Actor.h"
#include "VisualLogger/VisualLogger.h"
#include "BehaviorTree/BTTaskNode.h"
#include "BehaviorTree/BTAuxiliaryNode.h"
#include "Kismet/KismetMathLibrary.h"

#include UE_INLINE_GENERATED_CPP_BY_NAME(BTC_RandomSelector)
Expand Down Expand Up @@ -87,21 +92,16 @@ FName UBTC_RandomSelector::GetNodeIconName() const
#endif

#if UE_VERSION_NEWER_THAN(5, 4, 0)
uint16 UBTC_RandomSelector::GetInstanceMemorySize() const
{
return sizeof(FBTRandomSelectorMemory);
}

void UBTC_RandomSelector::InitializeMemory(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory,
EBTMemoryInit::Type InitType) const
{
InitializeNodeMemory<FBTRandomSelectorMemory>(NodeMemory, InitType);
InitializeNodeMemory<FBTCompositeMemory>(NodeMemory, InitType);
}

void UBTC_RandomSelector::CleanupMemory(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory,
EBTMemoryClear::Type CleanupType) const
{
CleanupNodeMemory<FBTRandomSelectorMemory>(NodeMemory, CleanupType);
CleanupNodeMemory<FBTCompositeMemory>(NodeMemory, CleanupType);
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BehaviorTreeTypes.h"
#include "BehaviorTree/Services/BTService_DefaultFocus.h"
#include "AIController.h"

#include UE_INLINE_GENERATED_CPP_BY_NAME(BTS_GameplayFocus)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
#pragma once

#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "BehaviorTree/BTCompositeNode.h"
#include "BehaviorTree/BehaviorTreeTypes.h"
#include "Misc/EngineVersionComparison.h"
#include "BTC_RandomSelector.generated.h"

class UBehaviorTreeComponent;

struct FBTRandomSelectorMemory
{
};
// Should nest from "FBTCompositeMemory" or build error fail on FAB servers
// struct FBTRandomSelectorMemory : public FBTCompositeMemory
// {
// };

/**
* RandomSelector composite node.
Expand All @@ -28,7 +30,7 @@ class UNREALHELPERLIBRARY_API UBTC_RandomSelector : public UBTCompositeNode
GENERATED_BODY()

public:
explicit UBTC_RandomSelector(const FObjectInitializer& ObjectInitializer);
UBTC_RandomSelector(const FObjectInitializer& ObjectInitializer);

// TODO validate that chances count == ChildrenNum
// if no chance specified, node without chance will win always
Expand All @@ -48,7 +50,6 @@ class UNREALHELPERLIBRARY_API UBTC_RandomSelector : public UBTCompositeNode

#if UE_VERSION_NEWER_THAN(5, 4, 0)
// 5.4.0 and up only code
virtual uint16 GetInstanceMemorySize() const override;
virtual void InitializeMemory(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTMemoryInit::Type InitType) const override;
virtual void CleanupMemory(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTMemoryClear::Type CleanupType) const override;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class UNREALHELPERLIBRARY_API UBTS_GameplayFocus : public UBTService_DefaultFocu
UBTS_GameplayFocus(const FObjectInitializer& ObjectInitializer);

#if UE_VERSION_NEWER_THAN(5, 4, 0)
virtual uint16 GetInstanceMemorySize() const override { return sizeof(FBTFocusMemory); }
virtual void InitializeMemory(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTMemoryInit::Type InitType) const override;
virtual void CleanupMemory(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTMemoryClear::Type CleanupType) const override;
#endif
Expand Down

0 comments on commit a014f47

Please sign in to comment.