From 1a83651cf107dcbb9dea4e492490026ee88aee92 Mon Sep 17 00:00:00 2001 From: def Date: Sun, 4 Oct 2020 22:46:28 +0200 Subject: [PATCH] Allow quitting instantly with SDL_QUIT when non-warning dialog showing --- src/engine/client.h | 1 + src/engine/client/client.cpp | 2 +- src/game/client/gameclient.cpp | 5 +++++ src/game/client/gameclient.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/engine/client.h b/src/engine/client.h index 0e99acabe..c31c5c174 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -253,6 +253,7 @@ public: virtual void OnDummyDisconnect() = 0; virtual void Echo(const char *pString) = 0; virtual bool CanDisplayWarning() = 0; + virtual bool IsDisplayingWarning() = 0; }; extern IGameClient *CreateGameClient(); diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index b30cc2d50..5f2b2254e 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3327,7 +3327,7 @@ void CClient::Run() s_SavedConfig = true; } - if(m_Warnings.empty() && GameClient()->CanDisplayWarning()) + if(m_Warnings.empty() && !GameClient()->IsDisplayingWarning()) break; } diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 5fea550fa..e21bce2ea 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -2705,3 +2705,8 @@ bool CGameClient::CanDisplayWarning() { return m_pMenus->CanDisplayWarning(); } + +bool CGameClient::IsDisplayingWarning() +{ + return m_pMenus->GetCurPopup() == CMenus::POPUP_WARNING; +} diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 4793a2f63..dd075b2fd 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -450,6 +450,7 @@ public: void Echo(const char *pString); bool IsOtherTeam(int ClientID); bool CanDisplayWarning(); + bool IsDisplayingWarning(); void LoadGameSkin(const char *pPath, bool AsDir = false); void LoadEmoticonsSkin(const char *pPath, bool AsDir = false);