mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-10 23:03:52 +00:00
refactor: replace magic bag slot offset 19 with FIRST_BAG_EQUIP_SLOT
- Add Inventory::FIRST_BAG_EQUIP_SLOT = 19 constant with why-comment explaining WoW equip slot layout (bags occupy slots 19-22) - Replace all 19 occurrences of magic number 19 in bag slot calculations across inventory_handler, spell_handler, inventory, and game_handler - Add UNIT_FIELD_FLAGS / UNIT_FLAG_PVP comment in combat_handler - Add why-comment on network packet budget constants (prevent server data bursts from starving the render loop)
This commit is contained in:
parent
4574d203b5
commit
28e5cd9281
7 changed files with 25 additions and 18 deletions
|
|
@ -486,7 +486,7 @@ void SpellHandler::useItemInBag(int bagIndex, int slotIndex) {
|
|||
if (slot.empty()) return;
|
||||
|
||||
uint64_t itemGuid = 0;
|
||||
uint64_t bagGuid = owner_.equipSlotGuids_[19 + bagIndex];
|
||||
uint64_t bagGuid = owner_.equipSlotGuids_[Inventory::FIRST_BAG_EQUIP_SLOT + bagIndex];
|
||||
if (bagGuid != 0) {
|
||||
auto it = owner_.containerContents_.find(bagGuid);
|
||||
if (it != owner_.containerContents_.end() && slotIndex < static_cast<int>(it->second.numSlots)) {
|
||||
|
|
@ -502,7 +502,7 @@ void SpellHandler::useItemInBag(int bagIndex, int slotIndex) {
|
|||
|
||||
if (itemGuid != 0 && owner_.state == WorldState::IN_WORLD && owner_.socket) {
|
||||
uint32_t useSpellId = findOnUseSpellId(slot.item.itemId);
|
||||
uint8_t wowBag = static_cast<uint8_t>(19 + bagIndex);
|
||||
uint8_t wowBag = static_cast<uint8_t>(Inventory::FIRST_BAG_EQUIP_SLOT + bagIndex);
|
||||
auto packet = owner_.packetParsers_
|
||||
? owner_.packetParsers_->buildUseItem(wowBag, static_cast<uint8_t>(slotIndex), itemGuid, useSpellId)
|
||||
: UseItemPacket::build(wowBag, static_cast<uint8_t>(slotIndex), itemGuid, useSpellId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue