mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Consolidate all Spell.dbc record offsets into Offsets.h
Extend the single-source-of-truth cleanup to the whole Spell.dbc record layout. 40 local constexpr offset copies across 16 files (spell/, totem/, lossofcontrol/, macro/, aura/) redefined field offsets that belong in Offsets.h: name (0x1E0), icon (0x1D4), effect (0xF4), rank (0x204), effect implicit targets (0x148/0x154), powerType (0x7C), manaCost (0x80), rangeIndex (0x90), castingTimeIndex (0x48), maxLevel (0x6C), spellLevel (0x74), manaCostPercent (0x270). Add the ones Offsets.h lacked as OFF_SPELL_RECORD_* and repoint every local use to the Offsets:: constant, deleting the duplicates. Purely mechanical and behavior-preserving -- every local value already matched the canonical (verified before repointing). SpellIcon.dbc / SpellRange.dbc sub-record offsets (0x04/0x08) stay local; they are different structs.
This commit is contained in:
+4
-6
@@ -30,11 +30,9 @@ namespace Aura::Data {
|
||||
|
||||
namespace {
|
||||
|
||||
// Spell.dbc record field offsets used locally. `spell/Info.cpp` has
|
||||
// the same set of locals for `Script_GetSpellInfo`; promoting them
|
||||
// to `Offsets.h` is a future refactor — for now we mirror its
|
||||
// convention so both files stay in sync.
|
||||
constexpr int OFF_SPELL_ICON_ID = 0x1D4;
|
||||
// SpellIcon.dbc record's path field (char* at +0x04). This is a
|
||||
// SpellIcon.dbc offset, not a Spell.dbc record field — the Spell.dbc
|
||||
// offsets are all in `Offsets.h` as OFF_SPELL_RECORD_*.
|
||||
constexpr int OFF_SPELLICON_PATH = 0x04;
|
||||
|
||||
const uint8_t *Descriptor(const uint8_t *unit) {
|
||||
@@ -74,7 +72,7 @@ const char *SpellIconPath(const uint8_t *spellRecord) {
|
||||
if (spellRecord == nullptr)
|
||||
return nullptr;
|
||||
const int iconID = *reinterpret_cast<const int *>(
|
||||
spellRecord + OFF_SPELL_ICON_ID);
|
||||
spellRecord + Offsets::OFF_SPELL_RECORD_ICON_ID);
|
||||
if (iconID <= 0)
|
||||
return nullptr;
|
||||
return DBC::StringField(Offsets::VAR_SPELL_ICON_RECORDS,
|
||||
|
||||
Reference in New Issue
Block a user