mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-04 14:48:45 +00:00
CogEngine: Fix crash when the CogEngine data asset is not present
Fix cheat colors always overriding the user color
This commit is contained in:
@@ -16,13 +16,20 @@ void FCogEngineWindow_Cheats::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to apply cheats to the selected actor (by default). "
|
||||
"The cheats can be configured in the '%s' data asset. "
|
||||
"When clicking a cheat button, press:\n"
|
||||
" [CTRL] to apply the cheat to controlled actor\n"
|
||||
" [ALT] to apply the cheat to the allies of the selected actor\n"
|
||||
" [SHIFT] to apply the cheat to the enemies of the selected actor\n"
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(Asset.Get()))
|
||||
);
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::Text("Create a DataAsset child of 'CogEngineDataAsset' to configure the cheats. ");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("The cheats can be configured in the '%s' data asset. ", StringCast<ANSICHAR>(*GetNameSafe(Asset.Get())).Get());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -436,6 +443,9 @@ void FCogEngineWindow_Cheats::RequestCheat(ACogEngineReplicator& Replicator, AAc
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
const FCogEngineCheat* FCogEngineWindow_Cheats::FindCheatByName(const FString& CheatName, const bool OnlyPersistentCheats)
|
||||
{
|
||||
if (Asset == nullptr)
|
||||
{ return nullptr; }
|
||||
|
||||
for (const FCogEngineCheatCategory& CheatCategory : Asset->CheatCategories)
|
||||
{
|
||||
for (const FCogEngineCheat& Cheat : CheatCategory.PersistentCheats)
|
||||
@@ -447,9 +457,7 @@ const FCogEngineCheat* FCogEngineWindow_Cheats::FindCheatByName(const FString& C
|
||||
}
|
||||
|
||||
if (OnlyPersistentCheats)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
{ continue; }
|
||||
|
||||
for (const FCogEngineCheat& Cheat : CheatCategory.InstantCheats)
|
||||
{
|
||||
@@ -458,8 +466,6 @@ const FCogEngineCheat* FCogEngineWindow_Cheats::FindCheatByName(const FString& C
|
||||
return &Cheat;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user