Building BullCowGameEditor…
Using Visual Studio 2019 14.29.30038 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
[Upgrade]
[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
[Upgrade] bLegacyPublicIncludePaths = false => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
[Upgrade] ShadowVariableWarningLevel = WarningLevel.Error => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
[Upgrade] PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
[Upgrade] Suppress this message by setting ‘DefaultBuildSettings = BuildSettingsVersion.V2;’ in BullCowGameEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.
[Upgrade]
Building 4 actions with 8 processes…
[1/4] BullCowCartridge.cpp
C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(60) : error C4390: ‘;’: empty controlled statement found; is this the intent?
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1552) : error C2338: Invalid argument(s) passed to FString::Printf
C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\Console/Cartridge.h(24): note: see reference to function template instantiation ‘FString FString::Printf<TCHAR[24],FString>(const FmtType (&),FString)’ being compiled
with
[
FmtType=TCHAR [24]
]
C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(80): note: see reference to function template instantiation ‘void UCartridge::PrintLine<24,FString>(const TCHAR (&)[24],FString) const’ being compiled
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554) : error C4840: non-portable use of class ‘FString’ as an argument to a variadic function
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: ‘FString::FString’ is non-trivial
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(190): note: see declaration of ‘FString::FString’
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: the constructor and destructor will not be called; a bitwise copy of the class will be passed as the argument
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Windows/WindowsCriticalSection.h(9): note: see declaration of ‘FString’
Here’s my code
// Fill out your copyright notice in the Description page of Project Settings.
#include "BullCowCartridge.h"
void UBullCowCartridge::BeginPlay() // When the game starts
{
Super::BeginPlay();
InitGame(); // Setting up Game
PrintLine(TEXT("The HiddenWord is: %s."), *HiddenWord); //Debug Line
// Prompt player for guess
}
void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
if (bGameOver)
{
ClearScreen();
InitGame();
}
else
{
ProcessGuess(Input);
}
}
void UBullCowCartridge::InitGame()
{
// Welcome To Game
PrintLine(TEXT("Welcome To Bull Cows!"));
HiddenWord = TEXT("poofs");
Lives = HiddenWord.Len();
bGameOver = false;
PrintLine(TEXT("Guess the %i letter word!"), HiddenWord.Len());
PrintLine(TEXT("You have %i lives"), Lives);
PrintLine(TEXT("Type in your guess and press enter to continue..."));
}
void UBullCowCartridge::EndGame()
{
bGameOver = true;
PrintLine(TEXT("\nPress enter to play again"));
}
void UBullCowCartridge::ProcessGuess(FString Guess)
{
if (Guess == HiddenWord)
{
PrintLine(TEXT("You have won.."));
EndGame();
return;
}
// Check if Isogram
if (!bIsIsogram(Guess));
{
PrintLine(TEXT("You haven't entered an isogram"));
PrintLine(TEXT("Remember, no repeating letters."));
return;
}
if (Guess.Len() != HiddenWord.Len())
{
PrintLine(TEXT("Sorry, try guessing again! \nYou have %i lives remaining"), Lives);
PrintLine(TEXT("The hidden word is %i letter long"), HiddenWord.Len());
return;
}
// Remove Life
PrintLine(TEXT("Lost a life"));
--Lives;
if(Lives <= 0)
{
ClearScreen();
PrintLine(TEXT("You have no lives left!"));
PrintLine(TEXT("The hidden word was: %s"), HiddenWord);
EndGame();
return;
}
}
// Show the player bulls and Cows
bool UBullCowCartridge::bIsIsogram(FString Word)
{
// For each letter
// Start at element [0].
// Compare against next letter
// Until we reach[Word.Len() -1].
// if its the same Word retrun false
return true;
}