I have been trying to add a new Iterator but get this error when trying to add it.
1>C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Engine/World.h(368): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
What seems to be causing this is when i add to the header of the World.h file. These are the lines here. Even if i comment them out it still gives that error, until i completely remove them, before it will compile with no errors
class ANavigationObjectBase
typedef TArray<TWeakObjectPtr<ANavigationObjectBase> >::TConstIterator FConstNavigationObjectIterator;
Here is all the code i am putting in. I am after getting all my player starts so i can scan them on login to get my spectator spawns to choose one to spawn at.
//goes in world.h file
class ANavigationObjectBase
typedef TArray<TWeakObjectPtr<ANavigationObjectBase> >::TConstIterator FConstNavigationObjectIterator;
/** Add a physics volume to the list of those in the world. DefaultPhysicsVolume is not tracked. Used internally by APhysicsVolume. */
void AddSpectatorStart(ANavigationObjectBase* S_Start);
/** Removes a physics volume from the list of those in the world. */
void RemoveSpectatorStart(ANavigationObjectBase* S_Start);
/** Get an iterator for all PhysicsVolumes in the world that are not a DefaultPhysicsVolume. */
FConstNavigationObjectIterator GetNavigationObjectIterator() const;
/** Get the count of all PhysicsVolumes in the world that are not a DefaultPhysicsVolume. */
int32 GetNavigationObjectCount() const;
/** List of all Spectator Starts in the world.*/
TArray<TWeakObjectPtr<ANavigationObjectBase> > NavigationObjectList;
FORCEINLINE_DEBUGGABLE FConstNavigationObjectIterator UWorld::GetNavigationObjectIterator() const
{
auto Result = NavigationObjectList.CreateConstIterator();
return (const FConstNavigationObjectIterator&)Result;
}
FORCEINLINE_DEBUGGABLE int32 UWorld::GetNavigationObjectCount() const
{
return NavigationObjectList.Num();
}
//goes in world.cpp file
#include "Engine/NavigationObjectBase.h"
void UWorld::AddSpectatorStart(ANavigationObjectBase* S_Start)
{
if (S_Start)
{
NavigationObjectList.Add(S_Start);
}
}
void UWorld::RemoveSpectatorStart(ANavigationObjectBase* S_Start)
{
NavigationObjectList.RemoveSwap(S_Start);
// Also remove null entries that may accumulate as items become invalidated
NavigationObjectList.RemoveSwap(nullptr);
}
Any help or ideas would be great, thanks for reading.