mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 03:42:37 +01:00
Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources
This commit is contained in:
@@ -18,17 +18,23 @@
|
||||
|
||||
#include "Map.h"
|
||||
#include "Battleground.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "CellImpl.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "DynamicTree.h"
|
||||
#include "GameObjectModel.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "GridStates.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Log.h"
|
||||
#include "MapInstanced.h"
|
||||
#include "MapManager.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectGridLoader.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "PhasingHandler.h"
|
||||
@@ -36,6 +42,7 @@
|
||||
#include "Transport.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "World.h"
|
||||
|
||||
u_map_magic MapMagic = { {'M','A','P','S'} };
|
||||
u_map_magic MapVersionMagic = { {'v','1','.','6'} };
|
||||
@@ -391,7 +398,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
|
||||
}
|
||||
|
||||
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
|
||||
ASSERT(ngrid != NULL);
|
||||
ASSERT(ngrid != nullptr);
|
||||
|
||||
GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
||||
|
||||
@@ -436,7 +443,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on)
|
||||
}
|
||||
|
||||
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
|
||||
ASSERT(ngrid != NULL);
|
||||
ASSERT(ngrid != nullptr);
|
||||
|
||||
GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
||||
|
||||
@@ -512,7 +519,7 @@ void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object)
|
||||
{
|
||||
EnsureGridLoaded(cell);
|
||||
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
|
||||
ASSERT(grid != NULL);
|
||||
ASSERT(grid != nullptr);
|
||||
|
||||
// refresh grid state & timer
|
||||
if (grid->GetGridState() != GRID_STATE_ACTIVE)
|
||||
@@ -529,7 +536,7 @@ bool Map::EnsureGridLoaded(const Cell &cell)
|
||||
EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
|
||||
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
|
||||
|
||||
ASSERT(grid != NULL);
|
||||
ASSERT(grid != nullptr);
|
||||
if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
||||
{
|
||||
TC_LOG_DEBUG("maps", "Loading grid[%u, %u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId);
|
||||
@@ -715,7 +722,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj
|
||||
}
|
||||
}
|
||||
|
||||
void Map::Update(const uint32 t_diff)
|
||||
void Map::Update(uint32 t_diff)
|
||||
{
|
||||
_dynamicTree.update(t_diff);
|
||||
/// update worldsessions for existing players
|
||||
@@ -832,7 +839,7 @@ struct ResetNotifier
|
||||
void Visit(PlayerMapType &m) { resetNotify<Player>(m);}
|
||||
};
|
||||
|
||||
void Map::ProcessRelocationNotifies(const uint32 diff)
|
||||
void Map::ProcessRelocationNotifies(uint32 diff)
|
||||
{
|
||||
for (GridRefManager<NGridType>::iterator i = GridRefManager<NGridType>::begin(); i != GridRefManager<NGridType>::end(); ++i)
|
||||
{
|
||||
@@ -1630,7 +1637,7 @@ bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll)
|
||||
ASSERT(i_objectsToRemove.empty());
|
||||
|
||||
delete &ngrid;
|
||||
setNGrid(NULL, x, y);
|
||||
setNGrid(nullptr, x, y);
|
||||
}
|
||||
int gx = (MAX_NUMBER_OF_GRIDS - 1) - x;
|
||||
int gy = (MAX_NUMBER_OF_GRIDS - 1) - y;
|
||||
@@ -1739,7 +1746,7 @@ GridMap::~GridMap()
|
||||
unloadData();
|
||||
}
|
||||
|
||||
bool GridMap::loadData(const char* filename)
|
||||
bool GridMap::loadData(char const* filename)
|
||||
{
|
||||
// Unload old data if exist
|
||||
unloadData();
|
||||
@@ -2791,7 +2798,7 @@ void Map::SendInitSelf(Player* player)
|
||||
|
||||
WorldPacket packet;
|
||||
data.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
|
||||
void Map::SendInitTransports(Player* player)
|
||||
@@ -2809,7 +2816,7 @@ void Map::SendInitTransports(Player* player)
|
||||
|
||||
WorldPacket packet;
|
||||
transData.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
|
||||
void Map::SendRemoveTransports(Player* player)
|
||||
@@ -2827,7 +2834,7 @@ void Map::SendRemoveTransports(Player* player)
|
||||
|
||||
WorldPacket packet;
|
||||
transData.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
|
||||
void Map::SendUpdateTransportVisibility(Player* player)
|
||||
@@ -2854,7 +2861,7 @@ void Map::SendUpdateTransportVisibility(Player* player)
|
||||
|
||||
WorldPacket packet;
|
||||
transData.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
|
||||
inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y)
|
||||
@@ -2889,7 +2896,7 @@ void Map::SendObjectUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
void Map::DelayedUpdate(const uint32 t_diff)
|
||||
void Map::DelayedUpdate(uint32 t_diff)
|
||||
{
|
||||
for (_transportsUpdateIter = _transports.begin(); _transportsUpdateIter != _transports.end();)
|
||||
{
|
||||
@@ -3032,7 +3039,7 @@ uint32 Map::GetPlayersCountExceptGMs() const
|
||||
void Map::SendToPlayers(WorldPacket* data) const
|
||||
{
|
||||
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||
itr->GetSource()->GetSession()->SendPacket(data);
|
||||
itr->GetSource()->SendDirectMessage(data);
|
||||
}
|
||||
|
||||
bool Map::ActiveObjectsNearGrid(NGridType const& ngrid) const
|
||||
@@ -3154,7 +3161,7 @@ template TC_GAME_API void Map::RemoveFromMap(AreaTrigger*, bool);
|
||||
InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _parent)
|
||||
: Map(id, expiry, InstanceId, SpawnMode, _parent),
|
||||
m_resetAfterUnload(false), m_unloadWhenEmpty(false),
|
||||
i_data(NULL), i_script_id(0)
|
||||
i_data(nullptr), i_script_id(0)
|
||||
{
|
||||
//lets initialize visibility distance for dungeons
|
||||
InstanceMap::InitVisibilityDistance();
|
||||
@@ -3167,7 +3174,7 @@ InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 Spaw
|
||||
InstanceMap::~InstanceMap()
|
||||
{
|
||||
delete i_data;
|
||||
i_data = NULL;
|
||||
i_data = nullptr;
|
||||
}
|
||||
|
||||
void InstanceMap::InitVisibilityDistance()
|
||||
@@ -3286,7 +3293,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
if (groupBind->save)
|
||||
TC_LOG_ERROR("maps", "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
|
||||
else
|
||||
TC_LOG_ERROR("maps", "GroupBind save NULL");
|
||||
TC_LOG_ERROR("maps", "GroupBind save nullptr");
|
||||
return false;
|
||||
}
|
||||
// if the group/leader is permanently bound to the instance
|
||||
@@ -3298,7 +3305,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
data << uint32(i_data ? i_data->GetCompletedEncounterMask() : 0);
|
||||
data << uint8(0);
|
||||
data << uint8(0); // events it throws: 1 : INSTANCE_LOCK_WARNING 0 : INSTANCE_LOCK_STOP / INSTANCE_LOCK_START
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
player->SetPendingBind(mapSave->GetInstanceId(), 60000);
|
||||
}
|
||||
}
|
||||
@@ -3335,7 +3342,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
return true;
|
||||
}
|
||||
|
||||
void InstanceMap::Update(const uint32 t_diff)
|
||||
void InstanceMap::Update(uint32 t_diff)
|
||||
{
|
||||
Map::Update(t_diff);
|
||||
|
||||
@@ -3360,7 +3367,7 @@ void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)
|
||||
|
||||
void InstanceMap::CreateInstanceData(bool load)
|
||||
{
|
||||
if (i_data != NULL)
|
||||
if (i_data != nullptr)
|
||||
return;
|
||||
|
||||
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
|
||||
@@ -3451,6 +3458,11 @@ bool InstanceMap::Reset(uint8 method)
|
||||
return m_mapRefManager.isEmpty();
|
||||
}
|
||||
|
||||
std::string const& InstanceMap::GetScriptName() const
|
||||
{
|
||||
return sObjectMgr->GetScriptName(i_script_id);
|
||||
}
|
||||
|
||||
void InstanceMap::PermBindAllPlayers()
|
||||
{
|
||||
if (!IsDungeon())
|
||||
@@ -3488,7 +3500,7 @@ void InstanceMap::PermBindAllPlayers()
|
||||
player->BindToInstance(save, true);
|
||||
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
|
||||
data << uint32(0);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
player->GetSession()->SendCalendarRaidLockout(save, true);
|
||||
|
||||
// if group leader is in instance, group also gets bound
|
||||
@@ -3538,6 +3550,74 @@ MapDifficulty const* Map::GetMapDifficulty() const
|
||||
return GetMapDifficultyData(GetId(), GetDifficulty());
|
||||
}
|
||||
|
||||
bool Map::Instanceable() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->Instanceable();
|
||||
}
|
||||
|
||||
bool Map::IsDungeon() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsDungeon();
|
||||
}
|
||||
|
||||
bool Map::IsNonRaidDungeon() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsNonRaidDungeon();
|
||||
}
|
||||
|
||||
bool Map::IsRaid() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsRaid();
|
||||
}
|
||||
|
||||
bool Map::IsRaidOrHeroicDungeon() const
|
||||
{
|
||||
return IsRaid() || i_spawnMode > DUNGEON_DIFFICULTY_NORMAL;
|
||||
}
|
||||
|
||||
bool Map::IsHeroic() const
|
||||
{
|
||||
return IsRaid() ? i_spawnMode >= RAID_DIFFICULTY_10MAN_HEROIC : i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC;
|
||||
}
|
||||
|
||||
bool Map::Is25ManRaid() const
|
||||
{
|
||||
// since 25man difficulties are 1 and 3, we can check them like that
|
||||
return IsRaid() && i_spawnMode & RAID_DIFFICULTY_MASK_25MAN;
|
||||
}
|
||||
|
||||
uint32 Map::GetId() const
|
||||
{
|
||||
return i_mapEntry->MapID;
|
||||
}
|
||||
|
||||
bool Map::IsRegularDifficulty() const
|
||||
{
|
||||
return GetDifficulty() == REGULAR_DIFFICULTY;
|
||||
}
|
||||
|
||||
bool Map::IsBattleground() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsBattleground();
|
||||
}
|
||||
|
||||
bool Map::IsBattleArena() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsBattleArena();
|
||||
}
|
||||
|
||||
bool Map::IsBattlegroundOrArena() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsBattlegroundOrArena();
|
||||
}
|
||||
|
||||
bool Map::GetEntrancePos(int32& mapid, float& x, float& y) const
|
||||
{
|
||||
if (!i_mapEntry)
|
||||
return false;
|
||||
return i_mapEntry->GetEntrancePos(mapid, x, y);
|
||||
}
|
||||
|
||||
bool InstanceMap::HasPermBoundPlayers() const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PERM_BIND_BY_INSTANCE);
|
||||
@@ -3563,7 +3643,7 @@ uint32 InstanceMap::GetMaxResetDelay() const
|
||||
/* ******* Battleground Instance Maps ******* */
|
||||
|
||||
BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
|
||||
: Map(id, expiry, InstanceId, spawnMode, _parent), m_bg(NULL)
|
||||
: Map(id, expiry, InstanceId, spawnMode, _parent), m_bg(nullptr)
|
||||
{
|
||||
//lets initialize visibility distance for BG/Arenas
|
||||
BattlegroundMap::InitVisibilityDistance();
|
||||
@@ -3574,8 +3654,8 @@ BattlegroundMap::~BattlegroundMap()
|
||||
if (m_bg)
|
||||
{
|
||||
//unlink to prevent crash, always unlink all pointer reference before destruction
|
||||
m_bg->SetBgMap(NULL);
|
||||
m_bg = NULL;
|
||||
m_bg->SetBgMap(nullptr);
|
||||
m_bg = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3674,10 +3754,10 @@ Pet* Map::GetPet(ObjectGuid const& guid)
|
||||
Transport* Map::GetTransport(ObjectGuid const& guid)
|
||||
{
|
||||
if (!guid.IsMOTransport())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
GameObject* go = GetGameObject(guid);
|
||||
return go ? go->ToTransport() : NULL;
|
||||
return go ? go->ToTransport() : nullptr;
|
||||
}
|
||||
|
||||
void Map::UpdateIteratorBack(Player* player)
|
||||
@@ -3927,7 +4007,7 @@ Corpse* Map::ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia /*=
|
||||
corpse->DeleteFromDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
Corpse* bones = NULL;
|
||||
Corpse* bones = nullptr;
|
||||
|
||||
// create the bones only if the map and the grid is loaded at the corpse's location
|
||||
// ignore bones creating option in case insignia
|
||||
|
||||
Reference in New Issue
Block a user