Get rid of optional, not available on Debian9 build

This commit is contained in:
Dennis Felsing 2022-04-19 09:18:46 +02:00
parent b84a347817
commit 4e3d5c5626
2 changed files with 6 additions and 7 deletions

View file

@ -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))
{

View file

@ -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;
/**