* Fix a bug; prevent server from deleting action button of the talent spec that was just switched to, caused by clients response when spells are being unlearned.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2009-08-17 01:40:35 +02:00
parent b3d381791e
commit 60c0acfae6
2 changed files with 15 additions and 5 deletions
+12 -3
View File
@@ -5849,6 +5849,11 @@ void Player::removeActionButton(uint8 button)
if (buttonItr==m_actionButtons.end())
return;
if (!buttonItr->second.canRemoveByClient)
{
buttonItr->second.canRemoveByClient = true;
return;
}
if(buttonItr->second.uState==ACTIONBUTTON_NEW)
m_actionButtons.erase(buttonItr); // new and not saved
else
@@ -15126,7 +15131,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// update items with duration and realtime
UpdateItemDuration(time_diff, true);
_LoadActions(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACTIONS));
_LoadActions(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACTIONS), true);
// unread mails and next delivery time, actual mails not loaded
_LoadMailInit(holder->GetResult(PLAYER_LOGIN_QUERY_LOADMAILCOUNT), holder->GetResult(PLAYER_LOGIN_QUERY_LOADMAILDATE));
@@ -15255,7 +15260,7 @@ bool Player::isAllowedToLoot(Creature* creature)
return !creature->hasLootRecipient();
}
void Player::_LoadActions(QueryResult *result)
void Player::_LoadActions(QueryResult *result, bool startup)
{
if(result)
{
@@ -15268,7 +15273,11 @@ void Player::_LoadActions(QueryResult *result)
uint8 type = fields[2].GetUInt8();
if(ActionButton* ab = addActionButton(button, action, type))
{
ab->uState = ACTIONBUTTON_UNCHANGED;
if(!startup) // Switching specs
ab->canRemoveByClient = false;
}
else
{
sLog.outError( " ...at loading, and will deleted in DB also");
@@ -21856,7 +21865,7 @@ void Player::ActivateSpec(uint8 spec)
QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' AND spec = '%u' ORDER BY button", GetGUIDLow(), m_activeSpec);
if (result)
{
_LoadActions(result);
_LoadActions(result, false);
}
UnsummonPetTemporaryIfAny();
AutoUnequipOffhandIfNeed();
+3 -2
View File
@@ -157,10 +157,11 @@ enum ActionButtonType
struct ActionButton
{
ActionButton() : packedData(0), uState( ACTIONBUTTON_NEW ) {}
ActionButton() : packedData(0), uState( ACTIONBUTTON_NEW ), canRemoveByClient(true){}
uint32 packedData;
ActionButtonUpdateState uState;
bool canRemoveByClient;
// helpers
ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); }
@@ -2240,7 +2241,7 @@ class MANGOS_DLL_SPEC Player : public Unit
/*** LOAD SYSTEM ***/
/*********************************************************/
void _LoadActions(QueryResult *result);
void _LoadActions(QueryResult *result, bool startup);
void _LoadAuras(QueryResult *result, uint32 timediff);
void _LoadGlyphAuras();
void _LoadBoundInstances(QueryResult *result);