diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 9abcebfb9..1a2f91053 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5358,12 +5358,12 @@ void Player::SendInitialActionButtons() sLog.outDetail( "Action Buttons for '%u' Initialized", GetGUIDLow() ); } -void Player::addActionButton(const uint8 button, const uint16 action, const uint8 type, const uint8 misc) +bool Player::addActionButton(const uint8 button, const uint16 action, const uint8 type, const uint8 misc) { if(button >= MAX_ACTION_BUTTONS) { sLog.outError( "Action %u not added into button %u for player %s: button must be < 132", action, button, GetName() ); - return; + return false; } // check cheating with adding non-known spells to action bar @@ -5372,13 +5372,13 @@ void Player::addActionButton(const uint8 button, const uint16 action, const uint if(!sSpellStore.LookupEntry(action)) { sLog.outError( "Action %u not added into button %u for player %s: spell not exist", action, button, GetName() ); - return; + return false; } if(!HasSpell(action)) { sLog.outError( "Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName() ); - return; + return false; } } @@ -5396,6 +5396,7 @@ void Player::addActionButton(const uint8 button, const uint16 action, const uint }; sLog.outDetail( "Player '%u' Added Action '%u' to Button '%u'", GetGUIDLow(), action, button ); + return true; } void Player::removeActionButton(uint8 button) @@ -14789,9 +14790,15 @@ void Player::_LoadActions(QueryResult *result) uint8 button = fields[0].GetUInt8(); - addActionButton(button, fields[1].GetUInt16(), fields[2].GetUInt8(), fields[3].GetUInt8()); + if(addActionButton(button, fields[1].GetUInt16(), fields[2].GetUInt8(), fields[3].GetUInt8())) + m_actionButtons[button].uState = ACTIONBUTTON_UNCHANGED; + else + { + sLog.outError( " ...at loading, and will deleted in DB also"); - m_actionButtons[button].uState = ACTIONBUTTON_UNCHANGED; + // Will deleted in DB at next save (it can create data until save but marked as deleted) + m_actionButtons[button].uState = ACTIONBUTTON_DELETED; + } } while( result->NextRow() ); diff --git a/src/game/Player.h b/src/game/Player.h index d224c5bd6..4bea09710 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1530,7 +1530,7 @@ class MANGOS_DLL_SPEC Player : public Unit m_cinematic = cine; } - void addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc); + bool addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc); void removeActionButton(uint8 button); void SendInitialActionButtons(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7349eca03..c71b496fa 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7451" + #define REVISION_NR "7452" #endif // __REVISION_NR_H__