From e89b547a5ac37eb83e504266f23cec3838d5a419 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Mon, 26 Feb 2024 23:34:02 +0000 Subject: [PATCH] ChaosMod/Failsafe: Remove redundant global idx setter / getter --- ChaosMod/Components/Failsafe.cpp | 16 +++------------- ChaosMod/Components/Failsafe.h | 3 --- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/ChaosMod/Components/Failsafe.cpp b/ChaosMod/Components/Failsafe.cpp index e66ac299a..1ab39db30 100644 --- a/ChaosMod/Components/Failsafe.cpp +++ b/ChaosMod/Components/Failsafe.cpp @@ -27,7 +27,7 @@ Failsafe::Failsafe() : Component() Hooks::OnScriptThreadRun, [](rage::scrThread *thread) { - if (!ms_SearchedForMissionStateGlobal && !Failsafe::GetGlobalIndex() && !strcmp(thread->GetName(), "main")) + if (!ms_SearchedForMissionStateGlobal && !ms_StateGlobalIdx && !strcmp(thread->GetName(), "main")) { auto program = Memory::ScriptThreadToProgram(thread); if (program->m_CodeBlocks) @@ -50,9 +50,9 @@ Failsafe::Failsafe() : Component() } else { - Failsafe::SetGlobalIndex(handle.At(8).Value() & 0xFFFFFF); + ms_StateGlobalIdx = handle.At(8).Value() & 0xFFFFFF; - LOG("Fail state global found (Global: " << Failsafe::GetGlobalIndex() << ")"); + LOG("Fail state global found (Global: " << ms_StateGlobalIdx << ")"); } } } @@ -61,16 +61,6 @@ Failsafe::Failsafe() : Component() }); } -void Failsafe::SetGlobalIndex(int idx) -{ - ms_StateGlobalIdx = idx; -} - -int Failsafe::GetGlobalIndex() -{ - return ms_StateGlobalIdx; -} - void Failsafe::OnRun() { if (!m_Enabled || !ms_StateGlobalIdx || !ComponentExists()) diff --git a/ChaosMod/Components/Failsafe.h b/ChaosMod/Components/Failsafe.h index faa5fc437..710809e4d 100644 --- a/ChaosMod/Components/Failsafe.h +++ b/ChaosMod/Components/Failsafe.h @@ -19,9 +19,6 @@ class Failsafe : public Component Failsafe(); public: - static void SetGlobalIndex(int idx); - static int GetGlobalIndex(); - virtual void OnRun() override; template