[7901] Refactoting pet action bar related code. Fixed some related bugs.

* Correctly update action bar at loading and other cases when listed unlearned/not existed spells
* Avoid send data by PetSpellInitialize() many times while pet loading
This commit is contained in:
VladimirMangos 2009-05-27 19:24:12 +04:00
parent 1abe4c0d79
commit 4d8adefe70
7 changed files with 175 additions and 122 deletions

View file

@ -16410,10 +16410,7 @@ void Player::PetSpellInitialize()
data << uint8(charmInfo->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
// action bar loop
for(uint32 i = 0; i < 10; ++i)
{
data << uint32(charmInfo->GetActionBarEntry(i)->Raw);
}
charmInfo->BuildActionBar(&data);
size_t spellsCountPos = data.wpos();
@ -16489,10 +16486,7 @@ void Player::PossessSpellInitialize()
data << uint32(0);
data << uint32(0);
for(uint32 i = 0; i < 10; ++i) //40
{
data << uint16(charmInfo->GetActionBarEntry(i)->SpellOrAction) << uint16(charmInfo->GetActionBarEntry(i)->Type);
}
charmInfo->BuildActionBar(&data); //40
data << uint8(addlist); //1
@ -16543,10 +16537,7 @@ void Player::CharmSpellInitialize()
data << uint8(0) << uint8(0);
data << uint16(0);
for(uint32 i = 0; i < 10; ++i) //40
{
data << uint16(charmInfo->GetActionBarEntry(i)->SpellOrAction) << uint16(charmInfo->GetActionBarEntry(i)->Type);
}
charmInfo->BuildActionBar(&data); //40
data << uint8(addlist); //1