From bc6cb46faff9d6ef7dccbb29bbb6a284155e2c1a Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 9 Jan 2022 01:10:38 +0100 Subject: [PATCH] refactor: TabTeleport moved personal vehicle global to util header --- BigBaseV2/src/gui/window/main/tab_teleport.cpp | 6 +++--- BigBaseV2/src/util/globals.hpp | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 BigBaseV2/src/util/globals.hpp diff --git a/BigBaseV2/src/gui/window/main/tab_teleport.cpp b/BigBaseV2/src/gui/window/main/tab_teleport.cpp index e4d9aec9..55ca95cd 100644 --- a/BigBaseV2/src/gui/window/main/tab_teleport.cpp +++ b/BigBaseV2/src/gui/window/main/tab_teleport.cpp @@ -1,6 +1,6 @@ #include "main_tabs.hpp" #include "fiber_pool.hpp" -#include "script_global.hpp" +#include "util/globals.hpp" #include "util/teleport.hpp" #include "util/vehicle.hpp" @@ -47,7 +47,7 @@ namespace big { QUEUE_JOB_BEGIN_CLAUSE() { - Vehicle veh = *script_global(2810287).at(298).as(); + Vehicle veh = globals::get_personal_vehicle(); if (ENTITY::IS_ENTITY_DEAD(veh, false)) return notify::above_map("Invalid vehicle handle..."); Vector3 location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true); @@ -58,7 +58,7 @@ namespace big if (ImGui::Button("Teleport to Personal Vehicle")) { - Vehicle veh = *script_global(2810287).at(298).as(); + Vehicle veh = globals::get_personal_vehicle(); if (ENTITY::IS_ENTITY_DEAD(veh, false)) return notify::above_map("Invalid vehicle handle..."); teleport::to_coords( diff --git a/BigBaseV2/src/util/globals.hpp b/BigBaseV2/src/util/globals.hpp new file mode 100644 index 00000000..5c39a8c9 --- /dev/null +++ b/BigBaseV2/src/util/globals.hpp @@ -0,0 +1,10 @@ +#pragma once +#include "script_global.hpp" + +namespace big::globals +{ + inline Vehicle get_personal_vehicle() + { + return *script_global(2810287).at(298).as(); + } +} \ No newline at end of file