Skip to content

Commit

Permalink
Fix GameLift plugin build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pid011 committed Apr 18, 2024
1 parent 7ebaa15 commit 79fdd7c
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ void FGameLiftPluginModule::StartupModule()

DeployAnywhereTab->Register();
DeployManagedEC2Tab->Register();

UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &FGameLiftPluginModule::RegisterMenus));

UToolMenus::RegisterStartupCallback(
FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &FGameLiftPluginModule::RegisterMenus));
FCoreDelegates::OnPostEngineInit.AddRaw(this, &FGameLiftPluginModule::OnPostEngineInit);

RestoreAccount();
Expand All @@ -65,11 +66,11 @@ void FGameLiftPluginModule::OnPostEngineInit()

if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
{
SettingsModule->RegisterSettings("Project", "Plugins",
Settings::kSettingsSectionName,
Plugin::kGameLiftProductName, // display name
Settings::kSettingsSectionTooltip,
GetMutableDefault<UGameLiftSettings>());
SettingsModule->RegisterSettings("Project", "Plugins",
Settings::kSettingsSectionName,
Plugin::kGameLiftProductName, // display name
Settings::kSettingsSectionTooltip,
GetMutableDefault<UGameLiftSettings>());
}
}

Expand All @@ -82,10 +83,11 @@ void FGameLiftPluginModule::RestoreAccount()
{
auto& Bootstrapper = IGameLiftCoreModule::Get().GetProfileBootstrap();
auto IsConfigured = Bootstrapper.ConfigureAccount(Settings->ProfileName.ToString(),
IGameLiftCoreModule::Get().MakeAWSConfigFileProfile(), Settings->S3Bucket.ToString());
IGameLiftCoreModule::Get().MakeAWSConfigFileProfile(),
Settings->S3Bucket.ToString());
if (!IsConfigured)
{
Settings->BootstrapStatus = int(EBootstrapMessageState::FailureMessage);
Settings->BootstrapStatus = static_cast<int>(EBootstrapMessageState::FailureMessage);
}
}
}
Expand All @@ -99,7 +101,8 @@ void FGameLiftPluginModule::ResetDeploymentStatus()
{
auto& Deployer = IGameLiftCoreModule::Get().GetScenarioDeployer();
Deployer.StopDeployment(IGameLiftCoreModule::Get().GetProfileBootstrap().GetAccountInstance());
DeploySettings->Status = FText::FromString(EDeploymentMessageStateToString(EDeploymentMessageState::FailureMessage));
DeploySettings->Status = FText::FromString(
EDeploymentMessageStateToString(EDeploymentMessageState::FailureMessage));
DeploySettings->LatestError = Utils::BuildLastestErrorMessage(Deployer);
DeploySettings->SaveConfig();
}
Expand All @@ -123,7 +126,6 @@ void FGameLiftPluginModule::ShutdownModule()
{
SettingsModule->UnregisterSettings("Project", "Plugins", Settings::kSettingsSectionName);
}

}

void FGameLiftPluginModule::DeployManagedEC2ButtonClicked()
Expand Down Expand Up @@ -168,6 +170,7 @@ void FGameLiftPluginModule::RegisterMenuExtensions()
}), \
FCanExecuteAction())

#pragma warning(disable:5103) //C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
MAP_ACTION(OpenSettings);
MAP_ACTION(DeployAnywhere);
MAP_ACTION(DeployManagedEC2);
Expand All @@ -177,7 +180,7 @@ void FGameLiftPluginModule::RegisterMenuExtensions()
MAP_HELP_URL_ACTION(ReportIssues);
MAP_HELP_URL_ACTION(OpenServiceAPIReference);
MAP_HELP_URL_ACTION(OpenServerSDKReference);

#pragma warning(disable:5103) //C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
#undef MAP_ACTION
#undef MAP_HELP_ACTION
}
Expand All @@ -197,16 +200,19 @@ void FGameLiftPluginModule::RegisterLevelEditorExtensions()
{
UToolMenu* Menu = UToolMenus::Get()->ExtendMenu(kToolsMenu);
{
FToolMenuSection& Section = Menu->AddSection("AmazonSection", ContextMenu::kAmazonSectionText, FToolMenuInsert(NAME_None, EToolMenuInsertType::First));
FToolMenuSection& Section = Menu->AddSection("AmazonSection", ContextMenu::kAmazonSectionText,
FToolMenuInsert(NAME_None, EToolMenuInsertType::First));
FToolMenuEntry& Entry = Section.AddEntry(FToolMenuEntry::InitSubMenu(
"GameLiftPlugin",
ContextMenu::kPluginMainMenuText,
ContextMenu::kPluginMainMenuTooltip,
FNewToolMenuDelegate::CreateStatic(&FGameLiftPluginModule::GenerateWindowMenu, PluginCommands.ToSharedRef()),
FNewToolMenuDelegate::CreateStatic(&FGameLiftPluginModule::GenerateWindowMenu,
PluginCommands.ToSharedRef()),
false,
FSlateIcon(Style::kGameLiftPluginStyleName, Style::Brush::kGameLiftToolbarIconName)
));
FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>(TEXT("LevelEditor"));
FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>(
TEXT("LevelEditor"));
LevelEditorModule.GetGlobalLevelEditorActions()->Append(PluginCommands.ToSharedRef());
}
}
Expand All @@ -219,7 +225,8 @@ void FGameLiftPluginModule::RegisterLevelEditorExtensions()
FToolMenuEntry& Entry = Section.AddEntry(FToolMenuEntry::InitComboButton(
"GameLiftPluginAction",
FUIAction(),
FOnGetContent::CreateStatic(&FGameLiftPluginModule::GenerateToolBarMenu, PluginCommands.ToSharedRef()),
FOnGetContent::CreateStatic(&FGameLiftPluginModule::GenerateToolBarMenu,
PluginCommands.ToSharedRef()),
ContextMenu::kPluginMainMenuText,
ContextMenu::kPluginMainMenuTooltip,
FSlateIcon(Style::kGameLiftPluginStyleName, Style::Brush::kGameLiftToolbarIconName),
Expand All @@ -240,7 +247,8 @@ TSharedRef<SWidget> FGameLiftPluginModule::GenerateToolBarMenu(TSharedRef<FUICom
{
// Get all menu extenders for this context menu from the level editor module
FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>(TEXT("LevelEditor"));
TSharedPtr<FExtender> MenuExtender = LevelEditorModule.AssembleExtenders(InCommandList, LevelEditorModule.GetAllLevelEditorToolbarViewMenuExtenders());
TSharedPtr<FExtender> MenuExtender = LevelEditorModule.AssembleExtenders(
InCommandList, LevelEditorModule.GetAllLevelEditorToolbarViewMenuExtenders());

FToolMenuContext MenuContext(InCommandList, MenuExtender);
UObject* obj = NewObject<UGameLiftToolbarMenuContext>();
Expand All @@ -260,7 +268,8 @@ void FGameLiftPluginModule::RegisterToolBarMenu()
void FGameLiftPluginModule::GenerateMainMenu(UToolMenu* InMenu)
{
{
FToolMenuSection& Section = InMenu->AddSection("GameLiftPlugin_Deployment", ContextMenu::kDeploymentSectionText);
FToolMenuSection& Section = InMenu->
AddSection("GameLiftPlugin_Deployment", ContextMenu::kDeploymentSectionText);
Section.AddMenuEntry(FGameLiftPluginCommands::Get().OpenSettings);
Section.AddMenuEntry(FGameLiftPluginCommands::Get().DeployAnywhere);
Section.AddMenuEntry(FGameLiftPluginCommands::Get().DeployManagedEC2);
Expand All @@ -269,16 +278,17 @@ void FGameLiftPluginModule::GenerateMainMenu(UToolMenu* InMenu)
{
FToolMenuSection& Section = InMenu->AddSection("GameLiftPlugin_Help", ContextMenu::kHelpSectionText);
Section.AddSubMenu("Help", ContextMenu::kHelpSubMenuText, ContextMenu::kHelpSubMenuTooltip,
FNewToolMenuDelegate::CreateStatic(&FGameLiftPluginModule::GenerateHelpMenu),
FUIAction(FExecuteAction(), FCanExecuteAction(), FIsActionChecked()),
EUserInterfaceActionType::Button);
FNewToolMenuDelegate::CreateStatic(&FGameLiftPluginModule::GenerateHelpMenu),
FUIAction(FExecuteAction(), FCanExecuteAction(), FIsActionChecked()),
EUserInterfaceActionType::Button);
}
}

void FGameLiftPluginModule::GenerateHelpMenu(UToolMenu* InMenu)
{
{
FToolMenuSection& Section = InMenu->AddSection("GameLiftPlugin_HelpDocumentation", ContextMenu::kHelpDocumentationSectionText);
FToolMenuSection& Section = InMenu->AddSection("GameLiftPlugin_HelpDocumentation",
ContextMenu::kHelpDocumentationSectionText);
Section.AddMenuEntry(FGameLiftPluginCommands::Get().OpenGameLiftDocumentation);
Section.AddMenuEntry(FGameLiftPluginCommands::Get().OpenAwsGameTechForum);
Section.AddMenuEntry(FGameLiftPluginCommands::Get().ReportIssues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <string>
#include <unordered_map>


namespace Aws
{
namespace Regions
Expand Down Expand Up @@ -92,28 +93,32 @@ namespace Aws

switch (InRegion)
{
CASE_REGION(us_east_2);
CASE_REGION(us_east_1);
CASE_REGION(us_west_1);
CASE_REGION(us_west_2);
CASE_REGION(af_south_1);
CASE_REGION(ap_east_1);
CASE_REGION(ap_southeast_3);
CASE_REGION(ap_south_1);
CASE_REGION(ap_northeast_3);
CASE_REGION(ap_northeast_2);
CASE_REGION(ap_southeast_1);
CASE_REGION(ap_southeast_2);
CASE_REGION(ap_northeast_1);
CASE_REGION(ca_central_1);
CASE_REGION(eu_central_1);
CASE_REGION(eu_west_1);
CASE_REGION(eu_west_2);
CASE_REGION(eu_south_1);
CASE_REGION(eu_west_3);
CASE_REGION(eu_north_1);
CASE_REGION(me_south_1);
CASE_REGION(sa_east_1);
_Pragma("warning(disable:5103)")
//C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
CASE_REGION(us_east_2);
CASE_REGION(us_east_1);
CASE_REGION(us_west_1);
CASE_REGION(us_west_2);
CASE_REGION(af_south_1);
CASE_REGION(ap_east_1);
CASE_REGION(ap_southeast_3);
CASE_REGION(ap_south_1);
CASE_REGION(ap_northeast_3);
CASE_REGION(ap_northeast_2);
CASE_REGION(ap_southeast_1);
CASE_REGION(ap_southeast_2);
CASE_REGION(ap_northeast_1);
CASE_REGION(ca_central_1);
CASE_REGION(eu_central_1);
CASE_REGION(eu_west_1);
CASE_REGION(eu_west_2);
CASE_REGION(eu_south_1);
CASE_REGION(eu_west_3);
CASE_REGION(eu_north_1);
CASE_REGION(me_south_1);
CASE_REGION(sa_east_1);
_Pragma("warning(disable:5103)")
//C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
default:
break;
}
Expand All @@ -129,28 +134,32 @@ namespace Aws

switch (InRegion)
{
CASE_REGION(us_east_2);
CASE_REGION(us_east_1);
CASE_REGION(us_west_1);
CASE_REGION(us_west_2);
CASE_REGION(af_south_1);
CASE_REGION(ap_east_1);
CASE_REGION(ap_southeast_3);
CASE_REGION(ap_south_1);
CASE_REGION(ap_northeast_3);
CASE_REGION(ap_northeast_2);
CASE_REGION(ap_southeast_1);
CASE_REGION(ap_southeast_2);
CASE_REGION(ap_northeast_1);
CASE_REGION(ca_central_1);
CASE_REGION(eu_central_1);
CASE_REGION(eu_west_1);
CASE_REGION(eu_west_2);
CASE_REGION(eu_south_1);
CASE_REGION(eu_west_3);
CASE_REGION(eu_north_1);
CASE_REGION(me_south_1);
CASE_REGION(sa_east_1);
_Pragma("warning(disable:5103)")
//C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
CASE_REGION(us_east_2);
CASE_REGION(us_east_1);
CASE_REGION(us_west_1);
CASE_REGION(us_west_2);
CASE_REGION(af_south_1);
CASE_REGION(ap_east_1);
CASE_REGION(ap_southeast_3);
CASE_REGION(ap_south_1);
CASE_REGION(ap_northeast_3);
CASE_REGION(ap_northeast_2);
CASE_REGION(ap_southeast_1);
CASE_REGION(ap_southeast_2);
CASE_REGION(ap_northeast_1);
CASE_REGION(ca_central_1);
CASE_REGION(eu_central_1);
CASE_REGION(eu_west_1);
CASE_REGION(eu_west_2);
CASE_REGION(eu_south_1);
CASE_REGION(eu_west_3);
CASE_REGION(eu_north_1);
CASE_REGION(me_south_1);
CASE_REGION(sa_east_1);
_Pragma("warning(disable:5103)")
//C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
default:
break;
}
Expand All @@ -166,6 +175,8 @@ namespace Aws

static std::unordered_map<std::wstring, ERegions> RegionMap
{
_Pragma("warning(disable:5103)")
//C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
ADD_REGION(us_east_2),
ADD_REGION(us_east_1),
ADD_REGION(us_west_1),
Expand All @@ -188,11 +199,12 @@ namespace Aws
ADD_REGION(eu_north_1),
ADD_REGION(me_south_1),
ADD_REGION(sa_east_1)
_Pragma("warning(disable:5103)")
//C5103: Pasting <token1> and <token2> does not result in a valid preprocessing token
};
auto It = RegionMap.find(*InRegionString);
return It != RegionMap.end() ? It->second : ERegions::us_east_2;

#undef ADD_REGION
}

} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@ enum class EBootstrapMessageState : int

constexpr auto EBootstrapMessageStateFromInt(int State)
{
if (State < int(EBootstrapMessageState::NoBootstrappedMessage) || State > int(EBootstrapMessageState::ActiveMessage))
if (State < static_cast<int>(EBootstrapMessageState::NoBootstrappedMessage) || State > static_cast<int>(
EBootstrapMessageState::ActiveMessage))
{
return EBootstrapMessageState::NoBootstrappedMessage;
}
return EBootstrapMessageState(State);
return static_cast<EBootstrapMessageState>(State);
}

FText EBootstrapMessageStateToString(EBootstrapMessageState State)
inline FText EBootstrapMessageStateToString(EBootstrapMessageState State)
{
switch (State)
{
case EBootstrapMessageState::NoBootstrappedMessage: return Settings::AwsAccount::kNoBootstrapMessage;
case EBootstrapMessageState::InProgressMessage: return Settings::AwsAccount::kBootstrapInProgressMessage;
case EBootstrapMessageState::FailureMessage: return Settings::AwsAccount::kFailedBootstrapMessage;
case EBootstrapMessageState::ActiveMessage: return Settings::AwsAccount::kActiveBootstrapMessage;
default:
break;
case EBootstrapMessageState::NoBootstrappedMessage: return Settings::AwsAccount::kNoBootstrapMessage;
case EBootstrapMessageState::InProgressMessage: return Settings::AwsAccount::kBootstrapInProgressMessage;
case EBootstrapMessageState::FailureMessage: return Settings::AwsAccount::kFailedBootstrapMessage;
case EBootstrapMessageState::ActiveMessage: return Settings::AwsAccount::kActiveBootstrapMessage;
default:
break;
}
ensure(false);

Expand All @@ -44,15 +45,15 @@ inline EBootstrapMessageState EBootstrapMessageStateFromString(const FString& St
{
return EBootstrapMessageState::NoBootstrappedMessage;
}
else if (StateString.Compare(Settings::AwsAccount::kBootstrapInProgressMessage.ToString()) == 0)
if (StateString.Compare(Settings::AwsAccount::kBootstrapInProgressMessage.ToString()) == 0)
{
return EBootstrapMessageState::InProgressMessage;
}
else if (StateString.Compare(Settings::AwsAccount::kFailedBootstrapMessage.ToString()) == 0)
if (StateString.Compare(Settings::AwsAccount::kFailedBootstrapMessage.ToString()) == 0)
{
return EBootstrapMessageState::FailureMessage;
}
else if (StateString.Compare(Settings::AwsAccount::kActiveBootstrapMessage.ToString()) == 0)
if (StateString.Compare(Settings::AwsAccount::kActiveBootstrapMessage.ToString()) == 0)
{
return EBootstrapMessageState::ActiveMessage;
}
Expand Down

0 comments on commit 79fdd7c

Please sign in to comment.