I have a TMap<TSubclassOf<AActor>, FPlacableDbItem>
crashes when searching for non existent element:
FPlacableDbItem item = *itemsMap.Find(itemClass);
I suspect it has something to do with FPlacableDbItem having a FText as UPROPERTY
I could avoid it by first checking if map contains the item but since it’s redundant I hope it can be fixed, maybe with custom struct copy constructor?
USTRUCT(BlueprintType)
struct FPlacableDbItem : public FTableRowBase
{
GENERATED_BODY()
public:
///item name displayed in ui
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText uiName;
///blueprint
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<AActor> classType;
///cells count this item occupies
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FVector areaRequired;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float buyPrice;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText descriptionToolTip;
///can be placed only on factory edges? doors
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool edgeOnly;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FProductSlot productSlot;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FPowerSlot> powerSlots;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float powerConsumption;
FPlacableDbItem() {
areaRequired=FVector(666);
//FString wtf = FString("not set");
//uiName = FName(*wtf);
uiName = FText();
};
bool IsValid()
{
return areaRequired.X != 666;
};
}