chore(Core/Misc): nullptr cleanup (#11467)
This commit is contained in:
@@ -28,7 +28,7 @@ namespace MMAP
|
|||||||
|
|
||||||
MMapMgr* MMapFactory::createOrGetMMapMgr()
|
MMapMgr* MMapFactory::createOrGetMMapMgr()
|
||||||
{
|
{
|
||||||
if (g_MMapMgr == nullptr)
|
if (!g_MMapMgr)
|
||||||
{
|
{
|
||||||
g_MMapMgr = new MMapMgr();
|
g_MMapMgr = new MMapMgr();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ bool IsIPAddress(char const* ipaddress)
|
|||||||
uint32 CreatePIDFile(std::string const& filename)
|
uint32 CreatePIDFile(std::string const& filename)
|
||||||
{
|
{
|
||||||
FILE* pid_file = fopen(filename.c_str(), "w");
|
FILE* pid_file = fopen(filename.c_str(), "w");
|
||||||
if (pid_file == nullptr)
|
if (!pid_file)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ namespace FactorySelector
|
|||||||
}
|
}
|
||||||
|
|
||||||
// select NullCreatureAI if not another cases
|
// select NullCreatureAI if not another cases
|
||||||
ainame = (ai_factory == nullptr) ? "NullCreatureAI" : ai_factory->key();
|
ainame = (!ai_factory) ? "NullCreatureAI" : ai_factory->key();
|
||||||
LOG_DEBUG("scripts.ai", "Creature {} used AI is {}.", creature->GetGUID().ToString(), ainame);
|
LOG_DEBUG("scripts.ai", "Creature {} used AI is {}.", creature->GetGUID().ToString(), ainame);
|
||||||
return (ai_factory == nullptr ? new NullCreatureAI(creature) : ai_factory->Create(creature));
|
return (!ai_factory ? new NullCreatureAI(creature) : ai_factory->Create(creature));
|
||||||
}
|
}
|
||||||
|
|
||||||
MovementGenerator* selectMovementGenerator(Creature* creature)
|
MovementGenerator* selectMovementGenerator(Creature* creature)
|
||||||
@@ -123,7 +123,7 @@ namespace FactorySelector
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
return (mv_factory == nullptr ? nullptr : mv_factory->Create(creature));
|
return (!mv_factory ? nullptr : mv_factory->Create(creature));
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObjectAI* SelectGameObjectAI(GameObject* go)
|
GameObjectAI* SelectGameObjectAI(GameObject* go)
|
||||||
@@ -138,9 +138,9 @@ namespace FactorySelector
|
|||||||
|
|
||||||
//future goAI types go here
|
//future goAI types go here
|
||||||
|
|
||||||
std::string ainame = (ai_factory == nullptr || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
|
std::string ainame = (!ai_factory || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
|
||||||
LOG_DEBUG("scripts.ai", "GameObject {} used AI is {}.", go->GetGUID().ToString(), ainame);
|
LOG_DEBUG("scripts.ai", "GameObject {} used AI is {}.", go->GetGUID().ToString(), ainame);
|
||||||
|
|
||||||
return (ai_factory == nullptr ? new NullGameObjectAI(go) : ai_factory->Create(go));
|
return (!ai_factory ? new NullGameObjectAI(go) : ai_factory->Create(go));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1797,7 +1797,7 @@ class ObjectGuidList
|
|||||||
public:
|
public:
|
||||||
ObjectGuidList(ObjectList* objectList, WorldObject* baseObject)
|
ObjectGuidList(ObjectList* objectList, WorldObject* baseObject)
|
||||||
{
|
{
|
||||||
ASSERT(objectList != nullptr);
|
ASSERT(objectList);
|
||||||
m_objectList = objectList;
|
m_objectList = objectList;
|
||||||
m_baseObject = baseObject;
|
m_baseObject = baseObject;
|
||||||
m_guidList = new GuidList();
|
m_guidList = new GuidList();
|
||||||
|
|||||||
@@ -728,7 +728,7 @@ void Item::AddToUpdateQueueOf(Player* player)
|
|||||||
if (IsInUpdateQueue())
|
if (IsInUpdateQueue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT(player != nullptr);
|
ASSERT(player);
|
||||||
|
|
||||||
if (player->GetGUID() != GetOwnerGUID())
|
if (player->GetGUID() != GetOwnerGUID())
|
||||||
{
|
{
|
||||||
@@ -748,7 +748,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
|
|||||||
if (!IsInUpdateQueue())
|
if (!IsInUpdateQueue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT(player != nullptr);
|
ASSERT(player);
|
||||||
|
|
||||||
if (player->GetGUID() != GetOwnerGUID())
|
if (player->GetGUID() != GetOwnerGUID())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2266,7 +2266,7 @@ bool Player::IsGroupVisibleFor(Player const* p) const
|
|||||||
|
|
||||||
bool Player::IsInSameGroupWith(Player const* p) const
|
bool Player::IsInSameGroupWith(Player const* p) const
|
||||||
{
|
{
|
||||||
return p == this || (GetGroup() != nullptr &&
|
return p == this || (GetGroup() &&
|
||||||
GetGroup() == p->GetGroup() &&
|
GetGroup() == p->GetGroup() &&
|
||||||
GetGroup()->SameSubGroup(this, p));
|
GetGroup()->SameSubGroup(this, p));
|
||||||
}
|
}
|
||||||
@@ -3739,7 +3739,7 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
|||||||
{
|
{
|
||||||
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||||
{
|
{
|
||||||
if (m_items[i] == nullptr)
|
if (!m_items[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
|
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
|
||||||
@@ -3747,14 +3747,14 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
|||||||
|
|
||||||
for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
|
for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
|
||||||
{
|
{
|
||||||
if (m_items[i] == nullptr)
|
if (!m_items[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
|
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
|
||||||
}
|
}
|
||||||
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
|
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
|
||||||
{
|
{
|
||||||
if (m_items[i] == nullptr)
|
if (!m_items[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
|
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
|
||||||
@@ -3770,7 +3770,7 @@ void Player::DestroyForPlayer(Player* target, bool onDeath) const
|
|||||||
|
|
||||||
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) // xinef: previously INVENTORY_SLOT_BAG_END
|
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) // xinef: previously INVENTORY_SLOT_BAG_END
|
||||||
{
|
{
|
||||||
if (m_items[i] == nullptr)
|
if (!m_items[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_items[i]->DestroyForPlayer(target);
|
m_items[i]->DestroyForPlayer(target);
|
||||||
@@ -3780,14 +3780,14 @@ void Player::DestroyForPlayer(Player* target, bool onDeath) const
|
|||||||
{
|
{
|
||||||
for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
|
for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
|
||||||
{
|
{
|
||||||
if (m_items[i] == nullptr)
|
if (!m_items[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_items[i]->DestroyForPlayer(target);
|
m_items[i]->DestroyForPlayer(target);
|
||||||
}
|
}
|
||||||
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
|
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
|
||||||
{
|
{
|
||||||
if (m_items[i] == nullptr)
|
if (!m_items[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_items[i]->DestroyForPlayer(target);
|
m_items[i]->DestroyForPlayer(target);
|
||||||
@@ -4976,7 +4976,7 @@ float Player::GetMeleeCritFromAgility()
|
|||||||
|
|
||||||
GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1);
|
GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1);
|
||||||
GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||||
if (critBase == nullptr || critRatio == nullptr)
|
if (!critBase || !critRatio)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
float crit = critBase->base + GetStat(STAT_AGILITY) * critRatio->ratio;
|
float crit = critBase->base + GetStat(STAT_AGILITY) * critRatio->ratio;
|
||||||
@@ -5024,7 +5024,7 @@ void Player::GetDodgeFromAgility(float& diminishing, float& nondiminishing)
|
|||||||
|
|
||||||
// Dodge per agility is proportional to crit per agility, which is available from DBC files
|
// Dodge per agility is proportional to crit per agility, which is available from DBC files
|
||||||
GtChanceToMeleeCritEntry const* dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
GtChanceToMeleeCritEntry const* dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||||
if (dodgeRatio == nullptr || pclass > MAX_CLASSES)
|
if (!dodgeRatio || pclass > MAX_CLASSES)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: research if talents/effects that increase total agility by x% should increase non-diminishing part
|
// TODO: research if talents/effects that increase total agility by x% should increase non-diminishing part
|
||||||
@@ -5046,7 +5046,7 @@ float Player::GetSpellCritFromIntellect()
|
|||||||
|
|
||||||
GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass - 1);
|
GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass - 1);
|
||||||
GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||||
if (critBase == nullptr || critRatio == nullptr)
|
if (!critBase || !critRatio)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
float crit = critBase->base + GetStat(STAT_INTELLECT) * critRatio->ratio;
|
float crit = critBase->base + GetStat(STAT_INTELLECT) * critRatio->ratio;
|
||||||
@@ -5098,7 +5098,7 @@ float Player::OCTRegenHPPerSpirit()
|
|||||||
|
|
||||||
GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||||
GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||||
if (baseRatio == nullptr || moreRatio == nullptr)
|
if (!baseRatio || !moreRatio)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
// Formula from PaperDollFrame script
|
// Formula from PaperDollFrame script
|
||||||
@@ -5121,7 +5121,7 @@ float Player::OCTRegenMPPerSpirit()
|
|||||||
|
|
||||||
// GtOCTRegenMPEntry const* baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
|
// GtOCTRegenMPEntry const* baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
|
||||||
GtRegenMPPerSptEntry const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
GtRegenMPPerSptEntry const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||||
if (moreRatio == nullptr)
|
if (!moreRatio)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
// Formula get from PaperDollFrame script
|
// Formula get from PaperDollFrame script
|
||||||
@@ -6043,7 +6043,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uVictim != nullptr)
|
if (uVictim)
|
||||||
{
|
{
|
||||||
if (groupsize > 1)
|
if (groupsize > 1)
|
||||||
honor_f /= groupsize;
|
honor_f /= groupsize;
|
||||||
@@ -9779,7 +9779,7 @@ void Player::DropModCharge(SpellModifier* mod, Spell* spell)
|
|||||||
|
|
||||||
void Player::SetSpellModTakingSpell(Spell* spell, bool apply)
|
void Player::SetSpellModTakingSpell(Spell* spell, bool apply)
|
||||||
{
|
{
|
||||||
if (apply && m_spellModTakingSpell != nullptr)
|
if (apply && m_spellModTakingSpell)
|
||||||
{
|
{
|
||||||
LOG_INFO("misc", "Player::SetSpellModTakingSpell (A1) - {}, {}", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id);
|
LOG_INFO("misc", "Player::SetSpellModTakingSpell (A1) - {}, {}", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id);
|
||||||
return;
|
return;
|
||||||
@@ -11216,7 +11216,7 @@ void Player::SetSelection(ObjectGuid guid)
|
|||||||
|
|
||||||
void Player::SetGroup(Group* group, int8 subgroup)
|
void Player::SetGroup(Group* group, int8 subgroup)
|
||||||
{
|
{
|
||||||
if (group == nullptr)
|
if (!group)
|
||||||
m_group.unlink();
|
m_group.unlink();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -12750,7 +12750,7 @@ void Player::RemoveFromBattlegroundOrBattlefieldRaid()
|
|||||||
|
|
||||||
void Player::SetOriginalGroup(Group* group, int8 subgroup)
|
void Player::SetOriginalGroup(Group* group, int8 subgroup)
|
||||||
{
|
{
|
||||||
if (group == nullptr)
|
if (!group)
|
||||||
m_originalGroup.unlink();
|
m_originalGroup.unlink();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -13164,7 +13164,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
|
|||||||
// Xinef: exploit protection, dont allow to loot normal items if player is not master loot and not below loot threshold
|
// Xinef: exploit protection, dont allow to loot normal items if player is not master loot and not below loot threshold
|
||||||
// Xinef: only quest, ffa and conditioned items
|
// Xinef: only quest, ffa and conditioned items
|
||||||
if (!item->is_underthreshold && loot->roundRobinPlayer && !GetLootGUID().IsItem() && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid())
|
if (!item->is_underthreshold && loot->roundRobinPlayer && !GetLootGUID().IsItem() && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid())
|
||||||
if (qitem == nullptr && ffaitem == nullptr && conditem == nullptr)
|
if (!qitem && !ffaitem && !conditem)
|
||||||
{
|
{
|
||||||
SendLootRelease(GetLootGUID());
|
SendLootRelease(GetLootGUID());
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7331,7 +7331,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
|
|||||||
if (item->GetState() != ITEM_REMOVED)
|
if (item->GetState() != ITEM_REMOVED)
|
||||||
{
|
{
|
||||||
Item* test = GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
Item* test = GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
||||||
if (test == nullptr)
|
if (!test)
|
||||||
{
|
{
|
||||||
ObjectGuid::LowType bagTestGUID = 0;
|
ObjectGuid::LowType bagTestGUID = 0;
|
||||||
if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot()))
|
if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot()))
|
||||||
|
|||||||
@@ -8943,7 +8943,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
|||||||
|
|
||||||
// All ok. Check current trigger spell
|
// All ok. Check current trigger spell
|
||||||
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
|
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
|
||||||
if (triggerEntry == nullptr)
|
if (!triggerEntry)
|
||||||
{
|
{
|
||||||
// Don't cast unknown spell
|
// Don't cast unknown spell
|
||||||
LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} (effIndex: {}) has unknown TriggerSpell {}. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex(), trigger_spell_id);
|
LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} (effIndex: {}) has unknown TriggerSpell {}. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex(), trigger_spell_id);
|
||||||
@@ -9386,7 +9386,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try detect target manually if not set
|
// try detect target manually if not set
|
||||||
if (target == nullptr)
|
if (!target)
|
||||||
target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim;
|
target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim;
|
||||||
|
|
||||||
if (cooldown)
|
if (cooldown)
|
||||||
@@ -15761,7 +15761,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If not trigger by default and spellProcEvent == nullptr - skip
|
// If not trigger by default and spellProcEvent == nullptr - skip
|
||||||
if (!isTriggerAura[aurEff->GetAuraType()] && triggerData.spellProcEvent == nullptr)
|
if (!isTriggerAura[aurEff->GetAuraType()] && !triggerData.spellProcEvent)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (aurEff->GetAuraType())
|
switch (aurEff->GetAuraType())
|
||||||
|
|||||||
@@ -3429,7 +3429,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
|||||||
|
|
||||||
PetLevelInfo*& pInfoMapEntry = _petInfoStore[creature_id];
|
PetLevelInfo*& pInfoMapEntry = _petInfoStore[creature_id];
|
||||||
|
|
||||||
if (pInfoMapEntry == nullptr)
|
if (!pInfoMapEntry)
|
||||||
pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
|
||||||
|
|
||||||
// data for level 1 stored in [0] array element, ...
|
// data for level 1 stored in [0] array element, ...
|
||||||
@@ -8497,7 +8497,7 @@ GameTele const* ObjectMgr::GetGameTele(std::string_view name) const
|
|||||||
{
|
{
|
||||||
if (itr->second.wnameLow == wname)
|
if (itr->second.wnameLow == wname)
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
else if (alt == nullptr && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
else if (!alt && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
||||||
alt = &itr->second;
|
alt = &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
|||||||
|
|
||||||
Unit* mover = _player->m_mover;
|
Unit* mover = _player->m_mover;
|
||||||
|
|
||||||
ASSERT(mover != nullptr); // there must always be a mover
|
ASSERT(mover); // there must always be a mover
|
||||||
|
|
||||||
Player* plrMover = mover->ToPlayer();
|
Player* plrMover = mover->ToPlayer();
|
||||||
|
|
||||||
|
|||||||
@@ -140,8 +140,8 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
|||||||
{
|
{
|
||||||
ItemPosCountVec traderDst;
|
ItemPosCountVec traderDst;
|
||||||
ItemPosCountVec playerDst;
|
ItemPosCountVec playerDst;
|
||||||
bool traderCanTrade = (myItems[i] == nullptr || trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, myItems[i], false) == EQUIP_ERR_OK);
|
bool traderCanTrade = (!myItems[i] || trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, myItems[i], false) == EQUIP_ERR_OK);
|
||||||
bool playerCanTrade = (hisItems[i] == nullptr || _player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, hisItems[i], false) == EQUIP_ERR_OK);
|
bool playerCanTrade = (!hisItems[i] || _player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, hisItems[i], false) == EQUIP_ERR_OK);
|
||||||
if (traderCanTrade && playerCanTrade)
|
if (traderCanTrade && playerCanTrade)
|
||||||
{
|
{
|
||||||
// Ok, if trade item exists and can be stored
|
// Ok, if trade item exists and can be stored
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
|
|||||||
|
|
||||||
LOG_DEBUG("maps", "Switch object {} from grid[{}, {}] {}", obj->GetGUID().ToString(), cell.GridX(), cell.GridY(), on);
|
LOG_DEBUG("maps", "Switch object {} from grid[{}, {}] {}", obj->GetGUID().ToString(), cell.GridX(), cell.GridY(), on);
|
||||||
NGridType* ngrid = getNGrid(cell.GridX(), cell.GridY());
|
NGridType* ngrid = getNGrid(cell.GridX(), cell.GridY());
|
||||||
ASSERT(ngrid != nullptr);
|
ASSERT(ngrid);
|
||||||
|
|
||||||
GridType& grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
GridType& grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on)
|
|||||||
|
|
||||||
//LOG_DEBUG(LOG_FILTER_MAPS, "Switch object {} from grid[{}, {}] {}", obj->GetGUID().ToString(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
|
//LOG_DEBUG(LOG_FILTER_MAPS, "Switch object {} from grid[{}, {}] {}", obj->GetGUID().ToString(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
|
||||||
NGridType* ngrid = getNGrid(cell.GridX(), cell.GridY());
|
NGridType* ngrid = getNGrid(cell.GridX(), cell.GridY());
|
||||||
ASSERT(ngrid != nullptr);
|
ASSERT(ngrid);
|
||||||
|
|
||||||
GridType& grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
GridType& grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ bool Map::EnsureGridLoaded(const Cell& cell)
|
|||||||
EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
|
EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
|
||||||
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
||||||
|
|
||||||
ASSERT(grid != nullptr);
|
ASSERT(grid);
|
||||||
if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
||||||
{
|
{
|
||||||
//if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
//if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
||||||
|
|||||||
@@ -71,12 +71,12 @@ Map* MapMgr::CreateBaseMap(uint32 id)
|
|||||||
{
|
{
|
||||||
Map* map = FindBaseMap(id);
|
Map* map = FindBaseMap(id);
|
||||||
|
|
||||||
if (map == nullptr)
|
if (!map)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(Lock);
|
std::lock_guard<std::mutex> guard(Lock);
|
||||||
|
|
||||||
map = FindBaseMap(id);
|
map = FindBaseMap(id);
|
||||||
if (map == nullptr) // pussywizard: check again after acquiring mutex
|
if (!map) // pussywizard: check again after acquiring mutex
|
||||||
{
|
{
|
||||||
MapEntry const* entry = sMapStore.LookupEntry(id);
|
MapEntry const* entry = sMapStore.LookupEntry(id);
|
||||||
ASSERT(entry);
|
ASSERT(entry);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void TransportMgr::LoadTransportTemplates()
|
|||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint32 entry = fields[0].Get<uint32>();
|
uint32 entry = fields[0].Get<uint32>();
|
||||||
GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
||||||
if (goInfo == nullptr)
|
if (!goInfo)
|
||||||
{
|
{
|
||||||
LOG_ERROR("entities.transport", "Transport {} has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry);
|
LOG_ERROR("entities.transport", "Transport {} has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ GraveyardStruct const* Graveyard::GetGraveyard(const std::string& name) const
|
|||||||
{
|
{
|
||||||
if (itr->second.wnameLow == wname)
|
if (itr->second.wnameLow == wname)
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
else if (alt == nullptr && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
else if (!alt && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
||||||
alt = &itr->second;
|
alt = &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void MotionMaster::InitDefault()
|
|||||||
if (_owner->GetTypeId() == TYPEID_UNIT && _owner->IsAlive())
|
if (_owner->GetTypeId() == TYPEID_UNIT && _owner->IsAlive())
|
||||||
{
|
{
|
||||||
MovementGenerator* movement = FactorySelector::selectMovementGenerator(_owner->ToCreature());
|
MovementGenerator* movement = FactorySelector::selectMovementGenerator(_owner->ToCreature());
|
||||||
Mutate(movement == nullptr ? &si_idleMovement : movement, MOTION_SLOT_IDLE);
|
Mutate(!movement ? &si_idleMovement : movement, MOTION_SLOT_IDLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ WorldSession::~WorldSession()
|
|||||||
|
|
||||||
std::string const& WorldSession::GetPlayerName() const
|
std::string const& WorldSession::GetPlayerName() const
|
||||||
{
|
{
|
||||||
return _player != nullptr ? _player->GetName() : DefaultPlayerName;
|
return _player ? _player->GetName() : DefaultPlayerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WorldSession::GetPlayerInfo() const
|
std::string WorldSession::GetPlayerInfo() const
|
||||||
|
|||||||
@@ -5932,7 +5932,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
|
|||||||
uint32 auraId = auraSpellInfo->Id;
|
uint32 auraId = auraSpellInfo->Id;
|
||||||
|
|
||||||
// specific code for cases with no trigger spell provided in field
|
// specific code for cases with no trigger spell provided in field
|
||||||
if (triggeredSpellInfo == nullptr)
|
if (!triggeredSpellInfo)
|
||||||
{
|
{
|
||||||
switch (auraSpellInfo->SpellFamilyName)
|
switch (auraSpellInfo->SpellFamilyName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateQueue[qp] == nullptr)
|
if (!updateQueue[qp])
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().GetCounter(), qp);
|
handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().GetCounter(), qp);
|
||||||
error = true;
|
error = true;
|
||||||
@@ -688,7 +688,7 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateQueue[qp] == nullptr)
|
if (!updateQueue[qp])
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp);
|
handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp);
|
||||||
error = true;
|
error = true;
|
||||||
@@ -737,7 +737,7 @@ public:
|
|||||||
|
|
||||||
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
||||||
|
|
||||||
if (test == nullptr)
|
if (!test)
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(Acore::StringFormatFmt("queue({}): The bag({}) and slot({}) values for {} are incorrect, the player doesn't have any item at that position!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString()));
|
handler->SendSysMessage(Acore::StringFormatFmt("queue({}): The bag({}) and slot({}) values for {} are incorrect, the player doesn't have any item at that position!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString()));
|
||||||
error = true;
|
error = true;
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ public:
|
|||||||
{
|
{
|
||||||
for (uint8 i = 0; i < 3; i++)
|
for (uint8 i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
if (Guardians[room][i] == nullptr)
|
if (!Guardians[room][i])
|
||||||
{
|
{
|
||||||
Guardians[room][i] = cr;
|
Guardians[room][i] = cr;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -560,37 +560,32 @@ public:
|
|||||||
switch (CreatureID)
|
switch (CreatureID)
|
||||||
{
|
{
|
||||||
case ADYEN_THE_LIGHTBRINGER:
|
case ADYEN_THE_LIGHTBRINGER:
|
||||||
adyen = nullptr;
|
|
||||||
adyen = me->FindNearestCreature(ADYEN_THE_LIGHTBRINGER, 100.0f, true);
|
adyen = me->FindNearestCreature(ADYEN_THE_LIGHTBRINGER, 100.0f, true);
|
||||||
if (adyen != nullptr)
|
if (adyen)
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case EXARCH_ORELIS:
|
case EXARCH_ORELIS:
|
||||||
orelis = nullptr;
|
|
||||||
orelis = me->FindNearestCreature(EXARCH_ORELIS, 100.0f, true);
|
orelis = me->FindNearestCreature(EXARCH_ORELIS, 100.0f, true);
|
||||||
if (orelis != nullptr)
|
if (orelis)
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case ANCHORITE_KARJA:
|
case ANCHORITE_KARJA:
|
||||||
karja = nullptr;
|
|
||||||
karja = me->FindNearestCreature(ANCHORITE_KARJA, 100.0f, true);
|
karja = me->FindNearestCreature(ANCHORITE_KARJA, 100.0f, true);
|
||||||
if (karja != nullptr)
|
if (karja)
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case KAYLAAN_THE_LOST:
|
case KAYLAAN_THE_LOST:
|
||||||
kaylaan = nullptr;
|
|
||||||
kaylaan = me->FindNearestCreature(KAYLAAN_THE_LOST, 100.0f, true);
|
kaylaan = me->FindNearestCreature(KAYLAAN_THE_LOST, 100.0f, true);
|
||||||
if (kaylaan != nullptr)
|
if (kaylaan)
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case ISHANAH_HIGH_PRIESTESS:
|
case ISHANAH_HIGH_PRIESTESS:
|
||||||
ishanah = nullptr;
|
|
||||||
ishanah = me->FindNearestCreature(ISHANAH_HIGH_PRIESTESS, 100.0f, true);
|
ishanah = me->FindNearestCreature(ISHANAH_HIGH_PRIESTESS, 100.0f, true);
|
||||||
if (ishanah == nullptr)
|
if (!ishanah)
|
||||||
{
|
{
|
||||||
// Ishanah may be dead; in this case we also need a reference to the creature for the respawn
|
// Ishanah may be dead; in this case we also need a reference to the creature for the respawn
|
||||||
ishanah = me->FindNearestCreature(ISHANAH_HIGH_PRIESTESS, 100.0f, false);
|
ishanah = me->FindNearestCreature(ISHANAH_HIGH_PRIESTESS, 100.0f, false);
|
||||||
if (ishanah != nullptr)
|
if (ishanah)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -604,10 +599,6 @@ public:
|
|||||||
{
|
{
|
||||||
me->SetReactState(REACT_PASSIVE);
|
me->SetReactState(REACT_PASSIVE);
|
||||||
me->SetFaction(FACTION_DEMON);
|
me->SetFaction(FACTION_DEMON);
|
||||||
adyen = nullptr;
|
|
||||||
orelis = nullptr;
|
|
||||||
karja = nullptr;
|
|
||||||
ishanah = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAction(int32 param) override
|
void DoAction(int32 param) override
|
||||||
@@ -1185,7 +1176,7 @@ public:
|
|||||||
for (GuidList::iterator itr = summons.begin(); itr != summons.end(); ++itr, i += 1.0f)
|
for (GuidList::iterator itr = summons.begin(); itr != summons.end(); ++itr, i += 1.0f)
|
||||||
if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr))
|
if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr))
|
||||||
{
|
{
|
||||||
if (who == nullptr)
|
if (!who)
|
||||||
{
|
{
|
||||||
cr->GetMotionMaster()->Clear(false);
|
cr->GetMotionMaster()->Clear(false);
|
||||||
cr->GetMotionMaster()->MoveFollow(me, 2.0f, M_PI / 2.0f + (i / summons.size() * M_PI));
|
cr->GetMotionMaster()->MoveFollow(me, 2.0f, M_PI / 2.0f + (i / summons.size() * M_PI));
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ void ClearOnlineAccounts()
|
|||||||
|
|
||||||
void ShutdownCLIThread(std::thread* cliThread)
|
void ShutdownCLIThread(std::thread* cliThread)
|
||||||
{
|
{
|
||||||
if (cliThread != nullptr)
|
if (cliThread)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// First try to cancel any I/O in the CLI thread
|
// First try to cancel any I/O in the CLI thread
|
||||||
@@ -760,7 +760,7 @@ void AuctionListingRunnable()
|
|||||||
|
|
||||||
void ShutdownAuctionListingThread(std::thread* thread)
|
void ShutdownAuctionListingThread(std::thread* thread)
|
||||||
{
|
{
|
||||||
if (thread != nullptr)
|
if (thread)
|
||||||
{
|
{
|
||||||
thread->join();
|
thread->join();
|
||||||
delete thread;
|
delete thread;
|
||||||
|
|||||||
@@ -905,7 +905,7 @@ namespace MMAP
|
|||||||
void TerrainBuilder::loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, const char* offMeshFilePath)
|
void TerrainBuilder::loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, const char* offMeshFilePath)
|
||||||
{
|
{
|
||||||
// no meshfile input given?
|
// no meshfile input given?
|
||||||
if (offMeshFilePath == nullptr)
|
if (!offMeshFilePath)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FILE* fp = fopen(offMeshFilePath, "rb");
|
FILE* fp = fopen(offMeshFilePath, "rb");
|
||||||
|
|||||||
Reference in New Issue
Block a user