From 5a967109fad6e0b7b3e2f3ebc3f9e90914429aa1 Mon Sep 17 00:00:00 2001 From: Kevin Poretti Date: Tue, 5 Dec 2023 22:23:16 -0500 Subject: [PATCH] Actually initialize the input buffer on the AI controller --- .../GameplayFramework/FFAIController.cpp | 2 ++ .../UnrealFightingFramework/Input/FFInputBufferComponent.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp b/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp index 755b91b..dd45e4b 100644 --- a/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp +++ b/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp @@ -5,6 +5,7 @@ AFFAIController::AFFAIController() { + InputBuffer = CreateDefaultSubobject(TEXT("InputBuffer")); bWantsPlayerState = true; } @@ -25,5 +26,6 @@ FVector AFFAIController::GetInputAsWorldDirection() const void AFFAIController::DisableMostRecentInput() { + check(InputBuffer); InputBuffer->DisableMostRecentInput(); } diff --git a/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp b/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp index 3ab4529..9c7e64b 100644 --- a/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp +++ b/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp @@ -97,6 +97,11 @@ bool UFFInputBufferComponent::CheckInputSequence(const FFFInputSequence& InputSe void UFFInputBufferComponent::DisableMostRecentInput() { + if(InputBuffer.Num() < 2) + { + return; + } + InputBuffer[InputBuffer.Num() - 1].DisabledButtons |= InputBuffer[InputBuffer.Num() - 1].Buttons; InputBuffer[InputBuffer.Num() - 2].DisabledButtons |= InputBuffer[InputBuffer.Num() - 2].Buttons; }