From 4e3d5c562617913548ca6d3f61813200e292c962 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Tue, 19 Apr 2022 09:18:46 +0200 Subject: [PATCH] Get rid of optional, not available on Debian9 build --- src/game/client/components/tooltips.cpp | 10 +++++----- src/game/client/components/tooltips.h | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/game/client/components/tooltips.cpp b/src/game/client/components/tooltips.cpp index e8c199d8c..482696b70 100644 --- a/src/game/client/components/tooltips.cpp +++ b/src/game/client/components/tooltips.cpp @@ -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)) { diff --git a/src/game/client/components/tooltips.h b/src/game/client/components/tooltips.h index 021cd2565..efb54f2b2 100644 --- a/src/game/client/components/tooltips.h +++ b/src/game/client/components/tooltips.h @@ -5,7 +5,6 @@ #include #include -#include #include struct CTooltip @@ -23,7 +22,7 @@ struct CTooltip class CTooltips : public CComponent { std::unordered_map m_Tooltips; - std::optional> m_ActiveTooltip; + CTooltip *m_pActiveTooltip; int64_t HoverTime; /**