[11490] Alow implicit cast ObjectGuid->uint64 and only explicit uint64->ObjectGuid

Now safe allow this casts in like way after completed convertion to ObjectGuid use.
Also simplify code in result allowed auto cast to uint64.

Please _not_ add new uint64 storages (local and in structures) for guid values.
This commit is contained in:
VladimirMangos 2011-05-15 22:01:16 +04:00
parent ecdb435b1e
commit 249fb836ca
47 changed files with 194 additions and 210 deletions

View file

@ -502,7 +502,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char cons
{
uint8 strCount = !str1 ? 0 : (!str2 ? 1 : (!str3 ? 2 : 3));
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1 + 1 + 1*strCount + (guid.IsEmpty() ? 0 : 8));
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1 + 1 + 1*strCount + (!guid ? 0 : 8));
data << uint8(event);
data << uint8(strCount);
@ -520,8 +520,8 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char cons
else if (str1)
data << str1;
if (!guid.IsEmpty())
data << guid;
if (guid)
data << ObjectGuid(guid);
BroadcastPacket(&data);

View file

@ -307,7 +307,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
{
ObjectGuid itemGuid = guids[i];
if (itemGuid.IsEmpty())
if (!itemGuid)
continue;
uint32 stackSize = stackSizes[i];

View file

@ -1592,7 +1592,7 @@ void BattleGround::SpawnBGCreature(ObjectGuid guid, uint32 respawntime)
bool BattleGround::DelObject(uint32 type)
{
if (m_BgObjects[type].IsEmpty())
if (!m_BgObjects[type])
return true;
GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);

View file

@ -112,7 +112,7 @@ void Channel::Join(ObjectGuid p, const char *pass)
JoinNotify(p);
// if no owner first logged will become
if(!IsConstant() && m_ownerGuid.IsEmpty())
if(!IsConstant() && !m_ownerGuid)
{
SetOwner(p, (m_players.size() > 1 ? true : false));
m_players[p].SetModerator(true);
@ -632,7 +632,7 @@ void Channel::Invite(ObjectGuid p, const char *newname)
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
{
if (!m_ownerGuid.IsEmpty())
if (m_ownerGuid)
{
// [] will re-add player after it possible removed
PlayerList::iterator p_itr = m_players.find(m_ownerGuid);
@ -641,7 +641,8 @@ void Channel::SetOwner(ObjectGuid guid, bool exclaim)
}
m_ownerGuid = guid;
if (!m_ownerGuid.IsEmpty())
if (m_ownerGuid)
{
uint8 oldFlag = GetPlayerFlags(m_ownerGuid);
m_players[m_ownerGuid].SetOwner(true);
@ -662,7 +663,7 @@ void Channel::SendToAll(WorldPacket *data, ObjectGuid p)
{
for(PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
if (Player *plr = sObjectMgr.GetPlayer(i->first))
if (p.IsEmpty() || !plr->GetSocial()->HasIgnore(p))
if (!p || !plr->GetSocial()->HasIgnore(p))
plr->GetSession()->SendPacket(data);
}
@ -775,7 +776,7 @@ void Channel::MakeChannelOwner(WorldPacket *data)
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
*data << ((IsConstant() || m_ownerGuid.IsEmpty()) ? "Nobody" : name);
*data << ((IsConstant() || !m_ownerGuid) ? "Nobody" : name);
}
// done 0x0C

View file

@ -286,7 +286,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
return;
}
if (!sObjectMgr.GetPlayerGuidByName(name).IsEmpty())
if (sObjectMgr.GetPlayerGuidByName(name))
{
data << (uint8)CHAR_CREATE_NAME_IN_USE;
SendPacket( &data );
@ -1183,7 +1183,7 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
// character with this name already exist
ObjectGuid newguid = sObjectMgr.GetPlayerGuidByName(newname);
if (!newguid.IsEmpty() && newguid != guid)
if (newguid && newguid != guid)
{
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
data << uint8(CHAR_CREATE_NAME_IN_USE);
@ -1244,7 +1244,7 @@ void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket &recv_data)
Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if(!item && !itemGuid.IsEmpty()) // cheating check 1
if(!item && itemGuid) // cheating check 1
return;
if(item && item->GetObjectGuid() != itemGuid) // cheating check 2

View file

@ -837,7 +837,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
if (target)
target_session = target->GetSession();
else if (!guid.IsEmpty())
else if (guid)
target_account = sObjectMgr.GetPlayerAccountIdByGUID(guid);
if(!target_session && !target_account)
@ -2039,7 +2039,7 @@ void ChatHandler::FillMessageData( WorldPacket *data, WorldSession* session, uin
*data << speaker->GetName();
ObjectGuid listener_guid;
*data << listener_guid;
if (!listener_guid.IsEmpty() && !listener_guid.IsPlayer())
if (listener_guid && !listener_guid.IsPlayer())
{
*data << uint32(1); // string listener_name_length
*data << uint8(0); // string listener_name
@ -2080,7 +2080,7 @@ Player * ChatHandler::getSelectedPlayer()
ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid();
if (guid.IsEmpty())
if (!guid)
return m_session->GetPlayer();
return sObjectMgr.GetPlayer(guid);
@ -2093,7 +2093,7 @@ Unit* ChatHandler::getSelectedUnit()
ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid();
if (guid.IsEmpty())
if (!guid)
return m_session->GetPlayer();
// can be selected player at another map
@ -2989,8 +2989,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x,
return true;
}
ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(name);
if (!guid.IsEmpty())
if (ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(name))
{
// to point where player stay (if loaded)
float o;
@ -3222,7 +3221,7 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, O
*player_guid = pl ? pl->GetObjectGuid() : guid;
if(player_name)
*player_name = pl || !guid.IsEmpty() ? name : "";
*player_name = pl || guid ? name : "";
}
else
{
@ -3239,7 +3238,7 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, O
}
// some from req. data must be provided (note: name is empty if player not exist)
if((!player || !*player) && (!player_guid || player_guid->IsEmpty()) && (!player_name || player_name->empty()))
if((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);

View file

@ -655,7 +655,7 @@ void Creature::RegenerateMana()
uint32 addvalue = 0;
// Combat and any controlled creature
if (isInCombat() || !GetCharmerOrOwnerGuid().IsEmpty())
if (isInCombat() || GetCharmerOrOwnerGuid())
{
if(!IsUnderLastManaUseEffect())
{
@ -685,7 +685,7 @@ void Creature::RegenerateHealth()
uint32 addvalue = 0;
// Not only pet, but any controlled creature
if (!GetCharmerOrOwnerGuid().IsEmpty())
if (GetCharmerOrOwnerGuid())
{
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
float Spirit = GetStat(STAT_SPIRIT);
@ -969,7 +969,7 @@ void Creature::PrepareBodyLootState()
*/
Player* Creature::GetOriginalLootRecipient() const
{
return !m_lootRecipientGuid.IsEmpty() ? ObjectAccessor::FindPlayer(m_lootRecipientGuid) : NULL;
return m_lootRecipientGuid ? ObjectAccessor::FindPlayer(m_lootRecipientGuid) : NULL;
}
/**
@ -1835,7 +1835,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
return false;
// only free creature
if (!GetCharmerOrOwnerGuid().IsEmpty())
if (GetCharmerOrOwnerGuid())
return false;
// only from same creature faction

View file

@ -611,7 +611,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
uint32 GetLootGroupRecipientId() const { return m_lootGroupRecipientId; }
Player* GetLootRecipient() const; // use group cases as prefered
Group* GetGroupLootRecipient() const;
bool HasLootRecipient() const { return m_lootGroupRecipientId || !m_lootRecipientGuid.IsEmpty(); }
bool HasLootRecipient() const { return m_lootGroupRecipientId || m_lootRecipientGuid; }
bool IsGroupLootRecipient() const { return m_lootGroupRecipientId; }
void SetLootRecipient(Unit* unit);
void AllLootRemovedFromCorpse();

View file

@ -63,7 +63,7 @@ void GMTicketMgr::LoadGMTickets()
GMTicket& ticket = m_GMTicketMap[guid];
if (!ticket.GetPlayerGuid().IsEmpty()) // already exist
if (ticket.GetPlayerGuid()) // already exist
{
CharacterDatabase.PExecute("DELETE FROM character_ticket WHERE ticket_id = '%u'", fields[4].GetUInt32());
continue;

View file

@ -159,7 +159,7 @@ class GMTicketMgr
void Create(ObjectGuid guid, const char* text)
{
GMTicket& ticket = m_GMTicketMap[guid];
if (!ticket.GetPlayerGuid().IsEmpty()) // overwrite ticket
if (ticket.GetPlayerGuid()) // overwrite ticket
{
ticket.DeleteFromDB();
m_GMTicketListByCreatingOrder.remove(&ticket);

View file

@ -79,8 +79,7 @@ void GameObject::RemoveFromWorld()
if(IsInWorld())
{
// Remove GO from owner
ObjectGuid owner_guid = GetOwnerGuid();
if (!owner_guid.IsEmpty())
if (ObjectGuid owner_guid = GetOwnerGuid())
{
if (Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid))
owner->RemoveGameObject(this,false);
@ -391,7 +390,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/)
//any return here in case battleground traps
}
if (!GetOwnerGuid().IsEmpty())
if (GetOwnerGuid())
{
if (Unit* owner = GetOwner())
owner->RemoveGameObject(this, false);
@ -449,7 +448,7 @@ void GameObject::AddUniqueUse(Player* player)
{
AddUse();
if (m_firstUser.IsEmpty())
if (!m_firstUser)
m_firstUser = player->GetObjectGuid();
m_UniqueUsers.insert(player->GetObjectGuid());
@ -833,7 +832,7 @@ void GameObject::SummonLinkedTrapIfAny()
linkedGO->SetRespawnTime(GetRespawnDelay());
linkedGO->SetSpellId(GetSpellId());
if (!GetOwnerGuid().IsEmpty())
if (GetOwnerGuid())
{
linkedGO->SetOwnerGuid(GetOwnerGuid());
linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, GetUInt32Value(GAMEOBJECT_LEVEL));
@ -1309,7 +1308,7 @@ void GameObject::Use(Unit* user)
}
else
{
if (!m_firstUser.IsEmpty() && player->GetObjectGuid() != m_firstUser && info->summoningRitual.castersGrouped)
if (m_firstUser && player->GetObjectGuid() != m_firstUser && info->summoningRitual.castersGrouped)
{
if (Group* group = player->GetGroup())
{
@ -1338,7 +1337,7 @@ void GameObject::Use(Unit* user)
return;
// owner is first user for non-wild GO objects, if it offline value already set to current user
if (GetOwnerGuid().IsEmpty())
if (!GetOwnerGuid())
if (Player* firstUser = GetMap()->GetPlayer(m_firstUser))
spellCaster = firstUser;

View file

@ -943,7 +943,7 @@ void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
return;
// clean other icons
if (!targetGuid.IsEmpty())
if (targetGuid)
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
if (m_targetIcons[i] == targetGuid)
SetTargetIcon(i, ObjectGuid(), ObjectGuid());
@ -1009,7 +1009,7 @@ void Group::SendTargetIconList(WorldSession *session)
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
{
if (m_targetIcons[i].IsEmpty())
if (!m_targetIcons[i])
continue;
data << uint8(i);
@ -1094,7 +1094,7 @@ void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pl = itr->getSource();
if (!pl || (!ignore.IsEmpty() && pl->GetObjectGuid() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
if (!pl || (ignore && pl->GetObjectGuid() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
continue;
if (pl->GetSession() && (group == -1 || itr->getSubGroup() == group))
@ -1156,7 +1156,7 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint
if(IsFull())
return false;
if (guid.IsEmpty())
if (!guid)
return false;
Player *player = sObjectMgr.GetPlayer(guid);
@ -1369,7 +1369,7 @@ bool Group::_setMainTank(ObjectGuid guid)
if (m_mainTankGuid == guid)
return false;
if (!guid.IsEmpty())
if (guid)
{
member_citerator slot = _getMemberCSlot(guid);
if (slot == m_memberSlots.end())
@ -1392,7 +1392,7 @@ bool Group::_setMainAssistant(ObjectGuid guid)
if (m_mainAssistantGuid == guid)
return false;
if (!guid.IsEmpty())
if (guid)
{
member_witerator slot = _getMemberWSlot(guid);
if (slot == m_memberSlots.end())

View file

@ -305,8 +305,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
if (!grp)
return;
ObjectGuid guid = grp->GetMemberGuid(membername);
if (!guid.IsEmpty())
if (ObjectGuid guid = grp->GetMemberGuid(membername))
{
Player::RemoveFromGroup(grp, guid);
return;
@ -546,8 +545,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
group->ChangeMembersGroup(player, groupNr);
else
{
ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(name.c_str());
if (!guid.IsEmpty())
if (ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(name.c_str()))
group->ChangeMembersGroup(guid, groupNr);
}
}

View file

@ -2335,7 +2335,7 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
{
uint8 strCount = !str1 ? 0 : (!str2 ? 1 : (!str3 ? 2 : 3));
WorldPacket data(SMSG_GUILD_EVENT, 1 + 1 + 1*strCount + (guid.IsEmpty() ? 0 : 8));
WorldPacket data(SMSG_GUILD_EVENT, 1 + 1 + 1*strCount + (!guid ? 0 : 8));
data << uint8(event);
data << uint8(strCount);
@ -2353,8 +2353,8 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
else if (str1)
data << str1;
if (!guid.IsEmpty())
data << guid;
if (guid)
data << ObjectGuid(guid);
BroadcastPacket(&data);

View file

@ -169,7 +169,7 @@ void HostileRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
Unit* HostileRefManager::GetThreatRedirectionTarget() const
{
return !m_redirectionTargetGuid.IsEmpty() ? iOwner->GetMap()->GetUnit(m_redirectionTargetGuid) : NULL;
return m_redirectionTargetGuid ? iOwner->GetMap()->GetUnit(m_redirectionTargetGuid) : NULL;
}

View file

@ -471,7 +471,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
}
// set correct owner
if (!ownerGuid.IsEmpty() && GetOwnerGuid() != ownerGuid)
if (ownerGuid && GetOwnerGuid() != ownerGuid)
{
SetOwnerGuid(ownerGuid);
need_save = true;

View file

@ -497,7 +497,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
recv_data >> itemGuid;
recv_data >> count;
if (itemGuid.IsEmpty())
if (!itemGuid)
return;
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
@ -1158,7 +1158,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
return;
}
if (!item->GetGuidValue(ITEM_FIELD_GIFTCREATOR).IsEmpty())// HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED);
if (item->GetGuidValue(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED);
{
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return;
@ -1236,7 +1236,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
for(int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
ObjectGuid gemGuid = gemGuids[i];
if (gemGuid.IsEmpty())
if (!gemGuid)
continue;
if (!gemGuid.IsItem())
@ -1260,7 +1260,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
Item *Gems[MAX_GEM_SOCKETS];
for(int i = 0; i < MAX_GEM_SOCKETS; ++i)
Gems[i] = !gemGuids[i].IsEmpty() ? _player->GetItemByGuid(gemGuids[i]) : NULL;
Gems[i] = gemGuids[i] ? _player->GetItemByGuid(gemGuids[i]) : NULL;
GemPropertiesEntry const *GemProps[MAX_GEM_SOCKETS];
for(int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage
@ -1410,7 +1410,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
if (GemEnchants[i])
{
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i), GemEnchants[i], 0, 0);
if(Item* guidItem = !gemGuids[i].IsEmpty() ? _player->GetItemByGuid(gemGuids[i]) : NULL)
if (Item* guidItem = gemGuids[i] ? _player->GetItemByGuid(gemGuids[i]) : NULL)
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true );
}
}

View file

@ -102,7 +102,7 @@ bool ChatHandler::HandleNpcWhisperCommand(char* args)
return false;
ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid();
if (guid.IsEmpty())
if (!guid)
return false;
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(guid);
@ -252,8 +252,7 @@ bool ChatHandler::HandleGPSCommand(char* args)
WorldObject *obj = NULL;
if (*args)
{
ObjectGuid guid = ExtractGuidFromLink(&args);
if (!guid.IsEmpty())
if (ObjectGuid guid = ExtractGuidFromLink(&args))
obj = (WorldObject*)m_session->GetPlayer()->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT);
if(!obj)

View file

@ -909,8 +909,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(char* args)
return false;
}
ObjectGuid ownerGuid = obj->GetOwnerGuid();
if (!ownerGuid.IsEmpty())
if (ObjectGuid ownerGuid = obj->GetOwnerGuid())
{
Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(), ownerGuid);
if (!owner || !ownerGuid.IsPlayer())
@ -1213,7 +1212,7 @@ bool ChatHandler::HandleGUIDCommand(char* /*args*/)
{
ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid();
if (guid.IsEmpty())
if (!guid)
{
SendSysMessage(LANG_NO_SELECTION);
SetSentErrorMessage(true);
@ -2207,7 +2206,7 @@ bool ChatHandler::HandleNpcTameCommand(char* /*args*/)
Player *player = m_session->GetPlayer ();
if (!player->GetPetGuid().IsEmpty())
if (player->GetPetGuid())
{
SendSysMessage(LANG_YOU_ALREADY_HAVE_PET);
SetSentErrorMessage(true);

View file

@ -3671,8 +3671,7 @@ bool ChatHandler::HandleGetDistanceCommand(char* args)
if (*args)
{
ObjectGuid guid = ExtractGuidFromLink(&args);
if (!guid.IsEmpty())
if (ObjectGuid guid = ExtractGuidFromLink(&args))
obj = (WorldObject*)m_session->GetPlayer()->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT);
if(!obj)
@ -3710,20 +3709,20 @@ bool ChatHandler::HandleDieCommand(char* /*args*/)
{
Unit* target = getSelectedUnit();
if(!target || m_session->GetPlayer()->GetSelectionGuid().IsEmpty())
if (!target || !m_session->GetPlayer()->GetSelectionGuid())
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
return false;
}
if(target->GetTypeId()==TYPEID_PLAYER)
if (target->GetTypeId()==TYPEID_PLAYER)
{
if (HasLowerSecurity((Player*)target, ObjectGuid(), false))
return false;
}
if( target->isAlive() )
if (target->isAlive())
{
m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
@ -3738,7 +3737,7 @@ bool ChatHandler::HandleDamageCommand(char* args)
Unit* target = getSelectedUnit();
if (!target || m_session->GetPlayer()->GetSelectionGuid().IsEmpty())
if (!target || !m_session->GetPlayer()->GetSelectionGuid())
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@ -4890,7 +4889,7 @@ bool ChatHandler::HandleResetSpecsCommand(char* args)
target->SendTalentsInfoData(true);
return true;
}
else if (!target_guid.IsEmpty())
else if (target_guid)
{
uint32 at_flags = AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS;
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'", at_flags, target_guid.GetCounter());
@ -5712,7 +5711,7 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/)
// accept only explicitly selected target (not implicitly self targeting case)
Unit* target = getSelectedUnit();
if (!pl->GetSelectionGuid().IsEmpty() && target)
if (pl->GetSelectionGuid() && target)
{
if (target->GetTypeId() != TYPEID_UNIT)
{
@ -5863,7 +5862,7 @@ bool ChatHandler::HandlePDumpWriteCommand(char *args)
}
guid = sObjectMgr.GetPlayerGuidByName(name);
if (guid.IsEmpty())
if (!guid)
{
PSendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);

View file

@ -180,7 +180,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
Player *player = GetPlayer();
ObjectGuid guid = player->GetLootGuid();
if (guid.IsEmpty())
if (!guid)
return;
Loot *pLoot = NULL;
@ -297,8 +297,7 @@ void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
// use internal stored guid
recv_data.read_skip<uint64>(); // guid;
ObjectGuid lootGuid = GetPlayer()->GetLootGuid();
if (!lootGuid.IsEmpty())
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
DoLootRelease(lootGuid);
}

View file

@ -107,7 +107,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
if (normalizePlayerName(receiver))
rc = sObjectMgr.GetPlayerGuidByName(receiver);
if (rc.IsEmpty())
if (!rc)
{
DETAIL_LOG("%s is sending mail to %s (GUID: nonexistent!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
pl->GetGuidStr().c_str(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);

View file

@ -1674,7 +1674,7 @@ void Map::ScriptsProcess()
Object* source = NULL;
if (!step.sourceGuid.IsEmpty())
if (step.sourceGuid)
{
switch(step.sourceGuid.GetHigh())
{
@ -1712,7 +1712,7 @@ void Map::ScriptsProcess()
Object* target = NULL;
if (!step.targetGuid.IsEmpty())
if (step.targetGuid)
{
switch(step.targetGuid.GetHigh())
{

View file

@ -264,8 +264,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
{
DEBUG_LOG( "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity() );
ObjectGuid lootGuid = GetPlayer()->GetLootGuid();
if (!lootGuid.IsEmpty())
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
DoLootRelease(lootGuid);
//Can not logout if...
@ -472,7 +471,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 acc
return;
FriendsResult friendResult = FRIEND_NOT_FOUND;
if (!friendGuid.IsEmpty())
if (friendGuid)
{
if (friendGuid == session->GetPlayer()->GetObjectGuid())
friendResult = FRIEND_SELF;
@ -552,7 +551,7 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 acc
return;
FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND;
if (!ignoreGuid.IsEmpty())
if (ignoreGuid)
{
if (ignoreGuid == session->GetPlayer()->GetObjectGuid())
ignoreResult = FRIEND_IGNORE_SELF;

View file

@ -235,12 +235,12 @@ void MotionMaster::MoveTargetedHome()
Clear(false);
if (m_owner->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->GetCharmerOrOwnerGuid().IsEmpty())
if (m_owner->GetTypeId() == TYPEID_UNIT && !((Creature*)m_owner)->GetCharmerOrOwnerGuid())
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted home", m_owner->GetGuidStr().c_str());
Mutate(new HomeMovementGenerator<Creature>());
}
else if (m_owner->GetTypeId() == TYPEID_UNIT && !((Creature*)m_owner)->GetCharmerOrOwnerGuid().IsEmpty())
else if (m_owner->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->GetCharmerOrOwnerGuid())
{
if (Unit *target = ((Creature*)m_owner)->GetCharmerOrOwner())
{

View file

@ -419,8 +419,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
recv_data >> mi;
ObjectGuid vehicleGUID = _player->GetCharmGuid();
if (vehicleGUID.IsEmpty()) // something wrong here...
if (!vehicleGUID) // something wrong here...
return;
_player->m_movementInfo = mi;

View file

@ -855,7 +855,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
float discountMod = _player->GetReputationPriceDiscount(unit);
uint32 TotalCost = 0;
if (!itemGuid.IsEmpty())
if (itemGuid)
{
DEBUG_LOG("ITEM: %s repair of %s", npcGuid.GetString().c_str(), itemGuid.GetString().c_str());

View file

@ -1570,7 +1570,7 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const*
*data << uint32(strlen(name)+1);
*data << name;
*data << ObjectGuid(targetGuid); // Unit Target
if (!targetGuid.IsEmpty() && !targetGuid.IsPlayer())
if (targetGuid && !targetGuid.IsPlayer())
{
*data << uint32(strlen(targetName)+1); // target name length
*data << targetName; // target name

View file

@ -50,10 +50,10 @@ ObjectAccessor::~ObjectAccessor()
Unit*
ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
{
if(guid.IsEmpty())
if (!guid)
return NULL;
if(guid.IsPlayer())
if (guid.IsPlayer())
return FindPlayer(guid);
if (!u.IsInWorld())
@ -65,9 +65,9 @@ ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
{
Corpse * ret = HashMapHolder<Corpse>::Find(guid);
if(!ret)
if (!ret)
return NULL;
if(ret->GetMapId() != mapid)
if (ret->GetMapId() != mapid)
return NULL;
return ret;
@ -76,11 +76,11 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
Player*
ObjectAccessor::FindPlayer(ObjectGuid guid)
{
if (guid.IsEmpty())
if (!guid)
return NULL;
Player * plr = HashMapHolder<Player>::Find(guid);;
if(!plr || !plr->IsInWorld())
if (!plr || !plr->IsInWorld())
return NULL;
return plr;

View file

@ -88,9 +88,11 @@ class MANGOS_DLL_SPEC ObjectGuid
{
public: // constructors
ObjectGuid() : m_guid(0) {}
ObjectGuid(uint64 const& guid) : m_guid(guid) {} // NOTE: must be explicit in future for more strict control type conversions
explicit ObjectGuid(uint64 const& guid) : m_guid(guid) {}
ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) {}
ObjectGuid(HighGuid hi, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) {}
operator uint64() const { return m_guid; }
private:
ObjectGuid(uint32 const&); // no implementation, used for catch wrong type assign
ObjectGuid(HighGuid, uint32, uint64 counter); // no implementation, used for catch wrong type assign

View file

@ -531,7 +531,9 @@ void Pet::Update(uint32 update_diff, uint32 diff)
{
// unsummon pet that lost owner
Unit* owner = GetOwner();
if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (!owner->GetCharmGuid().IsEmpty() && (owner->GetCharmGuid() != GetObjectGuid()))) || (isControlled() && owner->GetPetGuid().IsEmpty()))
if (!owner ||
(!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGuid() && (owner->GetCharmGuid() != GetObjectGuid()))) ||
(isControlled() && !owner->GetPetGuid()))
{
Unsummon(PET_SAVE_REAGENTS);
return;

View file

@ -170,7 +170,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data)
case ACT_ENABLED: // 0xC1 spell
{
Unit* unit_target = NULL;
if (!targetGuid.IsEmpty())
if (targetGuid)
unit_target = _player->GetMap()->GetUnit(targetGuid);
// do not cast unknown spells

View file

@ -844,7 +844,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
Field* fields = result->Fetch();
ObjectGuid signGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
if (signGuid.IsEmpty())
if (!signGuid)
continue;
guild->AddMember(signGuid, guild->GetLowestRank());
@ -876,7 +876,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
{
Field* fields = result->Fetch();
ObjectGuid memberGUID = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
if (memberGUID.IsEmpty())
if (!memberGUID)
continue;
DEBUG_LOG("PetitionsHandler: adding arena member %s", memberGUID.GetString().c_str());

View file

@ -308,7 +308,7 @@ TradeData* TradeData::GetTraderData() const
Item* TradeData::GetItem( TradeSlots slot ) const
{
return !m_items[slot].IsEmpty() ? m_player->GetItemByGuid(m_items[slot]) : NULL;
return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : NULL;
}
bool TradeData::HasItem( ObjectGuid item_guid ) const
@ -322,7 +322,7 @@ bool TradeData::HasItem( ObjectGuid item_guid ) const
Item* TradeData::GetSpellCastItem() const
{
return !m_spellCastItem.IsEmpty() ? m_player->GetItemByGuid(m_spellCastItem) : NULL;
return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL;
}
void TradeData::SetItem( TradeSlots slot, Item* item )
@ -1473,7 +1473,7 @@ void Player::Update( uint32 update_diff, uint32 p_time )
SendUpdateToOutOfRangeGroupMembers();
Pet* pet = GetPet();
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (!GetCharmGuid().IsEmpty() && (pet->GetObjectGuid() != GetCharmGuid())))
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGuid() && (pet->GetObjectGuid() != GetCharmGuid())))
pet->Unsummon(PET_SAVE_REAGENTS, this);
if (IsHasDelayedTeleport())
@ -2231,7 +2231,7 @@ void Player::RegenerateHealth(uint32 diff)
Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
{
// some basic checks
if (guid.IsEmpty() || !IsInWorld() || IsTaxiFlying())
if (!guid || !IsInWorld() || IsTaxiFlying())
return NULL;
// not in interactive state
@ -2261,7 +2261,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
return NULL;
// not allow interaction under control, but allow with own pets
if (!unit->GetCharmerGuid().IsEmpty())
if (unit->GetCharmerGuid())
return NULL;
// not enemy
@ -2285,7 +2285,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, uint32 gameobject_type) const
{
// some basic checks
if (guid.IsEmpty() || !IsInWorld() || IsTaxiFlying())
if (!guid || !IsInWorld() || IsTaxiFlying())
return NULL;
// not in interactive state
@ -7959,8 +7959,7 @@ void Player::SendLootRelease(ObjectGuid guid)
void Player::SendLoot(ObjectGuid guid, LootType loot_type)
{
ObjectGuid lootGuid = GetLootGuid();
if (!lootGuid.IsEmpty())
if (ObjectGuid lootGuid = GetLootGuid())
m_session->DoLootRelease(lootGuid);
Loot *loot = 0;
@ -17000,7 +16999,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, ObjectGuid pl
group = player->GetGroup();
}
MANGOS_ASSERT(!player_guid.IsEmpty());
MANGOS_ASSERT(player_guid);
// copy all binds to the group, when changing leader it's assumed the character
// will not have any solo binds
@ -18370,7 +18369,7 @@ void Player::PetSpellInitialize()
void Player::SendPetGUIDs()
{
if (GetPetGuid().IsEmpty())
if (!GetPetGuid())
return;
// Later this function might get modified for multiple guids
@ -19985,7 +19984,7 @@ void Player::AddComboPoints(Unit* target, int8 count)
}
else
{
if (!m_comboTargetGuid.IsEmpty())
if (m_comboTargetGuid)
if(Unit* target2 = ObjectAccessor::GetUnit(*this, m_comboTargetGuid))
target2->RemoveComboPointHolder(GetGUIDLow());
@ -20003,7 +20002,7 @@ void Player::AddComboPoints(Unit* target, int8 count)
void Player::ClearComboPoints()
{
if (m_comboTargetGuid.IsEmpty())
if (!m_comboTargetGuid)
return;
// without combopoints lost (duration checked in aura)
@ -22081,7 +22080,7 @@ void Player::ResummonPetTemporaryUnSummonedIfAny()
if (IsPetNeedBeTemporaryUnsummoned())
return;
if (!GetPetGuid().IsEmpty())
if (GetPetGuid())
return;
Pet* NewPet = new Pet;

View file

@ -472,7 +472,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
if (!pPlayer->GetDividerGuid().IsEmpty())
if (pPlayer->GetDividerGuid())
{
_player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_BUSY);
continue;

View file

@ -188,10 +188,10 @@ void SpellCastTargets::setCorpseTarget(Corpse* corpse)
void SpellCastTargets::Update(Unit* caster)
{
m_GOTarget = !m_GOTargetGUID.IsEmpty() ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL;
m_unitTarget = !m_unitTargetGUID.IsEmpty() ?
m_GOTarget = m_GOTargetGUID ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL;
m_unitTarget = m_unitTargetGUID ?
( m_unitTargetGUID == caster->GetObjectGuid() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) :
NULL;
NULL;
m_itemTarget = NULL;
if (caster->GetTypeId() == TYPEID_PLAYER)
@ -354,10 +354,7 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o
// Set health leech amount to zero
m_healthLeech = 0;
if(!originalCasterGUID.IsEmpty())
m_originalCasterGUID = originalCasterGUID;
else
m_originalCasterGUID = m_caster->GetObjectGuid();
m_originalCasterGUID = originalCasterGUID ? originalCasterGUID : m_caster->GetObjectGuid();
UpdateOriginalCasterPointer();
@ -2224,7 +2221,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
break;
}
case TARGET_GAMEOBJECT_ITEM:
if (!m_targets.getGOTargetGuid().IsEmpty())
if (m_targets.getGOTargetGuid())
AddGOTarget(m_targets.getGOTarget(), effIndex);
else if (m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), effIndex);
@ -2640,14 +2637,14 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
targetUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if (m_caster->GetTypeId()==TYPEID_PLAYER && !((Player*)m_caster)->GetSelectionGuid().IsEmpty())
if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelectionGuid())
if (Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelectionGuid()))
targetUnitMap.push_back(target);
break;
case SPELL_EFFECT_RESURRECT_NEW:
if (m_targets.getUnitTarget())
targetUnitMap.push_back(m_targets.getUnitTarget());
if (!m_targets.getCorpseTargetGuid().IsEmpty())
if (m_targets.getCorpseTargetGuid())
{
if (Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid()))
if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGuid()))
@ -2705,7 +2702,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
if (m_targets.getUnitTarget())
targetUnitMap.push_back(m_targets.getUnitTarget());
else if (!m_targets.getCorpseTargetGuid().IsEmpty())
else if (m_targets.getCorpseTargetGuid())
{
if (Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid()))
if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGuid()))
@ -2912,7 +2909,7 @@ void Spell::cast(bool skipCheck)
UpdatePointers();
// cancel at lost main target unit
if (!m_targets.getUnitTarget() && !m_targets.getUnitTargetGuid().IsEmpty() && m_targets.getUnitTargetGuid() != m_caster->GetObjectGuid())
if (!m_targets.getUnitTarget() && m_targets.getUnitTargetGuid() && m_targets.getUnitTargetGuid() != m_caster->GetObjectGuid())
{
cancel();
m_caster->DecreaseCastCounter();
@ -3305,7 +3302,7 @@ void Spell::update(uint32 difftime)
// update pointers based at it's GUIDs
UpdatePointers();
if (!m_targets.getUnitTargetGuid().IsEmpty() && !m_targets.getUnitTarget())
if (m_targets.getUnitTargetGuid() && !m_targets.getUnitTarget())
{
cancel();
return;
@ -3924,7 +3921,7 @@ void Spell::SendLogExecute()
case SPELL_EFFECT_SUMMON_OBJECT_SLOT4:
if (Unit *unit = m_targets.getUnitTarget())
data << unit->GetPackGUID();
else if (!m_targets.getItemTargetGuid().IsEmpty())
else if (m_targets.getItemTargetGuid())
data << m_targets.getItemTargetGuid().WriteAsPacked();
else if (GameObject *go = m_targets.getGOTarget())
data << go->GetPackGUID();
@ -4695,7 +4692,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
if (!explicit_target_mode && m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->GetCharmerOrOwnerGuid().IsEmpty())
if (!explicit_target_mode && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGuid())
{
// check correctness positive/negative cast target (pet cast real check and cheating check)
if(IsPositiveSpell(m_spellInfo->Id))
@ -4988,7 +4985,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_ERROR;
if (((Player*)m_caster)->GetSelectionGuid().IsEmpty())
if (!((Player*)m_caster)->GetSelectionGuid())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
Pet* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelectionGuid());
@ -5027,7 +5024,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellIconID == 33)
{
// fire totems slot
if (m_caster->GetTotemGuid(TOTEM_SLOT_FIRE).IsEmpty())
if (!m_caster->GetTotemGuid(TOTEM_SLOT_FIRE))
return SPELL_FAILED_TOTEMS;
}
break;
@ -5096,7 +5093,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_DONT_REPORT;
}
if (!plrCaster->GetPetGuid().IsEmpty() || !plrCaster->GetCharmGuid().IsEmpty())
if (plrCaster->GetPetGuid() || plrCaster->GetCharmGuid())
{
plrCaster->SendPetTameFailure(PETTAME_ANOTHERSUMMONACTIVE);
return SPELL_FAILED_DONT_REPORT;
@ -5300,10 +5297,10 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if(summon_prop->Group == SUMMON_PROP_GROUP_PETS)
{
if (!m_caster->GetPetGuid().IsEmpty())
if (m_caster->GetPetGuid())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
if (!m_caster->GetCharmGuid().IsEmpty())
if (m_caster->GetCharmGuid())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
}
}
@ -5312,7 +5309,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_SUMMON_PET:
{
if (!m_caster->GetPetGuid().IsEmpty()) //let warlock do a replacement summon
if (m_caster->GetPetGuid()) // let warlock do a replacement summon
{
Pet* pet = ((Player*)m_caster)->GetPet();
@ -5326,20 +5323,20 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
}
if (!m_caster->GetCharmGuid().IsEmpty())
if (m_caster->GetCharmGuid())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;
}
case SPELL_EFFECT_SUMMON_PLAYER:
{
if(m_caster->GetTypeId() != TYPEID_PLAYER)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
if(((Player*)m_caster)->GetSelectionGuid().IsEmpty())
if (!((Player*)m_caster)->GetSelectionGuid())
return SPELL_FAILED_BAD_TARGETS;
Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelectionGuid());
if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) )
if (!target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster))
return SPELL_FAILED_BAD_TARGETS;
// check if our map is dungeon
@ -5418,19 +5415,19 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_targets.getUnitTarget() == m_caster)
return SPELL_FAILED_BAD_TARGETS;
if (!m_caster->GetPetGuid().IsEmpty())
if (m_caster->GetPetGuid())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
if (!m_caster->GetCharmGuid().IsEmpty())
if (m_caster->GetCharmGuid())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
if (!m_caster->GetCharmerGuid().IsEmpty())
if (m_caster->GetCharmerGuid())
return SPELL_FAILED_CHARMED;
if (!m_targets.getUnitTarget())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
if (!m_targets.getUnitTarget()->GetCharmerGuid().IsEmpty())
if (m_targets.getUnitTarget()->GetCharmerGuid())
return SPELL_FAILED_CHARMED;
if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
@ -5443,19 +5440,19 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_targets.getUnitTarget() == m_caster)
return SPELL_FAILED_BAD_TARGETS;
if (!m_caster->GetPetGuid().IsEmpty())
if (m_caster->GetPetGuid())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
if (!m_caster->GetCharmGuid().IsEmpty())
if (m_caster->GetCharmGuid())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
if (!m_caster->GetCharmerGuid().IsEmpty())
if (m_caster->GetCharmerGuid())
return SPELL_FAILED_CHARMED;
if (!m_targets.getUnitTarget())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
if (!m_targets.getUnitTarget()->GetCharmerGuid().IsEmpty())
if (m_targets.getUnitTarget()->GetCharmerGuid())
return SPELL_FAILED_CHARMED;
if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
@ -5468,17 +5465,17 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_UNKNOWN;
if (!m_caster->GetCharmGuid().IsEmpty())
if (m_caster->GetCharmGuid())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
if (!m_caster->GetCharmerGuid().IsEmpty())
if (m_caster->GetCharmerGuid())
return SPELL_FAILED_CHARMED;
Pet* pet = m_caster->GetPet();
if (!pet)
return SPELL_FAILED_NO_PET;
if (!pet->GetCharmerGuid().IsEmpty())
if (pet->GetCharmerGuid())
return SPELL_FAILED_CHARMED;
break;
@ -6133,7 +6130,7 @@ SpellCastResult Spell::CheckItems()
}
// check target item (for triggered case not report error)
if (!m_targets.getItemTargetGuid().IsEmpty())
if (m_targets.getItemTargetGuid())
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM)
@ -6701,7 +6698,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
// player far away, maybe his corpse near?
if(target != m_caster && !target->IsWithinLOSInMap(m_caster))
{
if (!m_targets.getCorpseTargetGuid().IsEmpty())
if (m_targets.getCorpseTargetGuid())
return false;
Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid());
@ -7037,7 +7034,7 @@ void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList &targetUnitMap, Unit*
WorldObject* Spell::GetAffectiveCasterObject() const
{
if (m_originalCasterGUID.IsEmpty())
if (!m_originalCasterGUID)
return m_caster;
if (m_originalCasterGUID.IsGameObject() && m_caster->IsInWorld())

View file

@ -162,7 +162,7 @@ class SpellCastTargets
}
}
bool IsEmpty() const { return m_GOTargetGUID.IsEmpty() && m_unitTargetGUID.IsEmpty() && m_itemTarget==NULL && m_CorpseTargetGUID.IsEmpty(); }
bool IsEmpty() const { return !m_GOTargetGUID && !m_unitTargetGUID && !m_itemTarget && !m_CorpseTargetGUID; }
void Update(Unit* caster);
@ -471,7 +471,7 @@ class Spell
// real source of cast affects, explicit caster, or DoT/HoT applier, or GO owner, or wild GO itself. Can be NULL
WorldObject* GetAffectiveCasterObject() const;
// limited version returning NULL in cases wild gameobject caster object, need for Aura (auras currently not support non-Unit caster)
Unit* GetAffectiveCaster() const { return !m_originalCasterGUID.IsEmpty() ? m_originalCaster : m_caster; }
Unit* GetAffectiveCaster() const { return m_originalCasterGUID ? m_originalCaster : m_caster; }
// m_originalCasterGUID can store GO guid, and in this case this is visual caster
WorldObject* GetCastingObject() const;

View file

@ -938,7 +938,7 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode )
for(std::map<uint32, ObjectGuid>::const_iterator map_itr = affectedSelf.begin(); map_itr != affectedSelf.end(); ++map_itr)
{
Item* item = pTarget && !map_itr->second.IsEmpty() ? pTarget->GetItemByGuid(map_itr->second) : NULL;
Item* item = pTarget && map_itr->second ? pTarget->GetItemByGuid(map_itr->second) : NULL;
target->RemoveAurasDueToSpell(map_itr->first);
target->CastSpell(target, map_itr->first, true, item);
}
@ -1048,7 +1048,7 @@ void Aura::TriggerSpell()
ObjectGuid casterGUID = GetCasterGuid();
Unit* triggerTarget = GetTriggerTarget();
if (casterGUID.IsEmpty() || !triggerTarget)
if (!casterGUID || !triggerTarget)
return;
// generic casting code with custom spells and target/caster customs
@ -1888,7 +1888,7 @@ void Aura::TriggerSpellWithValue()
ObjectGuid casterGuid = GetCasterGuid();
Unit* target = GetTriggerTarget();
if (casterGuid.IsEmpty() || !target)
if (!casterGuid || !target)
return;
// generic casting code with custom spells and target/caster customs
@ -6662,7 +6662,7 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real)
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
// remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
if (!apply && m_removeMode == AURA_REMOVE_BY_EXPIRE && !target->GetComboTargetGuid().IsEmpty())
if (!apply && m_removeMode == AURA_REMOVE_BY_EXPIRE && target->GetComboTargetGuid())
if (Unit* unit = ObjectAccessor::GetUnit(*GetTarget(),target->GetComboTargetGuid()))
target->AddComboPoints(unit, -m_modifier.m_amount);
}
@ -8366,7 +8366,7 @@ void SpellAuraHolder::_AddSpellAuraHolder()
{
if (m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
{
Item* castItem = !m_castItemGuid.IsEmpty() ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL;
Item* castItem = m_castItemGuid ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL;
((Player*)caster)->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true);
}
}
@ -8682,7 +8682,7 @@ Unit* SpellAuraHolder::GetCaster() const
bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref) const
{
// only item casted spells
if (GetCastItemGuid().IsEmpty())
if (!GetCastItemGuid())
return false;
// Exclude Debuffs
@ -8711,7 +8711,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref) co
return false;
// form different weapons
return !ref->GetCastItemGuid().IsEmpty() && ref->GetCastItemGuid() != GetCastItemGuid();
return ref->GetCastItemGuid() && ref->GetCastItemGuid() != GetCastItemGuid();
}
bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const

View file

@ -4690,11 +4690,12 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
void Spell::DoSummon(SpellEffectIndex eff_idx)
{
if (!m_caster->GetPetGuid().IsEmpty())
if (m_caster->GetPetGuid())
return;
if (!unitTarget)
return;
uint32 pet_entry = m_spellInfo->EffectMiscValue[eff_idx];
if (!pet_entry)
return;
@ -8084,9 +8085,7 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx)
default: return;
}
ObjectGuid guid = m_caster->m_ObjectSlotGuid[slot];
if (!guid.IsEmpty())
if (ObjectGuid guid = m_caster->m_ObjectSlotGuid[slot])
{
if (GameObject* obj = m_caster ? m_caster->GetMap()->GetGameObject(guid) : NULL)
obj->SetLootState(GO_JUST_DEACTIVATED);

View file

@ -161,10 +161,10 @@ void Totem::SetOwner(Unit* owner)
Unit *Totem::GetOwner()
{
ObjectGuid ownerGuid = GetOwnerGuid();
if (ownerGuid.IsEmpty())
return NULL;
return ObjectAccessor::GetUnit(*this, ownerGuid);
if (ObjectGuid ownerGuid = GetOwnerGuid())
return ObjectAccessor::GetUnit(*this, ownerGuid);
return NULL;
}
void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto)

View file

@ -1146,7 +1146,7 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered,
if (triggeredByAura)
{
if(originalCaster.IsEmpty())
if (!originalCaster)
originalCaster = triggeredByAura->GetCasterGuid();
triggeredBy = triggeredByAura->GetSpellProto();
@ -1192,7 +1192,7 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const *spellInfo, int32 cons
if (triggeredByAura)
{
if(originalCaster.IsEmpty())
if (!originalCaster)
originalCaster = triggeredByAura->GetCasterGuid();
triggeredBy = triggeredByAura->GetSpellProto();
@ -1249,7 +1249,7 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, boo
if (triggeredByAura)
{
if(originalCaster.IsEmpty())
if (!originalCaster)
originalCaster = triggeredByAura->GetCasterGuid();
triggeredBy = triggeredByAura->GetSpellProto();
@ -1733,7 +1733,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if( (damageInfo->hitOutCome==MELEE_HIT_CRIT || damageInfo->hitOutCome==MELEE_HIT_CRUSHING || damageInfo->hitOutCome==MELEE_HIT_NORMAL || damageInfo->hitOutCome==MELEE_HIT_GLANCING) &&
GetTypeId() != TYPEID_PLAYER && ((Creature*)this)->GetCharmerOrOwnerGuid().IsEmpty() && !pVictim->HasInArc(M_PI_F, this) )
GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGuid() && !pVictim->HasInArc(M_PI_F, this) )
{
// -probability is between 0% and 40%
// 20% base chance
@ -2751,7 +2751,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
// can be from by creature (if can) or from controlled player that considered as creature
((GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() &&
!(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH)) ||
GetTypeId()==TYPEID_PLAYER && !GetCharmerOrOwnerGuid().IsEmpty()))
GetTypeId()==TYPEID_PLAYER && GetCharmerOrOwnerGuid()))
{
// when their weapon skill is 15 or more above victim's defense skill
tmp = victimDefenseSkill;
@ -4540,7 +4540,7 @@ void Unit::RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid)
for (SpellAuraHolderMap::iterator itr = auras.begin(); itr != auras.end(); )
{
SpellEntry const* spell = itr->second->GetSpellProto();
if (((1<<spell->Dispel) & dispelMask) && (casterGuid.IsEmpty() || casterGuid == itr->second->GetCasterGuid()))
if (((1<<spell->Dispel) & dispelMask) && (!casterGuid || casterGuid == itr->second->GetCasterGuid()))
{
// Dispel aura
RemoveAurasDueToSpell(spell->Id);
@ -4556,7 +4556,7 @@ void Unit::RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount, ObjectG
SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId);
for (SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; ++iter)
{
if (casterGuid.IsEmpty() || iter->second->GetCasterGuid() == casterGuid)
if (!casterGuid || iter->second->GetCasterGuid() == casterGuid)
{
if (iter->second->ModStackAmount(-int32(stackAmount)))
{
@ -4910,7 +4910,7 @@ Aura* Unit::GetAura(AuraType type, SpellFamily family, uint64 familyFlag, uint32
AuraList const& auras = GetAurasByType(type);
for(AuraList::const_iterator i = auras.begin();i != auras.end(); ++i)
if ((*i)->GetSpellProto()->IsFitToFamily(family, familyFlag, familyFlag2) &&
(casterGuid.IsEmpty() || (*i)->GetCasterGuid() == casterGuid))
(!casterGuid || (*i)->GetCasterGuid() == casterGuid))
return *i;
return NULL;
@ -5009,7 +5009,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
MANGOS_ASSERT(gameObj && gameObj->GetOwnerGuid().IsEmpty());
MANGOS_ASSERT(gameObj && !gameObj->GetOwnerGuid());
m_gameObj.push_back(gameObj);
gameObj->SetOwnerGuid(GetObjectGuid());
@ -5837,16 +5837,14 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
Unit *Unit::GetOwner() const
{
ObjectGuid ownerid = GetOwnerGuid();
if (!ownerid.IsEmpty())
if (ObjectGuid ownerid = GetOwnerGuid())
return ObjectAccessor::GetUnit(*this, ownerid);
return NULL;
}
Unit *Unit::GetCharmer() const
{
ObjectGuid charmerid = GetCharmerGuid();
if (!charmerid.IsEmpty())
if (ObjectGuid charmerid = GetCharmerGuid())
return ObjectAccessor::GetUnit(*this, charmerid);
return NULL;
}
@ -5870,8 +5868,7 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself()
Pet* Unit::GetPet() const
{
ObjectGuid pet_guid = GetPetGuid();
if (!pet_guid.IsEmpty())
if (ObjectGuid pet_guid = GetPetGuid())
{
if(Pet* pet = GetMap()->GetPet(pet_guid))
return pet;
@ -5898,7 +5895,7 @@ void Unit::RemoveMiniPet()
Pet* Unit::GetMiniPet() const
{
if (GetCritterGuid().IsEmpty())
if (!GetCritterGuid())
return NULL;
return GetMap()->GetPet(GetCritterGuid());
@ -5906,8 +5903,7 @@ Pet* Unit::GetMiniPet() const
Unit* Unit::GetCharm() const
{
ObjectGuid charm_guid = GetCharmGuid();
if (!charm_guid.IsEmpty())
if (ObjectGuid charm_guid = GetCharmGuid())
{
if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
return pet;
@ -6000,7 +5996,7 @@ Unit* Unit::_GetTotem(TotemSlot slot) const
Totem* Unit::GetTotem(TotemSlot slot ) const
{
if(slot >= MAX_TOTEM_SLOT || !IsInWorld() || m_TotemSlot[slot].IsEmpty())
if (slot >= MAX_TOTEM_SLOT || !IsInWorld() || !m_TotemSlot[slot])
return NULL;
Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]);
@ -6010,7 +6006,7 @@ Totem* Unit::GetTotem(TotemSlot slot ) const
bool Unit::IsAllTotemSlotsUsed() const
{
for (int i = 0; i < MAX_TOTEM_SLOT; ++i)
if (m_TotemSlot[i].IsEmpty())
if (!m_TotemSlot[i])
return false;
return true;
}

View file

@ -1218,7 +1218,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void clearUnitState(uint32 f) { m_state &= ~f; }
bool CanFreeMove() const
{
return !hasUnitState(UNIT_STAT_NO_FREE_MOVE) && GetOwnerGuid().IsEmpty();
return !hasUnitState(UNIT_STAT_NO_FREE_MOVE) && !GetOwnerGuid();
}
uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); }
@ -1504,11 +1504,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
Pet* GetMiniPet() const;
void SetMiniPet(Unit* pet) { SetCritterGuid(pet ? pet->GetObjectGuid() : ObjectGuid()); }
ObjectGuid const& GetCharmerOrOwnerGuid() const { return !GetCharmerGuid().IsEmpty() ? GetCharmerGuid() : GetOwnerGuid(); }
ObjectGuid const& GetCharmerOrOwnerGuid() const { return GetCharmerGuid() ? GetCharmerGuid() : GetOwnerGuid(); }
ObjectGuid const& GetCharmerOrOwnerOrOwnGuid() const
{
ObjectGuid const& guid = GetCharmerOrOwnerGuid();
if (!guid.IsEmpty())
if (ObjectGuid const& guid = GetCharmerOrOwnerGuid())
return guid;
return GetObjectGuid();
}
@ -1521,7 +1520,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
Unit* GetCharmer() const;
Unit* GetCharm() const;
void Uncharm();
Unit* GetCharmerOrOwner() const { return !GetCharmerGuid().IsEmpty() ? GetCharmer() : GetOwner(); }
Unit* GetCharmerOrOwner() const { return GetCharmerGuid() ? GetCharmer() : GetOwner(); }
Unit* GetCharmerOrOwnerOrSelf()
{
if(Unit* u = GetCharmerOrOwner())

View file

@ -436,7 +436,7 @@ SpellAuraProcResult Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura
{
SpellEntry const *hasteSpell = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
uint32 triggered_spell_id = 0;
@ -502,7 +502,7 @@ SpellAuraProcResult Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*
SpellEntry const *triggeredByAuraSpell = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
uint32 triggered_spell_id = 0;
@ -566,7 +566,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
SpellEffectIndex effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetModifier()->m_amount;
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// some dummy spells have trigger spell in spell data already (from 3.0.3)
@ -2763,7 +2763,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d
if(triggeredByAura->GetModifier()->m_auraname == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
basepoints[0] = triggerAmount;
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// Try handle unknown trigger spells
@ -3589,7 +3589,7 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint3
if(!pVictim || !pVictim->isAlive())
return SPELL_AURA_PROC_FAILED;
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// Basepoints of trigger aura
@ -3796,8 +3796,8 @@ SpellAuraProcResult Unit::HandleAddFlatModifierAuraProc(Unit* /*pVictim*/, uint3
SpellAuraProcResult Unit::HandleAddPctModifierAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 /*cooldown*/)
{
SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
switch(spellInfo->SpellFamilyName)
{
@ -3841,8 +3841,8 @@ SpellAuraProcResult Unit::HandleAddPctModifierAuraProc(Unit* /*pVictim*/, uint32
SpellAuraProcResult Unit::HandleModDamagePercentDoneAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 cooldown)
{
SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
// Aspect of the Viper
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->SpellFamilyFlags & UI64LIT(0x4000000000000))
@ -3881,7 +3881,7 @@ SpellAuraProcResult Unit::HandleManaShieldAuraProc(Unit *pVictim, uint32 damage,
{
SpellEntry const *dummySpell = triggeredByAura->GetSpellProto ();
Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL;
uint32 triggered_spell_id = 0;

View file

@ -336,8 +336,7 @@ void WorldSession::LogoutPlayer(bool Save)
{
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() ,_player->GetGUIDLow());
ObjectGuid lootGuid = GetPlayer()->GetLootGuid();
if (!lootGuid.IsEmpty())
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
DoLootRelease(lootGuid);
///- If the player just died before logging out, make him appear as a ghost

View file

@ -269,10 +269,10 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
return false;
}
if (!m_session->GetPlayer()->GetSelectionGuid().IsEmpty())
unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer());
if (m_session->GetPlayer()->GetSelectionGuid())
unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer());
else
unit->PlayDirectSound(dwSoundId,m_session->GetPlayer());
unit->PlayDirectSound(dwSoundId, m_session->GetPlayer());
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
return true;

View file

@ -269,7 +269,7 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo
return;
}
if (!sObjectMgr.GetPlayerGuidByName(delInfo.name).IsEmpty())
if (sObjectMgr.GetPlayerGuidByName(delInfo.name))
{
PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
return;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11489"
#define REVISION_NR "11490"
#endif // __REVISION_NR_H__