diff options
author | n0n4m3 <none@none> | 2009-12-23 08:04:10 +0100 |
---|---|---|
committer | n0n4m3 <none@none> | 2009-12-23 08:04:10 +0100 |
commit | 3fe0bc52541d8cdf4fa992d9b8b3101cde5848f0 (patch) | |
tree | be5871dc19f69f4555d9ffa7c57e5d964b8e60e0 /src/game/Mail.cpp | |
parent | 7ea2510980d4b1c96f0341e9c8b9d5784862dc72 (diff) |
Replaced time(NULL) on sGameTime.GetGameTime() this is used for better performance.
Original Timer.h divided into 2 parts. Shared project has no need to know about GameTime Singleton.
2 Identical structures with different types are now replaced with one generic templated structure and 2 typedefs.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Mail.cpp')
-rw-r--r-- | src/game/Mail.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 961a12332e9..d4c4d574591 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -34,6 +34,7 @@ #include "BattleGroundMgr.h" #include "Item.h" #include "AuctionHouseMgr.h" +#include "TimeMgr.h" enum MailShowFlags { @@ -283,7 +284,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) if (pl->unReadMails) --pl->unReadMails; m->checked = m->checked | MAIL_CHECK_MASK_READ; - // m->expire_time = time(NULL) + (30 * DAY); // Expire time do not change at reading mail + // m->expire_time = sGameTime.GetGameTime() + (30 * DAY); // Expire time do not change at reading mail pl->m_mailsUpdated = true; m->state = MAIL_STATE_CHANGED; } @@ -331,7 +332,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data ) Player *pl = _player; Mail *m = pl->GetMail(mailId); - if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) + if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > sGameTime.GetGameTime()) { pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR); return; @@ -393,7 +394,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) Player* pl = _player; Mail* m = pl->GetMail(mailId); - if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) + if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > sGameTime.GetGameTime()) { pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR); return; @@ -486,7 +487,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data ) Player *pl = _player; Mail* m = pl->GetMail(mailId); - if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) + if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > sGameTime.GetGameTime()) { pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR); return; @@ -530,7 +531,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size data << uint32(0); // real mail's count data << uint8(0); // mail's count - time_t cur_time = time(NULL); + time_t cur_time = sGameTime.GetGameTime(); for (PlayerMails::iterator itr = pl->GetMailBegin(); itr != pl->GetMailEnd(); ++itr) { @@ -588,7 +589,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) data << uint32((*itr)->stationery); // stationery (Stationery.dbc) data << uint32((*itr)->money); // Gold data << uint32(show_flags); // unknown, 0x4 - auction, 0x10 - normal - data << float(((*itr)->expire_time-time(NULL))/DAY); // Time + data << float(((*itr)->expire_time-sGameTime.GetGameTime())/DAY); // Time data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc) data << (*itr)->subject; // Subject string - once 00, when mail type = 3 data << uint8(item_count); // client limit is 0x10 @@ -674,7 +675,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) Player *pl = _player; Mail* m = pl->GetMail(mailId); - if (!m || !m->itemTextId && !m->mailTemplateId || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) + if (!m || !m->itemTextId && !m->mailTemplateId || m->state == MAIL_STATE_DELETED || m->deliver_time > sGameTime.GetGameTime()) { pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR); return; @@ -740,7 +741,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ ) data << uint32(0); // count uint32 count = 0; - time_t now = time(NULL); + time_t now = sGameTime.GetGameTime(); for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr) { Mail *m = (*itr); @@ -929,7 +930,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende return; } - time_t deliver_time = time(NULL) + deliver_delay; + time_t deliver_time = sGameTime.GetGameTime() + deliver_delay; //expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour uint32 expire_delay; |