From 3c7ad1490b8a35af78b5578efc1d4ec9c8cf950a Mon Sep 17 00:00:00 2001 From: JSaurusRex Date: Sun, 8 Oct 2023 17:31:43 +0200 Subject: [PATCH] done requested code changes --- src/game/client/components/binds.cpp | 14 +++++++------- src/game/client/components/binds.h | 2 +- src/game/client/gameclient.cpp | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index 9136580d6..4faca9799 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -1,7 +1,7 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #include "binds.h" -#include +#include #include #include @@ -135,14 +135,14 @@ bool CBinds::OnInput(const IInput::CEvent &Event) Mask &= ~KeyModifierMask; bool ret = false; - char *key = 0; + const char *pKey = nullptr; if(m_aapKeyBindings[Mask][Event.m_Key]) { if(Event.m_Flags & IInput::FLAG_PRESS) { Console()->ExecuteLineStroked(1, m_aapKeyBindings[Mask][Event.m_Key]); - key = m_aapKeyBindings[Mask][Event.m_Key]; + pKey = m_aapKeyBindings[Mask][Event.m_Key]; } // Have to check for nullptr again because the previous execute can unbind itself if(Event.m_Flags & IInput::FLAG_RELEASE && m_aapKeyBindings[Mask][Event.m_Key]) @@ -156,7 +156,7 @@ bool CBinds::OnInput(const IInput::CEvent &Event) if(Event.m_Flags & IInput::FLAG_PRESS && Mask != ((1 << MODIFIER_CTRL) | (1 << MODIFIER_SHIFT)) && Mask != ((1 << MODIFIER_GUI) | (1 << MODIFIER_SHIFT))) { Console()->ExecuteLineStroked(1, m_aapKeyBindings[0][Event.m_Key]); - key = m_aapKeyBindings[Mask][Event.m_Key]; + pKey = m_aapKeyBindings[Mask][Event.m_Key]; } // Have to check for nullptr again because the previous execute can unbind itself if(Event.m_Flags & IInput::FLAG_RELEASE && m_aapKeyBindings[0][Event.m_Key]) @@ -164,11 +164,11 @@ bool CBinds::OnInput(const IInput::CEvent &Event) ret = true; } - if(g_Config.m_ClSubTickAiming && key) + if(g_Config.m_ClSubTickAiming && pKey) { - if(strcmp("+fire", key) == 0 || strcmp("+hook", key) == 0) + if(str_comp("+fire", pKey) == 0 || str_comp("+hook", pKey) == 0) { - mouseOnAction = true; + m_MouseOnAction = true; } } diff --git a/src/game/client/components/binds.h b/src/game/client/components/binds.h index 8ebf9a5fc..4fb835955 100644 --- a/src/game/client/components/binds.h +++ b/src/game/client/components/binds.h @@ -35,7 +35,7 @@ public: virtual bool OnInput(const IInput::CEvent &Event) override; }; - bool mouseOnAction; + bool m_MouseOnAction; enum { diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 25c45ba3b..861839f00 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -411,10 +411,10 @@ void CGameClient::OnUpdate() } } - if(g_Config.m_ClSubTickAiming && m_Binds.mouseOnAction) + if(g_Config.m_ClSubTickAiming && m_Binds.m_MouseOnAction) { - m_Controls.m_aMousePosOnAction[g_Config.m_ClDummy] = m_Controls.m_aMousePos[g_Config.m_ClDummy]; //idk what g_Config.m_ClDummy is - m_Binds.mouseOnAction = false; + m_Controls.m_aMousePosOnAction[g_Config.m_ClDummy] = m_Controls.m_aMousePos[g_Config.m_ClDummy]; + m_Binds.m_MouseOnAction = false; } }