Commit ae71b837 authored by Kyrium's avatar Kyrium
Browse files

fix customizer subsystem has not corret add the swatch to gamestate

parent a20cbe14
......@@ -92,7 +92,9 @@ void UKBFLCustomizerSubsystem::RegisterSwatchesInSubsystem(TArray<FKBFLSwatchInf
}
if(!Subsystem->mColorSlots_Data.IsValidIndex(ColourIndex))
for(uint8 i = Subsystem->mColorSlots_Data.Num(); i == ColourIndex; ++i )
{
UE_LOG(CustomizerSubsystem, Log, TEXT("Try to add new color Slot at index, %d - %d"), ColourIndex, Subsystem->mColorSlots_Data.Num());
for(uint8 i = Subsystem->mColorSlots_Data.Num(); i <= ColourIndex; ++i )
{
// Defaults
FFactoryCustomizationColorSlot NewColourSlot = FFactoryCustomizationColorSlot(
......@@ -120,10 +122,23 @@ void UKBFLCustomizerSubsystem::RegisterSwatchesInSubsystem(TArray<FKBFLSwatchInf
UE_LOG(CustomizerSubsystem, Log, TEXT("New Colour slot added: %d"), i);
}
}
else
{
UE_LOG(CustomizerSubsystem, Log, TEXT("Index allready set %d"), ColourIndex);
// Add to Array
if(!FGGameState->mBuildingColorSlots_Data.IsValidIndex(ColourIndex))
{
FGGameState->mBuildingColorSlots_Data[ColourIndex] = Subsystem->mColorSlots_Data[ColourIndex];
FGGameState->SetupColorSlots_Data(Subsystem->mColorSlots_Data);
UE_LOG(CustomizerSubsystem, Log, TEXT("write color again to gamestate: %d / %d"), FGGameState->mBuildingColorSlots_Data.Num(), Subsystem->mColorSlots_Data.Num());
}
}
mSwatchIDMap.Add(ColourIndex, Swatch.mSwatch);
FGGameState->SetupColorSlots_Data(Subsystem->mColorSlots_Data);
Subsystem->mColorSlotsAreDirty = true;
UE_LOG(CustomizerSubsystem, Log, TEXT("Swatch found and success: %d > %s"), ColourIndex, *Swatch.mSwatch->GetName());
UE_LOG(CustomizerSubsystem, Log, TEXT("Swatch found and success: %d > %s (%d/%d)"), ColourIndex, *Swatch.mSwatch->GetName(), FGGameState->mBuildingColorSlots_Data.Num(), Subsystem->mColorSlots_Data.Num());
}
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment