[7452] Drop from DB broken action button data detected at loading.

This commit is contained in:
VladimirMangos 2009-03-13 20:22:47 +03:00
parent 037840d5ba
commit 4e4db62da3
3 changed files with 15 additions and 8 deletions

View file

@ -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() );

View file

@ -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();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7451"
#define REVISION_NR "7452"
#endif // __REVISION_NR_H__