mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Misc: Remove boost::heap::fibonacci_heap from header files
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
#include "WorldSession.h"
|
||||
#include "WorldStateMgr.h"
|
||||
#include "WorldStatePackets.h"
|
||||
#include <boost/heap/fibonacci_heap.hpp>
|
||||
#include <sstream>
|
||||
|
||||
#include "Hacks/boost_1_74_fibonacci_heap.h"
|
||||
@@ -76,6 +77,17 @@ GridState* si_GridStates[MAX_GRID_STATE];
|
||||
ZoneDynamicInfo::ZoneDynamicInfo() : MusicId(0), DefaultWeather(nullptr), WeatherId(WEATHER_STATE_FINE),
|
||||
Intensity(0.0f) { }
|
||||
|
||||
struct RespawnInfoWithHandle;
|
||||
struct RespawnListContainer : boost::heap::fibonacci_heap<RespawnInfoWithHandle*, boost::heap::compare<CompareRespawnInfo>>
|
||||
{
|
||||
};
|
||||
struct RespawnInfoWithHandle : RespawnInfo
|
||||
{
|
||||
explicit RespawnInfoWithHandle(RespawnInfo const& other) : RespawnInfo(other) { }
|
||||
|
||||
RespawnListContainer::handle_type handle;
|
||||
};
|
||||
|
||||
Map::~Map()
|
||||
{
|
||||
// UnloadAll must be called before deleting the map
|
||||
@@ -134,7 +146,7 @@ m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE),
|
||||
m_VisibilityNotifyPeriod(DEFAULT_VISIBILITY_NOTIFY_PERIOD),
|
||||
m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()),
|
||||
i_gridExpiry(expiry), m_terrain(sTerrainMgr.LoadTerrain(id)),
|
||||
i_scriptLock(false), _respawnCheckTimer(0)
|
||||
i_scriptLock(false), _respawnTimes(std::make_unique<RespawnListContainer>()), _respawnCheckTimer(0)
|
||||
{
|
||||
for (uint32 x = 0; x < MAX_NUMBER_OF_GRIDS; ++x)
|
||||
{
|
||||
@@ -2011,7 +2023,7 @@ void Map::Respawn(RespawnInfo* info, CharacterDatabaseTransaction dbTrans)
|
||||
if (info->respawnTime <= GameTime::GetGameTime())
|
||||
return;
|
||||
info->respawnTime = GameTime::GetGameTime();
|
||||
_respawnTimes.increase(info->handle);
|
||||
_respawnTimes->increase(static_cast<RespawnInfoWithHandle*>(info)->handle);
|
||||
SaveRespawnInfoDB(*info, dbTrans);
|
||||
}
|
||||
|
||||
@@ -2067,8 +2079,8 @@ bool Map::AddRespawnInfo(RespawnInfo const& info)
|
||||
else
|
||||
ABORT_MSG("Invalid respawn info for spawn id (%u," UI64FMTD ") being inserted", uint32(info.type), info.spawnId);
|
||||
|
||||
RespawnInfo * ri = new RespawnInfo(info);
|
||||
ri->handle = _respawnTimes.push(ri);
|
||||
RespawnInfoWithHandle* ri = new RespawnInfoWithHandle(info);
|
||||
ri->handle = _respawnTimes->push(ri);
|
||||
bySpawnIdMap->emplace(ri->spawnId, ri);
|
||||
return true;
|
||||
}
|
||||
@@ -2101,9 +2113,9 @@ RespawnInfo* Map::GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawn
|
||||
|
||||
void Map::UnloadAllRespawnInfos() // delete everything from memory
|
||||
{
|
||||
for (RespawnInfo* info : _respawnTimes)
|
||||
for (RespawnInfo* info : *_respawnTimes)
|
||||
delete info;
|
||||
_respawnTimes.clear();
|
||||
_respawnTimes->clear();
|
||||
_creatureRespawnTimesBySpawnId.clear();
|
||||
_gameObjectRespawnTimesBySpawnId.clear();
|
||||
}
|
||||
@@ -2124,7 +2136,7 @@ void Map::DeleteRespawnInfo(RespawnInfo* info, CharacterDatabaseTransaction dbTr
|
||||
spawnMap->erase(it);
|
||||
|
||||
// respawn heap
|
||||
_respawnTimes.erase(info->handle);
|
||||
_respawnTimes->erase(static_cast<RespawnInfoWithHandle*>(info)->handle);
|
||||
|
||||
// database
|
||||
DeleteRespawnInfoFromDB(info->type, info->spawnId, dbTrans);
|
||||
@@ -2175,16 +2187,16 @@ void Map::DoRespawn(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 gr
|
||||
void Map::ProcessRespawns()
|
||||
{
|
||||
time_t now = GameTime::GetGameTime();
|
||||
while (!_respawnTimes.empty())
|
||||
while (!_respawnTimes->empty())
|
||||
{
|
||||
RespawnInfo* next = _respawnTimes.top();
|
||||
RespawnInfoWithHandle* next = _respawnTimes->top();
|
||||
if (now < next->respawnTime) // done for this tick
|
||||
break;
|
||||
|
||||
if (uint32 poolId = sPoolMgr->IsPartOfAPool(next->type, next->spawnId)) // is this part of a pool?
|
||||
{ // if yes, respawn will be handled by (external) pooling logic, just delete the respawn time
|
||||
// step 1: remove entry from maps to avoid it being reachable by outside logic
|
||||
_respawnTimes.pop();
|
||||
_respawnTimes->pop();
|
||||
ASSERT_NOTNULL(GetRespawnMapForType(next->type))->erase(next->spawnId);
|
||||
|
||||
// step 2: tell pooling logic to do its thing
|
||||
@@ -2197,7 +2209,7 @@ void Map::ProcessRespawns()
|
||||
else if (CheckRespawn(next)) // see if we're allowed to respawn
|
||||
{ // ok, respawn
|
||||
// step 1: remove entry from maps to avoid it being reachable by outside logic
|
||||
_respawnTimes.pop();
|
||||
_respawnTimes->pop();
|
||||
ASSERT_NOTNULL(GetRespawnMapForType(next->type))->erase(next->spawnId);
|
||||
|
||||
// step 2: do the respawn, which involves external logic
|
||||
@@ -2209,7 +2221,7 @@ void Map::ProcessRespawns()
|
||||
}
|
||||
else if (!next->respawnTime)
|
||||
{ // just remove this respawn entry without rescheduling
|
||||
_respawnTimes.pop();
|
||||
_respawnTimes->pop();
|
||||
ASSERT_NOTNULL(GetRespawnMapForType(next->type))->erase(next->spawnId);
|
||||
RemoveRespawnTime(next->type, next->spawnId, nullptr, true);
|
||||
delete next;
|
||||
@@ -2217,7 +2229,7 @@ void Map::ProcessRespawns()
|
||||
else
|
||||
{ // new respawn time, update heap position
|
||||
ASSERT(now < next->respawnTime); // infinite loop guard
|
||||
_respawnTimes.decrease(next->handle);
|
||||
_respawnTimes->decrease(next->handle);
|
||||
SaveRespawnInfoDB(*next);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user