aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp15
-rw-r--r--src/game/Player.h5
2 files changed, 15 insertions, 5 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index c1271395838..40dc8b21c62 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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();
diff --git a/src/game/Player.h b/src/game/Player.h
index c6557c6a19d..c0d936067b1 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -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);