Memory: Get rid of some memory leaks, converted FormationMgr back to singleton

This commit is contained in:
Subv
2012-03-25 09:25:28 -05:00
parent eda06321b9
commit 56fac5e1af
7 changed files with 38 additions and 29 deletions
+8 -4
View File
@@ -198,6 +198,12 @@ void GmTicket::TeleportTo(Player* player) const
// Ticket manager
TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(time(NULL)) { }
TicketMgr::~TicketMgr()
{
for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)
delete itr->second;
}
void TicketMgr::Initialize() { SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS)); }
void TicketMgr::ResetTickets()
@@ -217,10 +223,8 @@ void TicketMgr::LoadTickets()
{
uint32 oldMSTime = getMSTime();
if (!_ticketList.empty())
for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)
if (itr->second)
delete itr->second;
for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)
delete itr->second;
_ticketList.clear();
_lastTicketId = 0;
+1
View File
@@ -166,6 +166,7 @@ class TicketMgr
private:
TicketMgr();
~TicketMgr();
public:
void LoadTickets();