Data Structure of Pointers to Interface Objects

I have an interface that I’ve created for my creeps:

#include "CoreMinimal.h"
#include "ICreepBasic.generated.h"
UINTERFACE(MinimalAPI)
class UICreepBasic : public UInterface
{
	GENERATED_BODY()
};
/**
 * 
 */
class SPAWNCREEPWAVE_API IICreepBasic
{
	GENERATED_BODY()
.
.
.
}

Let’s say that in one of my other objects I want to store a map.  The key will be the creep type (represented by an int).  The value will be a TArray of the available creeps of that type.  Something like this:

TMap<int , TArray<IICreepBasic*>> * AvailibleFills;

So if I have 1 creep of type 1 and 2 creeps of type two my structure should look like this:

[1][PointerToCreepOne] ,

[2][PointerToCreepTwo, PointerToCreepThree]

Now, I have a pointer to an IICreepBasic that I want to insert as a type 1 so that I get:

[1][PointerToCreepOne, PointerToCreepFour] ,

[2][PointerToCreepTwo, PointerToCreepThree]

I write a function:

void AWaypointManager::RegisterCreep(IICreepBasic * TheCreep)
{
 .
 .
 .
		(AvailibleFills[CreepType])->Add(TheCreep);
	

}

Unfortunately I get this error:

Error C2664: ‘RegisterCreep(IICreepBasic *)’: cannot convert arguement 1 from TScriptInterface opencarrot IICreepBasic closecarrot ’ to ‘IICreepBasic *’

I’m not sure where the TScriptInterface is coming into things. Am I missing something obvious?

Having done some more research, I think my problem is related to the idea of a 2D TArray not being supported. I’m going to try wrapping it in a struct per these answers and see if that resolves my issues:

Hmmm, no luck. There was a problem with my original syntax but now I have an almost identical working function using a struct to wrap the array for a different data type:

CustomStructs.h:

#pragma once

#include "CreepWaypoint.h"

#include  "CustomStructs.generated.h"

USTRUCT()
struct FArrayOfWaypoints
{
	GENERATED_USTRUCT_BODY();

public:
	UPROPERTY()
		TArray<ACreepWaypoint*> WayPointArray;
}; //ArrayOfWaypoints

WaypointManager.h:

...
TMap<int, FArrayOfWaypoints> * PendingRequests;

UFUNCTION()
	void RegisterRequest(int RequestedType, ACreepWaypoint* RequestingPoint);

WaypointManager.cpp:

void AWaypointManager::RegisterRequest(int RequestedType, ACreepWaypoint* RequestingPoint)
{
	if (PendingRequests->Contains(RequestedType))
	{
		((PendingRequests)->Find(RequestedType))->WayPointArray.Add(RequestingPoint);
	}
	else
	{
		PendingRequests->Add(RequestedType);
		((PendingRequests)->Find(RequestedType))->WayPointArray.Add(RequestingPoint);
	}

}

That all seems to work. But when I try to setup an identical system to register my IICreepBasic it gives me the same thing about converting from an IIScriptInterface.

I don’t think the issue is the 2D arrays.
You get a compile error where you CALL RegisterCreep, so your type before that doesn’t seem to be correct!
Why don’t you post how you are calling RegisterCreep() and also, do try to cast it using Cast< IICreepBasic>()

Your TMap should work fine as long as you are actually creating an empty array the first time you add a new KEY.
So, actually, you should use
AvailableFills->FindOrAdd(CreepType)->Add(TheCreep) on AvailableFills instead of accessing it like:
(AvailibleFills[CreepType])->Add(TheCreep);