mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Merge pull request #7405 from Robyt3/Client-Warning-Queue
Add gameclient warnings to queue instead of overriding others
This commit is contained in:
commit
9b75f85bb5
|
@ -279,7 +279,9 @@ public:
|
||||||
|
|
||||||
virtual void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) = 0;
|
virtual void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) = 0;
|
||||||
|
|
||||||
|
virtual void AddWarning(const SWarning &Warning) = 0;
|
||||||
virtual SWarning *GetCurWarning() = 0;
|
virtual SWarning *GetCurWarning() = 0;
|
||||||
|
|
||||||
virtual CChecksumData *ChecksumData() = 0;
|
virtual CChecksumData *ChecksumData() = 0;
|
||||||
virtual bool InfoTaskRunning() = 0;
|
virtual bool InfoTaskRunning() = 0;
|
||||||
virtual int UdpConnectivity(int NetType) = 0;
|
virtual int UdpConnectivity(int NetType) = 0;
|
||||||
|
|
|
@ -4662,6 +4662,11 @@ void CClient::GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float Mix
|
||||||
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / 50) / (float)(time_freq() / 50);
|
*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()
|
SWarning *CClient::GetCurWarning()
|
||||||
{
|
{
|
||||||
if(m_vWarnings.empty())
|
if(m_vWarnings.empty())
|
||||||
|
|
|
@ -493,7 +493,9 @@ public:
|
||||||
|
|
||||||
void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override;
|
void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override;
|
||||||
|
|
||||||
|
void AddWarning(const SWarning &Warning) override;
|
||||||
SWarning *GetCurWarning() override;
|
SWarning *GetCurWarning() override;
|
||||||
|
|
||||||
CChecksumData *ChecksumData() override { return &m_Checksum.m_Data; }
|
CChecksumData *ChecksumData() override { return &m_Checksum.m_Data; }
|
||||||
bool InfoTaskRunning() override { return m_pDDNetInfoTask != nullptr; }
|
bool InfoTaskRunning() override { return m_pDDNetInfoTask != nullptr; }
|
||||||
int UdpConnectivity(int NetType) override;
|
int UdpConnectivity(int NetType) override;
|
||||||
|
|
|
@ -15,10 +15,6 @@
|
||||||
#include <game/localization.h>
|
#include <game/localization.h>
|
||||||
#include <game/mapitems.h>
|
#include <game/mapitems.h>
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
|
||||||
|
|
||||||
const char *const gs_apModEntitiesNames[] = {
|
const char *const gs_apModEntitiesNames[] = {
|
||||||
"ddnet",
|
"ddnet",
|
||||||
"ddrace",
|
"ddrace",
|
||||||
|
@ -146,7 +142,7 @@ void CMapImages::OnMapLoadImpl(class CLayers *pLayers, IMap *pMap)
|
||||||
}
|
}
|
||||||
if(ShowWarning)
|
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.")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,6 @@
|
||||||
#include <game/localization.h>
|
#include <game/localization.h>
|
||||||
#include <game/mapitems.h>
|
#include <game/mapitems.h>
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
|
||||||
|
|
||||||
CMapSounds::CMapSounds()
|
CMapSounds::CMapSounds()
|
||||||
{
|
{
|
||||||
m_Count = 0;
|
m_Count = 0;
|
||||||
|
@ -63,7 +59,7 @@ void CMapSounds::OnMapLoad()
|
||||||
}
|
}
|
||||||
if(ShowWarning)
|
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
|
// enqueue sound sources
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
|
|
||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
|
||||||
|
|
||||||
void CMenus::RenderStartMenu(CUIRect MainView)
|
void CMenus::RenderStartMenu(CUIRect MainView)
|
||||||
{
|
{
|
||||||
// render logo
|
// render logo
|
||||||
|
@ -84,7 +80,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
||||||
}
|
}
|
||||||
else
|
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;
|
s_JoinTutorialTime = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +156,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
||||||
}
|
}
|
||||||
else
|
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")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue