Writing Error Checking Code - Status Comes Back As -858993460

Hey everyone! I’ve been enjoying the Unreal course a lot, but I’ve hit a snag in lecture 42. We have just written the error checking code under CheckGuessValidity and I realized I could not complete the challenge because the status isn’t changing properly. Upon debugging, I found that the value of Status isn’t OK or any other error message, but -858993460. I don’t know how it’s happening because I feel I copied the code perfectly, but I’ll post the relevant sections here.

CheckGuessValidity looks as follows:

EGuessStatus FBullCowGame::CheckGuessValidity(FString Guess) const
{
if (false)
{
return EGuessStatus::Not_Isogram;
}
else if (false)
{
return EGuessStatus::Not_LowerCase;
}
else if (false)
{
return EGuessStatus::Wrong_Length;
}
else
{
return EGuessStatus::OK;
}

}

PlayGame looks like this:

void PlayGame()
{
BCGame.Reset();
int32 MaxTries = BCGame.GetMaxTries();
for (int32 count = 1; count <= MaxTries; count++)
{
FText Guess = GetGuess();

	EGuessStatus Status = BCGame.CheckGuessValidity(Guess); 

	FBullCowCount BullCowCount = BCGame.SubmitGuess(Guess);

	std::cout << "Bulls = " << BullCowCount.Bulls;
	std::cout << "Cows = " << BullCowCount.Cows << std::endl;
	std::cout << std::endl;
}

}

Does anyone know why it isn’t returning the value to Status properly? Help would be appreciated!

You put the breakpoint on the line

EGuessStatus Status = BCGame.CheckGuessValidity(Guess);

right? then the program halts on that line BUT the line has not been executed yet, so CheckGuessValidity has not been called yet and most important Status is not initialized yet, so displays that value, just step over with F10 so you’ll execute the call and see the result.

1 Like

Hallo, I just had the same problem.
Turns out the breakpoint should not be the Eguess Status line, the Status string has not yet returned at this point. If you would move the breaking point to the next line it would work again.

Privacy & Terms