Core/Misc: Reduce code differences between branches

This commit is contained in:
Shauren
2025-02-02 23:59:23 +01:00
parent 96940488c9
commit 69b647a24c
4 changed files with 12 additions and 14 deletions

View File

@@ -44,15 +44,15 @@ class TC_GAME_API PlayerTaxi
bool IsTaximaskNodeKnown(uint32 nodeidx) const
{
uint32 field = uint32((nodeidx - 1) / 8);
uint32 submask = 1 << ((nodeidx-1) % 8);
return (m_taximask[field] & submask) == submask;
uint32 field = uint32((nodeidx - 1) / (sizeof(TaxiMask::value_type) * 8));
TaxiMask::value_type submask = TaxiMask::value_type(1 << ((nodeidx - 1) % (sizeof(TaxiMask::value_type) * 8)));
return (m_taximask[field] & submask) != 0;
}
bool SetTaximaskNode(uint32 nodeidx)
{
uint32 field = uint32((nodeidx - 1) / 8);
uint32 submask = 1 << ((nodeidx- 1) % 8);
if ((m_taximask[field] & submask) != submask)
uint32 field = uint32((nodeidx - 1) / (sizeof(TaxiMask::value_type) * 8));
TaxiMask::value_type submask = TaxiMask::value_type(1 << ((nodeidx - 1) % (sizeof(TaxiMask::value_type) * 8)));
if ((m_taximask[field] & submask) == 0)
{
m_taximask[field] |= submask;
return true;

View File

@@ -6734,8 +6734,8 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, ui
if (!node || node->ContinentID != mapid || !isVisibleForFaction(node) || node->GetFlags().HasFlag(TaxiNodeFlags::IgnoreForFindNearest))
continue;
uint32 field = uint32((node->ID - 1) / 8);
uint32 submask = 1 << ((node->ID - 1) % 8);
uint32 field = uint32((node->ID - 1) / (sizeof(TaxiMask::value_type) * 8));
TaxiMask::value_type submask = TaxiMask::value_type(1 << ((node->ID - 1) % (sizeof(TaxiMask::value_type) * 8)));
// skip not taxi network nodes
if ((sTaxiNodesMask[field] & submask) == 0)

View File

@@ -561,13 +561,11 @@ void WorldSession::HandleBuyItemOpcode(WorldPackets::Item::BuyItem& packet)
{
case ITEM_VENDOR_TYPE_ITEM:
{
Item* bagItem = _player->GetItemByGuid(packet.ContainerGUID);
uint8 bag = NULL_BAG;
if (bagItem && bagItem->IsBag())
bag = bagItem->GetSlot();
else if (packet.ContainerGUID == GetPlayer()->GetGUID()) // The client sends the player guid when trying to store an item in the default backpack
if (packet.ContainerGUID == GetPlayer()->GetGUID()) // The client sends the player guid when trying to store an item in the default backpack
bag = INVENTORY_SLOT_BAG_0;
else if (Item* bagItem = _player->GetItemByGuid(packet.ContainerGUID))
bag = bagItem->GetSlot();
GetPlayer()->BuyItemFromVendorSlot(packet.VendorGUID, packet.Muid, packet.Item.ItemID,
packet.Quantity, bag, packet.Slot);

View File

@@ -465,7 +465,7 @@ bool SpellEffectInfo::IsAura() const
bool SpellEffectInfo::IsAura(AuraType aura) const
{
return IsAura() && ApplyAuraName == uint32(aura);
return IsAura() && ApplyAuraName == aura;
}
bool SpellEffectInfo::IsTargetingArea() const