[10627] Use ObjectGuid for player's selection and unit's target

This commit is contained in:
VladimirMangos 2010-10-20 08:15:30 +04:00
parent e74d56f9d2
commit c955941b55
21 changed files with 66 additions and 73 deletions

View file

@ -3659,7 +3659,7 @@ bool ChatHandler::HandleDieCommand(char* /*args*/)
{
Unit* target = getSelectedUnit();
if(!target || !m_session->GetPlayer()->GetSelection())
if(!target || m_session->GetPlayer()->GetSelectionGuid().IsEmpty())
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@ -3687,7 +3687,7 @@ bool ChatHandler::HandleDamageCommand(char* args)
Unit* target = getSelectedUnit();
if (!target || !m_session->GetPlayer()->GetSelection())
if (!target || m_session->GetPlayer()->GetSelectionGuid().IsEmpty())
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@ -5649,16 +5649,16 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/)
// accept only explicitly selected target (not implicitly self targeting case)
Unit* target = getSelectedUnit();
if(pl->GetSelection() && target)
if (!pl->GetSelectionGuid().IsEmpty() && target)
{
if(target->GetTypeId()!=TYPEID_UNIT)
if (target->GetTypeId() != TYPEID_UNIT)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
if(target->isDead())
if (target->isDead())
((Creature*)target)->Respawn();
return true;
}