Merge pull request #7405 from Robyt3/Client-Warning-Queue

Add gameclient warnings to queue instead of overriding others
This commit is contained in:
Dennis Felsing 2023-11-01 22:01:22 +00:00 committed by GitHub
commit 9b75f85bb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 16 deletions

View file

@ -279,7 +279,9 @@ public:
virtual void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) = 0;
virtual void AddWarning(const SWarning &Warning) = 0;
virtual SWarning *GetCurWarning() = 0;
virtual CChecksumData *ChecksumData() = 0;
virtual bool InfoTaskRunning() = 0;
virtual int UdpConnectivity(int NetType) = 0;

View file

@ -4662,6 +4662,11 @@ void CClient::GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float Mix
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / 50) / (float)(time_freq() / 50);
}
void CClient::AddWarning(const SWarning &Warning)
{
m_vWarnings.emplace_back(Warning);
}
SWarning *CClient::GetCurWarning()
{
if(m_vWarnings.empty())

View file

@ -493,7 +493,9 @@ public:
void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override;
void AddWarning(const SWarning &Warning) override;
SWarning *GetCurWarning() override;
CChecksumData *ChecksumData() override { return &m_Checksum.m_Data; }
bool InfoTaskRunning() override { return m_pDDNetInfoTask != nullptr; }
int UdpConnectivity(int NetType) override;

View file

@ -15,10 +15,6 @@
#include <game/localization.h>
#include <game/mapitems.h>
#include <chrono>
using namespace std::chrono_literals;
const char *const gs_apModEntitiesNames[] = {
"ddnet",
"ddrace",
@ -146,7 +142,7 @@ void CMapImages::OnMapLoadImpl(class CLayers *pLayers, IMap *pMap)
}
if(ShowWarning)
{
m_pClient->m_Menus.PopupWarning(Localize("Warning"), Localize("Some map images could not be loaded. Check the local console for details."), Localize("Ok"), 10s);
Client()->AddWarning(SWarning(Localize("Some map images could not be loaded. Check the local console for details.")));
}
}

View file

@ -12,10 +12,6 @@
#include <game/localization.h>
#include <game/mapitems.h>
#include <chrono>
using namespace std::chrono_literals;
CMapSounds::CMapSounds()
{
m_Count = 0;
@ -63,7 +59,7 @@ void CMapSounds::OnMapLoad()
}
if(ShowWarning)
{
m_pClient->m_Menus.PopupWarning(Localize("Warning"), Localize("Some map sounds could not be loaded. Check the local console for details."), Localize("Ok"), 10s);
Client()->AddWarning(SWarning(Localize("Some map sounds could not be loaded. Check the local console for details.")));
}
// enqueue sound sources

View file

@ -17,10 +17,6 @@
#include "menus.h"
#include <chrono>
using namespace std::chrono_literals;
void CMenus::RenderStartMenu(CUIRect MainView)
{
// render logo
@ -84,7 +80,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
}
else
{
PopupWarning(Localize("Warning"), Localize("Can't find a Tutorial server"), Localize("Ok"), 10s);
Client()->AddWarning(SWarning(Localize("Can't find a Tutorial server")));
s_JoinTutorialTime = 0.0f;
}
}
@ -160,7 +156,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
}
else
{
PopupWarning(Localize("Warning"), Localize("Server executable not found, can't run server"), Localize("Ok"), 10s);
Client()->AddWarning(SWarning(Localize("Server executable not found, can't run server")));
}
}
}