Skip to content

Commit e384afd

Browse files
committed
make arguments optional
reset cursor via setCursorColor()
1 parent b29f780 commit e384afd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Client/mods/deathmatch/logic/luadefs/CLuaClientDefs.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ bool CLuaClientDefs::IsCapsLockEnabled()
8383
return ((::GetKeyState(VK_CAPITAL) & 0x0001) != 0);
8484
}
8585

86-
bool CLuaClientDefs::SetCursorColor(float r, float g, float b, float alpha) noexcept
86+
bool CLuaClientDefs::SetCursorColor(std::optional<float> r, std::optional<float> g, std::optional<float> b, std::optional<float> alpha) noexcept
8787
{
88-
if (!g_pCore->IsMenuVisible())
89-
g_pCore->GetGUI()->SetCursorColor(r, g, b, alpha);
88+
if (!g_pCore->IsMenuVisible())
89+
g_pCore->GetGUI()->SetCursorColor(r.value_or(255.0f), g.value_or(255.0f), b.value_or(255.0f), alpha.value_or(1.0f));
9090
else
91-
g_pCore->GetGUI()->ResetCursorColor(r, g, b, alpha); // Force values to be updated
91+
g_pCore->GetGUI()->ResetCursorColor(r.value_or(255.0f), g.value_or(255.0f), b.value_or(255.0f), alpha.value_or(1.0f)); // Force variables to be updated when close the main menu it will set the new color
9292

9393
return true;
9494
}

Client/mods/deathmatch/logic/luadefs/CLuaClientDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CLuaClientDefs : public CLuaDefs
1818
public:
1919
static void LoadFunctions();
2020

21-
static bool SetCursorColor(float r, float g, float b, float alpha) noexcept;
21+
static bool SetCursorColor(std::optional<float> r, std::optional<float> g, std::optional<float> b, std::optional<float> alpha) noexcept;
2222
static CLuaMultiReturn<float, float, float, float> GetCursorColor() noexcept;
2323

2424
private:

0 commit comments

Comments
 (0)