ToonTanksGameMode wont accept ToonTanksPlayerController header

I might be tired, but i cant see what might cause the problem.
The ToonTanksPlayerController variable is squiggled with the error:

AToonTanksPlayerContoller *AToonTanksGameMode::ToonTanksPlayerController
pointer to incomplete class type "AToonTanksPlayerContoller" is not allowed

ToonTanksGameMode.h looks like this:

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "ToonTanksGameMode.generated.h"

/**
 *
 */
UCLASS()
class TOONTANKS_API AToonTanksGameMode : public AGameModeBase
{
	GENERATED_BODY()

public:
	void ActorDied(AActor *DeadActor);

protected:

	virtual void BeginPlay() override;


private:

	class ATank *Tank;
	class AToonTanksPlayerContoller* ToonTanksPlayerController
	;
};

And ToonTanksGameMode.cpp like this:


#include "ToonTanksGameMode.h"
#include "Kismet/GameplayStatics.h"
#include "Tank.h"
#include "Tower.h"
#include "ToonTanksPlayerController.h"

void AToonTanksGameMode::ActorDied(AActor *DeadActor)
{

    if (DeadActor == Tank)
    {
        Tank->HandleDestruction();

        if (ToonTanksPlayerController)
        {
            
            ToonTanksPlayerController->SetPlayerEnabledState(false);
        }
    }
    else if (ATower *DestroyedTower = Cast<ATower>(DeadActor))
    {
        DestroyedTower->HandleDestruction();
    }
}

void AToonTanksGameMode::BeginPlay()
{
    Super::BeginPlay();

    Tank = Cast<ATank>(UGameplayStatics::GetPlayerPawn(this, 0));
    ToonTanksPlayerController = Cast<AToonTanksPlayerController>(UGameplayStatics::GetPlayerController(this, 0));
}

Ah i found it. i did a typo in the header.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms