aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/BattleGround.cpp17
-rw-r--r--src/game/BattleGround.h9
-rw-r--r--src/game/BattleGroundAB.cpp3
-rw-r--r--src/game/BattleGroundAV.cpp3
-rw-r--r--src/game/BattleGroundBE.cpp3
-rw-r--r--src/game/BattleGroundEY.cpp3
-rw-r--r--src/game/BattleGroundMgr.cpp2
-rw-r--r--src/game/BattleGroundSA.cpp3
-rw-r--r--src/game/BattleGroundWS.cpp3
-rw-r--r--src/game/Guild.cpp206
-rw-r--r--src/game/Guild.h4
-rw-r--r--src/game/ObjectAccessor.cpp6
-rw-r--r--src/game/ObjectMgr.cpp3
13 files changed, 118 insertions, 147 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 3f9aa26def7..0135968b4be 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -207,16 +207,13 @@ BattleGround::~BattleGround()
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
int size = m_BgCreatures.size();
for(int i = 0; i < size; ++i)
- {
DelCreature(i);
- }
+
size = m_BgObjects.size();
for(int i = 0; i < size; ++i)
- {
DelObject(i);
- }
- if(GetInstanceID()) // not spam by useless queries in case BG templates
+ if (GetInstanceID()) // not spam by useless queries in case BG templates
{
// delete creature and go respawn times
WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE instance = '%u'",GetInstanceID());
@@ -233,6 +230,9 @@ BattleGround::~BattleGround()
((BattleGroundMap*)map)->SetUnload();
// remove from bg free slot queue
this->RemoveFromBGFreeSlotQueue();
+
+ for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
+ delete itr->second;
}
void BattleGround::Update(uint32 diff)
@@ -967,7 +967,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
participant = true;
}
- std::map<uint64, BattleGroundScore*>::iterator itr2 = m_PlayerScores.find(guid);
+ BattleGroundScoreMap::iterator itr2 = m_PlayerScores.find(guid);
if (itr2 != m_PlayerScores.end())
{
delete itr2->second; // delete player's score
@@ -1109,6 +1109,9 @@ void BattleGround::Reset()
m_InBGFreeSlotQueue = false;
m_Players.clear();
+
+ for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
+ delete itr->second;
m_PlayerScores.clear();
ResetBGSubclass();
@@ -1348,7 +1351,7 @@ bool BattleGround::HasFreeSlots() const
void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
//this procedure is called from virtual function implemented in bg subclass
- std::map<uint64, BattleGroundScore*>::const_iterator itr = m_PlayerScores.find(Source->GetGUID());
+ BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
return;
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index 07f2643fd17..4ed660a3595 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -384,8 +384,9 @@ class BattleGround
BattleGroundPlayerMap const& GetPlayers() const { return m_Players; }
uint32 GetPlayersSize() const { return m_Players.size(); }
- std::map<uint64, BattleGroundScore*>::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); }
- std::map<uint64, BattleGroundScore*>::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); }
+ typedef std::map<uint64, BattleGroundScore*> BattleGroundScoreMap;
+ BattleGroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); }
+ BattleGroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); }
uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); }
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
@@ -530,8 +531,8 @@ class BattleGround
void PlayerAddedToBGCheckIfBGIsRunning(Player* plr);
/* Scorekeeping */
- // Player scores
- std::map<uint64, BattleGroundScore*> m_PlayerScores;
+
+ BattleGroundScoreMap m_PlayerScores; // Player scores
// must be implemented in BG subclass
virtual void RemovePlayer(Player * /*player*/, uint64 /*guid*/) {}
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index 0ed28112fe7..70709af42ad 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -674,8 +674,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
- std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
-
+ BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if( itr == m_PlayerScores.end() ) // player not found...
return;
diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp
index 0a1bf72d595..4778bdb2384 100644
--- a/src/game/BattleGroundAV.cpp
+++ b/src/game/BattleGroundAV.cpp
@@ -489,8 +489,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
{
- std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
-
+ BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
return;
diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp
index d58c2250948..05475328b01 100644
--- a/src/game/BattleGroundBE.cpp
+++ b/src/game/BattleGroundBE.cpp
@@ -182,8 +182,7 @@ bool BattleGroundBE::SetupBattleGround()
void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
{
- std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
-
+ BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
return;
diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp
index 39ef126d9e2..78654677230 100644
--- a/src/game/BattleGroundEY.cpp
+++ b/src/game/BattleGroundEY.cpp
@@ -788,8 +788,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
- std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
-
+ BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found
return;
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index 3e0a4f25314..d70aa52a018 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -1349,7 +1349,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
*data << (int32)(bg->GetPlayerScoresSize());
- for(std::map<uint64, BattleGroundScore*>::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
+ for(BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
{
*data << (uint64)itr->first;
*data << (int32)itr->second->KillingBlows;
diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp
index 5f20950070d..acf16ad3af0 100644
--- a/src/game/BattleGroundSA.cpp
+++ b/src/game/BattleGroundSA.cpp
@@ -72,8 +72,7 @@ void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
{
- std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
-
+ BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
return;
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp
index c4a2402ad67..81080284b9d 100644
--- a/src/game/BattleGroundWS.cpp
+++ b/src/game/BattleGroundWS.cpp
@@ -719,8 +719,7 @@ void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
- std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
-
+ BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found
return;
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp
index a7a5d8f5e23..7efc92c2fe0 100644
--- a/src/game/Guild.cpp
+++ b/src/game/Guild.cpp
@@ -826,17 +826,17 @@ void Guild::DisplayGuildEventlog(WorldSession *session)
for (GuildEventlog::const_iterator itr = m_GuildEventlog.begin(); itr != m_GuildEventlog.end(); ++itr)
{
// Event type
- data << uint8((*itr)->EventType);
+ data << uint8(itr->EventType);
// Player 1
- data << uint64((*itr)->PlayerGuid1);
+ data << uint64(itr->PlayerGuid1);
// Player 2 not for left/join guild events
- if( (*itr)->EventType != GUILD_EVENT_LOG_JOIN_GUILD && (*itr)->EventType != GUILD_EVENT_LOG_LEAVE_GUILD )
- data << uint64((*itr)->PlayerGuid2);
+ if (itr->EventType != GUILD_EVENT_LOG_JOIN_GUILD && itr->EventType != GUILD_EVENT_LOG_LEAVE_GUILD)
+ data << uint64(itr->PlayerGuid2);
// New Rank - only for promote/demote guild events
- if( (*itr)->EventType == GUILD_EVENT_LOG_PROMOTE_PLAYER || (*itr)->EventType == GUILD_EVENT_LOG_DEMOTE_PLAYER )
- data << uint8((*itr)->NewRank);
+ if (itr->EventType == GUILD_EVENT_LOG_PROMOTE_PLAYER || itr->EventType == GUILD_EVENT_LOG_DEMOTE_PLAYER)
+ data << uint8(itr->NewRank);
// Event timestamp
- data << uint32(time(NULL)-(*itr)->TimeStamp);
+ data << uint32(time(NULL)-itr->TimeStamp);
}
session->SendPacket(&data);
sLog.outDebug("WORLD: Sent (MSG_GUILD_EVENT_LOG_QUERY)");
@@ -855,14 +855,14 @@ void Guild::LoadGuildEventLogFromDB()
do
{
Field *fields = result->Fetch();
- GuildEventlogEntry *NewEvent = new GuildEventlogEntry;
+ GuildEventlogEntry NewEvent;
// Fill entry
- NewEvent->LogGuid = fields[0].GetUInt32();
- NewEvent->EventType = fields[1].GetUInt8();
- NewEvent->PlayerGuid1 = fields[2].GetUInt32();
- NewEvent->PlayerGuid2 = fields[3].GetUInt32();
- NewEvent->NewRank = fields[4].GetUInt8();
- NewEvent->TimeStamp = fields[5].GetUInt64();
+ NewEvent.LogGuid = fields[0].GetUInt32();
+ NewEvent.EventType = fields[1].GetUInt8();
+ NewEvent.PlayerGuid1 = fields[2].GetUInt32();
+ NewEvent.PlayerGuid2 = fields[3].GetUInt32();
+ NewEvent.NewRank = fields[4].GetUInt8();
+ NewEvent.TimeStamp = fields[5].GetUInt64();
// Add entry to map
m_GuildEventlog.push_front(NewEvent);
@@ -872,9 +872,8 @@ void Guild::LoadGuildEventLogFromDB()
// Check lists size in case to many event entries in db
// This cases can happen only if a crash occured somewhere and table has too many log entries
if (!m_GuildEventlog.empty())
- {
- CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid=%u AND LogGuid < %u", Id, m_GuildEventlog.front()->LogGuid);
- }
+ CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid=%u AND LogGuid < %u", Id, m_GuildEventlog.front().LogGuid);
+
m_eventlogloaded = true;
}
@@ -883,16 +882,8 @@ void Guild::UnloadGuildEventlog()
{
if (!m_eventlogloaded)
return;
- GuildEventlogEntry *EventLogEntry;
- if( !m_GuildEventlog.empty() )
- {
- do
- {
- EventLogEntry = *(m_GuildEventlog.begin());
- m_GuildEventlog.pop_front();
- delete EventLogEntry;
- }while( !m_GuildEventlog.empty() );
- }
+
+ m_GuildEventlog.clear();
m_eventlogloaded = false;
}
@@ -912,27 +903,25 @@ void Guild::RenumGuildEventlog()
// Add entry to guild eventlog
void Guild::LogGuildEvent(uint8 EventType, uint32 PlayerGuid1, uint32 PlayerGuid2, uint8 NewRank)
{
- GuildEventlogEntry *NewEvent = new GuildEventlogEntry;
+ GuildEventlogEntry NewEvent;
// Fill entry
- NewEvent->LogGuid = GuildEventlogMaxGuid++;
- NewEvent->EventType = EventType;
- NewEvent->PlayerGuid1 = PlayerGuid1;
- NewEvent->PlayerGuid2 = PlayerGuid2;
- NewEvent->NewRank = NewRank;
- NewEvent->TimeStamp = uint32(time(NULL));
+ NewEvent.LogGuid = GuildEventlogMaxGuid++;
+ NewEvent.EventType = EventType;
+ NewEvent.PlayerGuid1 = PlayerGuid1;
+ NewEvent.PlayerGuid2 = PlayerGuid2;
+ NewEvent.NewRank = NewRank;
+ NewEvent.TimeStamp = uint32(time(NULL));
// Check max entry limit and delete from db if needed
if (m_GuildEventlog.size() > GUILD_EVENTLOG_MAX_ENTRIES)
{
- GuildEventlogEntry *OldEvent = *(m_GuildEventlog.begin());
+ CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid='%u' AND LogGuid='%u'", Id, m_GuildEventlog.front().LogGuid);
m_GuildEventlog.pop_front();
- CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid='%u' AND LogGuid='%u'", Id, OldEvent->LogGuid);
- delete OldEvent;
}
// Add entry to map
m_GuildEventlog.push_back(NewEvent);
// Add new eventlog entry into DB
CharacterDatabase.PExecute("INSERT INTO guild_eventlog (guildid, LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "')",
- Id, NewEvent->LogGuid, uint32(NewEvent->EventType), NewEvent->PlayerGuid1, NewEvent->PlayerGuid2, uint32(NewEvent->NewRank), NewEvent->TimeStamp);
+ Id, NewEvent.LogGuid, uint32(NewEvent.EventType), NewEvent.PlayerGuid1, NewEvent.PlayerGuid2, uint32(NewEvent.NewRank), NewEvent.TimeStamp);
}
// *************************************************
@@ -1504,30 +1493,28 @@ void Guild::LoadGuildBankEventLogFromDB()
do
{
Field *fields = result->Fetch();
- GuildBankEvent *NewEvent = new GuildBankEvent;
+ GuildBankEvent NewEvent;
- NewEvent->LogGuid = fields[0].GetUInt32();
- NewEvent->LogEntry = fields[1].GetUInt8();
+ NewEvent.LogGuid = fields[0].GetUInt32();
+ NewEvent.LogEntry = fields[1].GetUInt8();
uint8 TabId = fields[2].GetUInt8();
- NewEvent->PlayerGuid = fields[3].GetUInt32();
- NewEvent->ItemOrMoney = fields[4].GetUInt32();
- NewEvent->ItemStackCount = fields[5].GetUInt8();
- NewEvent->DestTabId = fields[6].GetUInt8();
- NewEvent->TimeStamp = fields[7].GetUInt64();
+ NewEvent.PlayerGuid = fields[3].GetUInt32();
+ NewEvent.ItemOrMoney = fields[4].GetUInt32();
+ NewEvent.ItemStackCount = fields[5].GetUInt8();
+ NewEvent.DestTabId = fields[6].GetUInt8();
+ NewEvent.TimeStamp = fields[7].GetUInt64();
if (TabId >= GUILD_BANK_MAX_TABS)
{
- sLog.outError( "Guild::LoadGuildBankEventLogFromDB: Invalid tabid '%u' for guild bank log entry (guild: '%s', LogGuid: %u), skipped.", TabId, GetName().c_str(), NewEvent->LogGuid);
- delete NewEvent;
+ sLog.outError( "Guild::LoadGuildBankEventLogFromDB: Invalid tabid '%u' for guild bank log entry (guild: '%s', LogGuid: %u), skipped.", TabId, GetName().c_str(), NewEvent.LogGuid);
continue;
}
- if (NewEvent->isMoneyEvent() && m_GuildBankEventLog_Money.size() >= GUILD_BANK_MAX_LOGS
- || m_GuildBankEventLog_Item[TabId].size() >= GUILD_BANK_MAX_LOGS)
- {
- delete NewEvent;
+
+ if (NewEvent.isMoneyEvent() && m_GuildBankEventLog_Money.size() >= GUILD_BANK_MAX_LOGS ||
+ m_GuildBankEventLog_Item[TabId].size() >= GUILD_BANK_MAX_LOGS)
continue;
- }
- if (NewEvent->isMoneyEvent())
+
+ if (NewEvent.isMoneyEvent())
m_GuildBankEventLog_Money.push_front(NewEvent);
else
m_GuildBankEventLog_Item[TabId].push_front(NewEvent);
@@ -1540,43 +1527,24 @@ void Guild::LoadGuildBankEventLogFromDB()
if (!m_GuildBankEventLog_Money.empty())
{
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid=%u AND LogGuid < %u",
- Id, m_GuildBankEventLog_Money.front()->LogGuid);
+ Id, m_GuildBankEventLog_Money.front().LogGuid);
}
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
if (!m_GuildBankEventLog_Item[i].empty())
{
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid=%u AND LogGuid < %u",
- Id, m_GuildBankEventLog_Item[i].front()->LogGuid);
+ Id, m_GuildBankEventLog_Item[i].front().LogGuid);
}
}
}
void Guild::UnloadGuildBankEventLog()
{
- GuildBankEvent *EventLogEntry;
- if( !m_GuildBankEventLog_Money.empty() )
- {
- do
- {
- EventLogEntry = *(m_GuildBankEventLog_Money.begin());
- m_GuildBankEventLog_Money.pop_front();
- delete EventLogEntry;
- }while( !m_GuildBankEventLog_Money.empty() );
- }
+ m_GuildBankEventLog_Money.clear();
- for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
- {
- if( !m_GuildBankEventLog_Item[i].empty() )
- {
- do
- {
- EventLogEntry = *(m_GuildBankEventLog_Item[i].begin());
- m_GuildBankEventLog_Item[i].pop_front();
- delete EventLogEntry;
- }while( !m_GuildBankEventLog_Item[i].empty() );
- }
- }
+ for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ m_GuildBankEventLog_Item[i].clear();
}
void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
@@ -1592,24 +1560,24 @@ void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
data << uint8(m_GuildBankEventLog_Money.size()); // number of log entries
for (GuildBankEventLog::const_iterator itr = m_GuildBankEventLog_Money.begin(); itr != m_GuildBankEventLog_Money.end(); ++itr)
{
- data << uint8((*itr)->LogEntry);
- data << uint64(MAKE_NEW_GUID((*itr)->PlayerGuid,0,HIGHGUID_PLAYER));
- if ((*itr)->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
- (*itr)->LogEntry == GUILD_BANK_LOG_WITHDRAW_MONEY ||
- (*itr)->LogEntry == GUILD_BANK_LOG_REPAIR_MONEY ||
- (*itr)->LogEntry == GUILD_BANK_LOG_UNK1 ||
- (*itr)->LogEntry == GUILD_BANK_LOG_UNK2)
+ data << uint8(itr->LogEntry);
+ data << uint64(MAKE_NEW_GUID(itr->PlayerGuid,0,HIGHGUID_PLAYER));
+ if (itr->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
+ itr->LogEntry == GUILD_BANK_LOG_WITHDRAW_MONEY ||
+ itr->LogEntry == GUILD_BANK_LOG_REPAIR_MONEY ||
+ itr->LogEntry == GUILD_BANK_LOG_UNK1 ||
+ itr->LogEntry == GUILD_BANK_LOG_UNK2)
{
- data << uint32((*itr)->ItemOrMoney);
+ data << uint32(itr->ItemOrMoney);
}
else
{
- data << uint32((*itr)->ItemOrMoney);
- data << uint32((*itr)->ItemStackCount);
- if ((*itr)->LogEntry == GUILD_BANK_LOG_MOVE_ITEM || (*itr)->LogEntry == GUILD_BANK_LOG_MOVE_ITEM2)
- data << uint8((*itr)->DestTabId); // moved tab
+ data << uint32(itr->ItemOrMoney);
+ data << uint32(itr->ItemStackCount);
+ if (itr->LogEntry == GUILD_BANK_LOG_MOVE_ITEM || itr->LogEntry == GUILD_BANK_LOG_MOVE_ITEM2)
+ data << uint8(itr->DestTabId); // moved tab
}
- data << uint32(time(NULL)-(*itr)->TimeStamp);
+ data << uint32(time(NULL) - itr->TimeStamp);
}
session->SendPacket(&data);
}
@@ -1622,24 +1590,24 @@ void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
data << uint8(m_GuildBankEventLog_Item[TabId].size());
for (GuildBankEventLog::const_iterator itr = m_GuildBankEventLog_Item[TabId].begin(); itr != m_GuildBankEventLog_Item[TabId].end(); ++itr)
{
- data << uint8((*itr)->LogEntry);
- data << uint64(MAKE_NEW_GUID((*itr)->PlayerGuid,0,HIGHGUID_PLAYER));
- if ((*itr)->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
- (*itr)->LogEntry == GUILD_BANK_LOG_WITHDRAW_MONEY ||
- (*itr)->LogEntry == GUILD_BANK_LOG_REPAIR_MONEY ||
- (*itr)->LogEntry == GUILD_BANK_LOG_UNK1 ||
- (*itr)->LogEntry == GUILD_BANK_LOG_UNK2)
+ data << uint8(itr->LogEntry);
+ data << uint64(MAKE_NEW_GUID(itr->PlayerGuid,0,HIGHGUID_PLAYER));
+ if (itr->LogEntry == GUILD_BANK_LOG_DEPOSIT_MONEY ||
+ itr->LogEntry == GUILD_BANK_LOG_WITHDRAW_MONEY ||
+ itr->LogEntry == GUILD_BANK_LOG_REPAIR_MONEY ||
+ itr->LogEntry == GUILD_BANK_LOG_UNK1 ||
+ itr->LogEntry == GUILD_BANK_LOG_UNK2)
{
- data << uint32((*itr)->ItemOrMoney);
+ data << uint32(itr->ItemOrMoney);
}
else
{
- data << uint32((*itr)->ItemOrMoney);
- data << uint32((*itr)->ItemStackCount);
- if ((*itr)->LogEntry == GUILD_BANK_LOG_MOVE_ITEM || (*itr)->LogEntry == GUILD_BANK_LOG_MOVE_ITEM2)
- data << uint8((*itr)->DestTabId); // moved tab
+ data << uint32(itr->ItemOrMoney);
+ data << uint32(itr->ItemStackCount);
+ if (itr->LogEntry == GUILD_BANK_LOG_MOVE_ITEM || itr->LogEntry == GUILD_BANK_LOG_MOVE_ITEM2)
+ data << uint8(itr->DestTabId); // moved tab
}
- data << uint32(time(NULL)-(*itr)->TimeStamp);
+ data << uint32(time(NULL) - itr->TimeStamp);
}
session->SendPacket(&data);
}
@@ -1648,24 +1616,23 @@ void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
void Guild::LogBankEvent(uint8 LogEntry, uint8 TabId, uint32 PlayerGuidLow, uint32 ItemOrMoney, uint8 ItemStackCount, uint8 DestTabId)
{
- GuildBankEvent *NewEvent = new GuildBankEvent;
+ GuildBankEvent NewEvent;
- NewEvent->LogGuid = LogMaxGuid++;
- NewEvent->LogEntry = LogEntry;
- NewEvent->PlayerGuid = PlayerGuidLow;
- NewEvent->ItemOrMoney = ItemOrMoney;
- NewEvent->ItemStackCount = ItemStackCount;
- NewEvent->DestTabId = DestTabId;
- NewEvent->TimeStamp = uint32(time(NULL));
+ NewEvent.LogGuid = LogMaxGuid++;
+ NewEvent.LogEntry = LogEntry;
+ NewEvent.PlayerGuid = PlayerGuidLow;
+ NewEvent.ItemOrMoney = ItemOrMoney;
+ NewEvent.ItemStackCount = ItemStackCount;
+ NewEvent.DestTabId = DestTabId;
+ NewEvent.TimeStamp = uint32(time(NULL));
- if (NewEvent->isMoneyEvent())
+ if (NewEvent.isMoneyEvent())
{
if (m_GuildBankEventLog_Money.size() > GUILD_BANK_MAX_LOGS)
{
- GuildBankEvent *OldEvent = *(m_GuildBankEventLog_Money.begin());
+ CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid='%u' AND LogGuid='%u'",
+ Id, m_GuildBankEventLog_Money.front().LogGuid);
m_GuildBankEventLog_Money.pop_front();
- CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid='%u' AND LogGuid='%u'", Id, OldEvent->LogGuid);
- delete OldEvent;
}
m_GuildBankEventLog_Money.push_back(NewEvent);
}
@@ -1673,15 +1640,14 @@ void Guild::LogBankEvent(uint8 LogEntry, uint8 TabId, uint32 PlayerGuidLow, uint
{
if (m_GuildBankEventLog_Item[TabId].size() > GUILD_BANK_MAX_LOGS)
{
- GuildBankEvent *OldEvent = *(m_GuildBankEventLog_Item[TabId].begin());
+ CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid='%u' AND LogGuid='%u'",
+ Id, m_GuildBankEventLog_Item[TabId].front().LogGuid);
m_GuildBankEventLog_Item[TabId].pop_front();
- CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid='%u' AND LogGuid='%u'", Id, OldEvent->LogGuid);
- delete OldEvent;
}
m_GuildBankEventLog_Item[TabId].push_back(NewEvent);
}
CharacterDatabase.PExecute("INSERT INTO guild_bank_eventlog (guildid,LogGuid,LogEntry,TabId,PlayerGuid,ItemOrMoney,ItemStackCount,DestTabId,TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "')",
- Id, NewEvent->LogGuid, uint32(NewEvent->LogEntry), uint32(TabId), NewEvent->PlayerGuid, NewEvent->ItemOrMoney, uint32(NewEvent->ItemStackCount), uint32(NewEvent->DestTabId), NewEvent->TimeStamp);
+ Id, NewEvent.LogGuid, uint32(NewEvent.LogEntry), uint32(TabId), NewEvent.PlayerGuid, NewEvent.ItemOrMoney, uint32(NewEvent.ItemStackCount), uint32(NewEvent.DestTabId), NewEvent.TimeStamp);
}
// This will renum guids used at load to prevent always going up until infinit
diff --git a/src/game/Guild.h b/src/game/Guild.h
index 9f832260f14..6e2441416c6 100644
--- a/src/game/Guild.h
+++ b/src/game/Guild.h
@@ -460,8 +460,8 @@ class Guild
TabListMap m_TabListMap;
/** These are actually ordered lists. The first element is the oldest entry.*/
- typedef std::list<GuildEventlogEntry*> GuildEventlog;
- typedef std::list<GuildBankEvent*> GuildBankEventLog;
+ typedef std::list<GuildEventlogEntry> GuildEventlog;
+ typedef std::list<GuildBankEvent> GuildBankEventLog;
GuildEventlog m_GuildEventlog;
GuildBankEventLog m_GuildBankEventLog_Money;
GuildBankEventLog m_GuildBankEventLog_Item[GUILD_BANK_MAX_TABS];
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index cd58d564106..43d3d0a1534 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -46,7 +46,11 @@ INSTANTIATE_SINGLETON_2(ObjectAccessor, CLASS_LOCK);
INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ACE_Thread_Mutex);
ObjectAccessor::ObjectAccessor() {}
-ObjectAccessor::~ObjectAccessor() {}
+ObjectAccessor::~ObjectAccessor()
+{
+ for(Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
+ delete itr->second;
+}
Creature*
ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 29f75fe6325..ec300715f86 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -178,6 +178,9 @@ ObjectMgr::~ObjectMgr()
for (CachePlayerInfoMap::iterator itr = m_mPlayerInfoMap.begin(); itr != m_mPlayerInfoMap.end(); ++itr)
delete itr->second;
+ for (ArenaTeamMap::iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
+ delete itr->second;
+
for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr)
itr->second.Clear();