diff --git a/src/loot/Scan.cpp b/src/loot/Scan.cpp index 8232eee1..a44b35c2 100644 --- a/src/loot/Scan.cpp +++ b/src/loot/Scan.cpp @@ -471,7 +471,7 @@ void BuildQueue(void *player, size_t maxCount, bool skipKnownEmpty) { bool BeginWalk(bool lootMode, size_t maxCount) { if (s_scan.state != State::Idle) return false; - if (*reinterpret_cast(Offsets::VAR_LOCAL_PLAYER_PTR) == nullptr) + if (!Object::RegistryReady()) return false; void *player = Game::ResolveUnitToken("player"); if (player == nullptr || Request::IsMounted(player)) diff --git a/src/loot/Unit.cpp b/src/loot/Unit.cpp index 38cf37b8..0097ff46 100644 --- a/src/loot/Unit.cpp +++ b/src/loot/Unit.cpp @@ -57,7 +57,7 @@ int __fastcall Script_LootUnit(void *L) { // Object manager NULL pre-login; bail silently rather than // crashing inside the resolver. - if (*reinterpret_cast(Offsets::VAR_LOCAL_PLAYER_PTR) == nullptr) + if (!Object::RegistryReady()) return 0; void *target = Object::ByGuid(Offsets::TYPEMASK_UNIT, guid, nullptr, 0); diff --git a/src/loot/UnitItem.cpp b/src/loot/UnitItem.cpp index fdc7c219..4cd30506 100644 --- a/src/loot/UnitItem.cpp +++ b/src/loot/UnitItem.cpp @@ -156,7 +156,7 @@ int __fastcall Script_LootUnitItem(void *L) { Game::Lua::PushBool(L, false); return 1; } - if (*reinterpret_cast(Offsets::VAR_LOCAL_PLAYER_PTR) == nullptr) { + if (!Object::RegistryReady()) { Game::Lua::PushBool(L, false); return 1; } diff --git a/src/target/Nearest.cpp b/src/target/Nearest.cpp index 1597c916..57634016 100644 --- a/src/target/Nearest.cpp +++ b/src/target/Nearest.cpp @@ -230,7 +230,7 @@ void DirectionProc(DirectionData *data, uint64_t guid) { void TargetDirection(float facing, float angle, int mode) { if (g_directional != 0) return; - if (Game::Read(Offsets::VAR_LOCAL_PLAYER_PTR) == nullptr) + if (!Object::RegistryReady()) return; void *unit = const_cast(Unit::Identity::PlayerObject()); if (unit == nullptr) diff --git a/src/text/InlineTexturePool.cpp b/src/text/InlineTexturePool.cpp index 39a5578d..d4154d27 100644 --- a/src/text/InlineTexturePool.cpp +++ b/src/text/InlineTexturePool.cpp @@ -25,6 +25,7 @@ #include "frame/RegionDestruction.h" #include "text/PtrProbe.h" #include "tick/FrameTick.h" +#include "object/Resolve.h" #include // SEH (__try/__except, EXCEPTION_EXECUTE_HANDLER) @@ -125,8 +126,7 @@ uint32_t FsColorKey(const void *fs) { uint32_t FadedColor(const Placement &p, uint32_t fsColor) { const uint32_t a = ((p.color >> 24) * (fsColor >> 24)) / 0xFFu; uint32_t rgb = p.color & 0x00FFFFFFu; - const bool inGlue = - *reinterpret_cast(Offsets::VAR_LOCAL_PLAYER_PTR) == nullptr; + const bool inGlue = !Object::RegistryReady(); if (inGlue) { const uint32_t b = fsColor & 0xFFu, g = (fsColor >> 8) & 0xFFu, r = (fsColor >> 16) & 0xFFu; diff --git a/src/totem/Tracker.cpp b/src/totem/Tracker.cpp index 1b32e6d2..eb3d9807 100644 --- a/src/totem/Tracker.cpp +++ b/src/totem/Tracker.cpp @@ -249,7 +249,7 @@ void OnTick() { // Out of the world: empty every slot without an event, as 3.3.5's // EnterWorld does. The object-manager reads below deref the manager // unconditionally, so nothing else runs either. - if (Game::Read(Offsets::VAR_LOCAL_PLAYER_PTR) == nullptr) { + if (!Object::RegistryReady()) { for (Slot &t : g_slots) t = Slot{}; g_dirtyMask = 0;