SaveTool: improve readability.

This commit is contained in:
Guillaume Jacquemin 2021-07-10 16:46:45 +02:00
parent ed25f7f5fa
commit 476eb2b1e6

View file

@ -161,8 +161,10 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
ImGuiInputTextFlags_CallbackCharFilter,
callback, nullptr);
ImGui::SameLine();
if((!_unsafeMode && _mbManager->gameState() != GameState::NotRunning) ||
!(len >= 6 && len <= 32) || !(name_view[0] != ' ' && name_view[len - 1] != ' '))
GameState game_state = _mbManager->gameState();
if((!_unsafeMode && game_state != GameState::NotRunning) ||
!(len >= 6 && len <= 32) ||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f);
@ -173,8 +175,9 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
ImGui::CloseCurrentPopup();
}
if((!_unsafeMode && _mbManager->gameState() != GameState::NotRunning) ||
!(len >= 6 && len <= 32) || !(name_view[0] != ' ' && name_view[len - 1] != ' '))
if((!_unsafeMode && game_state != GameState::NotRunning) ||
!(len >= 6 && len <= 32) ||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();