mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Get rid of optional, not available on Debian9 build
This commit is contained in:
parent
b84a347817
commit
4e3d5c5626
|
@ -15,16 +15,16 @@ void CTooltips::OnReset()
|
|||
|
||||
void CTooltips::SetActiveTooltip(CTooltip &Tooltip)
|
||||
{
|
||||
if(m_ActiveTooltip.has_value())
|
||||
if(m_pActiveTooltip != nullptr)
|
||||
return;
|
||||
|
||||
m_ActiveTooltip.emplace(Tooltip);
|
||||
m_pActiveTooltip = &Tooltip;
|
||||
HoverTime = time_get();
|
||||
}
|
||||
|
||||
inline void CTooltips::ClearActiveTooltip()
|
||||
{
|
||||
m_ActiveTooltip.reset();
|
||||
m_pActiveTooltip = nullptr;
|
||||
}
|
||||
|
||||
void CTooltips::DoToolTip(const void *pID, const CUIRect *pNearRect, const char *pText, float WidthHint)
|
||||
|
@ -61,9 +61,9 @@ void CTooltips::DoToolTip(const void *pID, const CUIRect *pNearRect, const char
|
|||
|
||||
void CTooltips::OnRender()
|
||||
{
|
||||
if(m_ActiveTooltip.has_value())
|
||||
if(m_pActiveTooltip != nullptr)
|
||||
{
|
||||
CTooltip &Tooltip = m_ActiveTooltip.value();
|
||||
CTooltip &Tooltip = *m_pActiveTooltip;
|
||||
|
||||
if(!UI()->MouseInside(&Tooltip.m_Rect))
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <game/client/component.h>
|
||||
#include <game/client/ui.h>
|
||||
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
||||
struct CTooltip
|
||||
|
@ -23,7 +22,7 @@ struct CTooltip
|
|||
class CTooltips : public CComponent
|
||||
{
|
||||
std::unordered_map<uintptr_t, CTooltip> m_Tooltips;
|
||||
std::optional<std::reference_wrapper<CTooltip>> m_ActiveTooltip;
|
||||
CTooltip *m_pActiveTooltip;
|
||||
int64_t HoverTime;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue