I tried making the array a txt in order to reduce the compiling time, but obviously I’ve done something wrong and I’m not really sure. Through commenting out various line, I’ve figured out that it probably has to to do with how I wrote it in the header.
Please help
My BeginGame()
void UBullCowCartridge::BeginPlay() // When the game starts
{
Super::BeginPlay();
const FString WordListPath = FPaths::ProjectContentDir() / TEXT("WordLists/HiddenWordList.txt");
FFileHelper::LoadFileToStringArray(HiddenWords, *WordListPath);
//HiddenWords.RemoveAll([this](auto& word) {return IsIsogram(word); });
SetupGame();
PrintLine(TEXT("The number of possible words is %i"), HiddenWords.Num());
PrintLine(TEXT("The Hidden Word is: %s."), *HiddenWord);//Debug Line
for (int32 Index = 0; Index < 5; Index++)
{
PrintLine(TEXT("%s"), HiddenWords[Index]);
}
}
My header file
#pragma once
#include "CoreMinimal.h"
#include "Console/Cartridge.h"
#include "BullCowCartridge.generated.h"
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class BULLCOWGAME_API UBullCowCartridge : public UCartridge
{
GENERATED_BODY()
public:
virtual void BeginPlay() override;
virtual void OnInput(const FString& Input) override;
void SetupGame();
void EndGame();
void ProcessGuess(FString Guess);
bool IsIsogram(FString Word) const;
TArray<FString> HiddenWords;
// Your declarations go below!
private:
FString HiddenWord;
int32 Lives;
bool bGameOver;
};