Removed useless code. Mail loading triggered at login by client anyway.

This commit is contained in:
tomrus88 2009-12-18 00:10:48 +03:00
parent 57126880cf
commit 7d285c5ed4
4 changed files with 31 additions and 50 deletions

View file

@ -513,10 +513,6 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return; return;
// load players mails, and mailed items
if(!_player->m_mailsLoaded)
_player->_LoadMail();
// client can't work with packets > max int16 value // client can't work with packets > max int16 value
const uint32 maxPacketSize = 32767; const uint32 maxPacketSize = 32767;
@ -728,9 +724,6 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ )
{ {
WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8); WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8);
if(!_player->m_mailsLoaded)
_player->_LoadMail();
if( _player->unReadMails > 0 ) if( _player->unReadMails > 0 )
{ {
data << uint32(0); // float data << uint32(0); // float
@ -957,8 +950,6 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
{ {
pReceiver->AddNewMailDeliverTime(deliver_time); pReceiver->AddNewMailDeliverTime(deliver_time);
if (pReceiver->IsMailsLoaded())
{
Mail *m = new Mail; Mail *m = new Mail;
m->messageID = mailId; m->messageID = mailId;
m->mailTemplateId = GetMailTemplateId(); m->mailTemplateId = GetMailTemplateId();
@ -992,7 +983,4 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
} }
else if (!m_items.empty()) else if (!m_items.empty())
deleteIncludedItems(); deleteIncludedItems();
}
else if (!m_items.empty())
deleteIncludedItems();
} }

View file

@ -4810,7 +4810,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
Player *pl = 0; Player *pl = 0;
if (serverUp) if (serverUp)
pl = GetPlayer((uint64)m->receiver); pl = GetPlayer((uint64)m->receiver);
if (pl && pl->m_mailsLoaded) if (pl)
{ //this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail { //this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
//his in mailbox and he has already listed his mails ) //his in mailbox and he has already listed his mails )
delete m; delete m;

View file

@ -412,7 +412,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
rest_type=REST_TYPE_NO; rest_type=REST_TYPE_NO;
////////////////////Rest System///////////////////// ////////////////////Rest System/////////////////////
m_mailsLoaded = false;
m_mailsUpdated = false; m_mailsUpdated = false;
unReadMails = 0; unReadMails = 0;
m_nextMailDelivereTime = 0; m_nextMailDelivereTime = 0;
@ -14891,8 +14890,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods() // apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
//mails are loaded only when needed ;-) - when player in game click on mailbox. // Mail
//_LoadMail(); _LoadMail();
_LoadAuras(holder->GetResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff); _LoadAuras(holder->GetResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff);
_LoadGlyphAuras(); _LoadGlyphAuras();
@ -15514,7 +15513,6 @@ void Player::_LoadMail()
} while( result->NextRow() ); } while( result->NextRow() );
delete result; delete result;
} }
m_mailsLoaded = true;
} }
void Player::LoadPet() void Player::LoadPet()
@ -16333,9 +16331,6 @@ void Player::_SaveInventory()
void Player::_SaveMail() void Player::_SaveMail()
{ {
if (!m_mailsLoaded)
return;
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
{ {
Mail *m = (*itr); Mail *m = (*itr);

View file

@ -1455,7 +1455,6 @@ class MANGOS_DLL_SPEC Player : public Unit
static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair); static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
static void SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid); static void SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid);
bool m_mailsLoaded;
bool m_mailsUpdated; bool m_mailsUpdated;
void SendPetTameFailure(PetTameFailureReason reason); void SendPetTameFailure(PetTameFailureReason reason);
@ -1506,7 +1505,6 @@ class MANGOS_DLL_SPEC Player : public Unit
void SendNewMail(); void SendNewMail();
void UpdateNextMailTimeAndUnreads(); void UpdateNextMailTimeAndUnreads();
void AddNewMailDeliverTime(time_t deliver_time); void AddNewMailDeliverTime(time_t deliver_time);
bool IsMailsLoaded() const { return m_mailsLoaded; }
void RemoveMail(uint32 id); void RemoveMail(uint32 id);