[8871] Avoid use StopMoving when creature is already stopped.

Some additional code cleanup in related code.
This commit is contained in:
NoFantasy 2009-11-25 12:14:59 +01:00
parent 663038c7c7
commit 10ebadcadf
5 changed files with 48 additions and 41 deletions

View file

@ -700,29 +700,32 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
SendListInventory( guid );
}
void WorldSession::SendListInventory( uint64 vendorguid )
void WorldSession::SendListInventory(uint64 vendorguid)
{
sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" );
sLog.outDebug("WORLD: Sent SMSG_LIST_INVENTORY");
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!pCreature)
{
sLog.outDebug( "WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
_player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
sLog.outDebug("WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)));
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
if (!pCreature->IsStopped())
pCreature->StopMoving();
VendorItemData const* vItems = pCreature->GetVendorItems();
if(!vItems)
if (!vItems)
{
_player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
return;
}