mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
some sync from previous cores
This commit is contained in:
parent
45ef1974be
commit
08fb832e0d
1 changed files with 139 additions and 143 deletions
|
|
@ -59,10 +59,10 @@ Map::~Map()
|
||||||
UnloadAll(true);
|
UnloadAll(true);
|
||||||
|
|
||||||
if (!m_scriptSchedule.empty())
|
if (!m_scriptSchedule.empty())
|
||||||
sScriptMgr.DecreaseScheduledScriptCount(m_scriptSchedule.size());
|
{ sScriptMgr.DecreaseScheduledScriptCount(m_scriptSchedule.size()); }
|
||||||
|
|
||||||
if (m_persistentState)
|
if (m_persistentState)
|
||||||
m_persistentState->SetUsedByMapState(NULL); // field pointer can be deleted after this
|
{ m_persistentState->SetUsedByMapState(NULL); } // field pointer can be deleted after this
|
||||||
|
|
||||||
delete i_data;
|
delete i_data;
|
||||||
i_data = NULL;
|
i_data = NULL;
|
||||||
|
|
@ -72,7 +72,7 @@ Map::~Map()
|
||||||
|
|
||||||
// release reference count
|
// release reference count
|
||||||
if (m_TerrainData->Release())
|
if (m_TerrainData->Release())
|
||||||
sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId());
|
{ sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId()); }
|
||||||
|
|
||||||
delete m_weatherSystem;
|
delete m_weatherSystem;
|
||||||
m_weatherSystem = NULL;
|
m_weatherSystem = NULL;
|
||||||
|
|
@ -81,10 +81,10 @@ Map::~Map()
|
||||||
void Map::LoadMapAndVMap(int gx, int gy)
|
void Map::LoadMapAndVMap(int gx, int gy)
|
||||||
{
|
{
|
||||||
if (m_bLoadedGrids[gx][gy])
|
if (m_bLoadedGrids[gx][gy])
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
if (m_TerrainData->Load(gx, gy))
|
if (m_TerrainData->Load(gx, gy))
|
||||||
m_bLoadedGrids[gx][gy] = true;
|
{ m_bLoadedGrids[gx][gy] = true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
|
Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
|
||||||
|
|
@ -237,7 +237,7 @@ Map::EnsureGridCreated(const GridPair& p)
|
||||||
int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
|
int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
|
||||||
|
|
||||||
if (!m_bLoadedGrids[gx][gy])
|
if (!m_bLoadedGrids[gx][gy])
|
||||||
LoadMapAndVMap(gx, gy);
|
{ LoadMapAndVMap(gx, gy); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,10 +263,10 @@ Map::EnsureGridLoadedAtEnter(const Cell& cell, Player* player)
|
||||||
grid->SetGridState(GRID_STATE_ACTIVE);
|
grid->SetGridState(GRID_STATE_ACTIVE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
grid = getNGrid(cell.GridX(), cell.GridY());
|
{ grid = getNGrid(cell.GridX(), cell.GridY()); }
|
||||||
|
|
||||||
if (player)
|
if (player)
|
||||||
AddToGrid(player, grid, cell);
|
{ AddToGrid(player, grid, cell); }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Map::EnsureGridLoaded(const Cell& cell)
|
bool Map::EnsureGridLoaded(const Cell& cell)
|
||||||
|
|
@ -324,7 +324,7 @@ bool Map::Add(Player* player)
|
||||||
UpdateObjectVisibility(player, cell, p);
|
UpdateObjectVisibility(player, cell, p);
|
||||||
|
|
||||||
if (i_data)
|
if (i_data)
|
||||||
i_data->OnPlayerEnter(player);
|
{ i_data->OnPlayerEnter(player); }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -346,9 +346,9 @@ Map::Add(T* obj)
|
||||||
|
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (obj->isActiveObject())
|
if (obj->isActiveObject())
|
||||||
EnsureGridLoadedAtEnter(cell);
|
{ EnsureGridLoadedAtEnter(cell); }
|
||||||
else
|
else
|
||||||
EnsureGridCreated(GridPair(cell.GridX(), cell.GridY()));
|
{ EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); }
|
||||||
|
|
||||||
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
||||||
MANGOS_ASSERT(grid != NULL);
|
MANGOS_ASSERT(grid != NULL);
|
||||||
|
|
@ -357,7 +357,7 @@ Map::Add(T* obj)
|
||||||
obj->AddToWorld();
|
obj->AddToWorld();
|
||||||
|
|
||||||
if (obj->isActiveObject())
|
if (obj->isActiveObject())
|
||||||
AddToActive(obj);
|
{ AddToActive(obj); }
|
||||||
|
|
||||||
DEBUG_LOG("%s enters grid[%u,%u]", obj->GetGuidStr().c_str(), cell.GridX(), cell.GridY());
|
DEBUG_LOG("%s enters grid[%u,%u]", obj->GetGuidStr().c_str(), cell.GridX(), cell.GridY());
|
||||||
|
|
||||||
|
|
@ -381,7 +381,7 @@ void Map::MessageBroadcast(Player const* player, WorldPacket* msg, bool to_self)
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
|
||||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
MaNGOS::MessageDeliverer post_man(*player, msg, to_self);
|
MaNGOS::MessageDeliverer post_man(*player, msg, to_self);
|
||||||
TypeContainerVisitor<MaNGOS::MessageDeliverer, WorldTypeMapContainer > message(post_man);
|
TypeContainerVisitor<MaNGOS::MessageDeliverer, WorldTypeMapContainer > message(post_man);
|
||||||
|
|
@ -402,7 +402,7 @@ void Map::MessageBroadcast(WorldObject const* obj, WorldPacket* msg)
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
|
||||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
// TODO: currently on continents when Visibility.Distance.InFlight > Visibility.Distance.Continents
|
// TODO: currently on continents when Visibility.Distance.InFlight > Visibility.Distance.Continents
|
||||||
// we have alot of blinking mobs because monster move packet send is broken...
|
// we have alot of blinking mobs because monster move packet send is broken...
|
||||||
|
|
@ -425,7 +425,7 @@ void Map::MessageDistBroadcast(Player const* player, WorldPacket* msg, float dis
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
|
||||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
MaNGOS::MessageDistDeliverer post_man(*player, msg, dist, to_self, own_team_only);
|
MaNGOS::MessageDistDeliverer post_man(*player, msg, dist, to_self, own_team_only);
|
||||||
TypeContainerVisitor<MaNGOS::MessageDistDeliverer , WorldTypeMapContainer > message(post_man);
|
TypeContainerVisitor<MaNGOS::MessageDistDeliverer , WorldTypeMapContainer > message(post_man);
|
||||||
|
|
@ -446,7 +446,7 @@ void Map::MessageDistBroadcast(WorldObject const* obj, WorldPacket* msg, float d
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
|
||||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
MaNGOS::ObjectMessageDistDeliverer post_man(*obj, msg, dist);
|
MaNGOS::ObjectMessageDistDeliverer post_man(*obj, msg, dist);
|
||||||
TypeContainerVisitor<MaNGOS::ObjectMessageDistDeliverer, WorldTypeMapContainer > message(post_man);
|
TypeContainerVisitor<MaNGOS::ObjectMessageDistDeliverer, WorldTypeMapContainer > message(post_man);
|
||||||
|
|
@ -502,7 +502,7 @@ void Map::Update(const uint32& t_diff)
|
||||||
Player* plr = m_mapRefIter->getSource();
|
Player* plr = m_mapRefIter->getSource();
|
||||||
|
|
||||||
if (!plr->IsInWorld() || !plr->IsPositionValid())
|
if (!plr->IsInWorld() || !plr->IsPositionValid())
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
// lets update mobs/objects in ALL visible cells around player!
|
// lets update mobs/objects in ALL visible cells around player!
|
||||||
CellArea area = Cell::CalculateCellArea(plr->GetPositionX(), plr->GetPositionY(), GetVisibilityDistance());
|
CellArea area = Cell::CalculateCellArea(plr->GetPositionX(), plr->GetPositionY(), GetVisibilityDistance());
|
||||||
|
|
@ -540,7 +540,7 @@ void Map::Update(const uint32& t_diff)
|
||||||
++m_activeNonPlayersIter;
|
++m_activeNonPlayersIter;
|
||||||
|
|
||||||
if (!obj->IsInWorld() || !obj->IsPositionValid())
|
if (!obj->IsInWorld() || !obj->IsPositionValid())
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
// lets update mobs/objects in ALL visible cells around player!
|
// lets update mobs/objects in ALL visible cells around player!
|
||||||
CellArea area = Cell::CalculateCellArea(obj->GetPositionX(), obj->GetPositionY(), GetVisibilityDistance());
|
CellArea area = Cell::CalculateCellArea(obj->GetPositionX(), obj->GetPositionY(), GetVisibilityDistance());
|
||||||
|
|
@ -585,10 +585,10 @@ void Map::Update(const uint32& t_diff)
|
||||||
|
|
||||||
///- Process necessary scripts
|
///- Process necessary scripts
|
||||||
if (!m_scriptSchedule.empty())
|
if (!m_scriptSchedule.empty())
|
||||||
ScriptsProcess();
|
{ ScriptsProcess(); }
|
||||||
|
|
||||||
if (i_data)
|
if (i_data)
|
||||||
i_data->Update(t_diff);
|
{ i_data->Update(t_diff); }
|
||||||
|
|
||||||
m_weatherSystem->UpdateWeathers(t_diff);
|
m_weatherSystem->UpdateWeathers(t_diff);
|
||||||
}
|
}
|
||||||
|
|
@ -596,12 +596,12 @@ void Map::Update(const uint32& t_diff)
|
||||||
void Map::Remove(Player* player, bool remove)
|
void Map::Remove(Player* player, bool remove)
|
||||||
{
|
{
|
||||||
if (i_data)
|
if (i_data)
|
||||||
i_data->OnPlayerLeave(player);
|
{ i_data->OnPlayerLeave(player); }
|
||||||
|
|
||||||
if (remove)
|
if (remove)
|
||||||
player->CleanupsBeforeDelete();
|
{ player->CleanupsBeforeDelete(); }
|
||||||
else
|
else
|
||||||
player->RemoveFromWorld();
|
{ player->RemoveFromWorld(); }
|
||||||
|
|
||||||
// this may be called during Map::Update
|
// this may be called during Map::Update
|
||||||
// after decrement+unlink, ++m_mapRefIter will continue correctly
|
// after decrement+unlink, ++m_mapRefIter will continue correctly
|
||||||
|
|
@ -609,7 +609,7 @@ void Map::Remove(Player* player, bool remove)
|
||||||
// nocheck_prev will return the padding element of the RefManager
|
// nocheck_prev will return the padding element of the RefManager
|
||||||
// instead of NULL in the case of prev
|
// instead of NULL in the case of prev
|
||||||
if (m_mapRefIter == player->GetMapRef())
|
if (m_mapRefIter == player->GetMapRef())
|
||||||
m_mapRefIter = m_mapRefIter->nocheck_prev();
|
{ m_mapRefIter = m_mapRefIter->nocheck_prev(); }
|
||||||
player->GetMapRef().unlink();
|
player->GetMapRef().unlink();
|
||||||
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
|
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
|
||||||
if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
|
if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
|
||||||
|
|
@ -618,7 +618,7 @@ void Map::Remove(Player* player, bool remove)
|
||||||
player->ResetMap();
|
player->ResetMap();
|
||||||
|
|
||||||
if (remove)
|
if (remove)
|
||||||
DeleteFromWorld(player);
|
{ DeleteFromWorld(player); }
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -642,7 +642,7 @@ void Map::Remove(Player* player, bool remove)
|
||||||
|
|
||||||
player->ResetMap();
|
player->ResetMap();
|
||||||
if (remove)
|
if (remove)
|
||||||
DeleteFromWorld(player);
|
{ DeleteFromWorld(player); }
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|
@ -658,19 +658,19 @@ Map::Remove(T* obj, bool remove)
|
||||||
|
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
DEBUG_LOG("Remove object (GUID: %u TypeId:%u) from grid[%u,%u]", obj->GetGUIDLow(), obj->GetTypeId(), cell.data.Part.grid_x, cell.data.Part.grid_y);
|
DEBUG_LOG("Remove object (GUID: %u TypeId:%u) from grid[%u,%u]", obj->GetGUIDLow(), obj->GetTypeId(), cell.data.Part.grid_x, cell.data.Part.grid_y);
|
||||||
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
||||||
MANGOS_ASSERT(grid != NULL);
|
MANGOS_ASSERT(grid != NULL);
|
||||||
|
|
||||||
if (obj->isActiveObject())
|
if (obj->isActiveObject())
|
||||||
RemoveFromActive(obj);
|
{ RemoveFromActive(obj); }
|
||||||
|
|
||||||
if (remove)
|
if (remove)
|
||||||
obj->CleanupsBeforeDelete();
|
{ obj->CleanupsBeforeDelete(); }
|
||||||
else
|
else
|
||||||
obj->RemoveFromWorld();
|
{ obj->RemoveFromWorld(); }
|
||||||
|
|
||||||
UpdateObjectVisibility(obj, cell, p); // i think will be better to call this function while object still in grid, this changes nothing but logically is better(as for me)
|
UpdateObjectVisibility(obj, cell, p); // i think will be better to call this function while object still in grid, this changes nothing but logically is better(as for me)
|
||||||
RemoveFromGrid(obj, grid, cell);
|
RemoveFromGrid(obj, grid, cell);
|
||||||
|
|
@ -680,7 +680,7 @@ Map::Remove(T* obj, bool remove)
|
||||||
{
|
{
|
||||||
// if option set then object already saved at this moment
|
// if option set then object already saved at this moment
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
|
if (!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
|
||||||
obj->SaveRespawnTime();
|
{ obj->SaveRespawnTime(); }
|
||||||
|
|
||||||
// Note: In case resurrectable corpse and pet its removed from global lists in own destructor
|
// Note: In case resurrectable corpse and pet its removed from global lists in own destructor
|
||||||
delete obj;
|
delete obj;
|
||||||
|
|
@ -707,9 +707,9 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie
|
||||||
NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY());
|
NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY());
|
||||||
RemoveFromGrid(player, oldGrid, old_cell);
|
RemoveFromGrid(player, oldGrid, old_cell);
|
||||||
if (!old_cell.DiffGrid(new_cell))
|
if (!old_cell.DiffGrid(new_cell))
|
||||||
AddToGrid(player, oldGrid, new_cell);
|
{ AddToGrid(player, oldGrid, new_cell); }
|
||||||
else
|
else
|
||||||
EnsureGridLoadedAtEnter(new_cell, player);
|
{ EnsureGridLoadedAtEnter(new_cell, player); }
|
||||||
|
|
||||||
NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY());
|
NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY());
|
||||||
player->GetViewPoint().Event_GridChanged(&(*newGrid)(new_cell.CellX(), new_cell.CellY()));
|
player->GetViewPoint().Event_GridChanged(&(*newGrid)(new_cell.CellX(), new_cell.CellY()));
|
||||||
|
|
@ -797,7 +797,7 @@ bool Map::CreatureRespawnRelocation(Creature* c)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
{ return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Map::UnloadGrid(const uint32& x, const uint32& y, bool pForce)
|
bool Map::UnloadGrid(const uint32& x, const uint32& y, bool pForce)
|
||||||
|
|
@ -807,9 +807,7 @@ bool Map::UnloadGrid(const uint32& x, const uint32& y, bool pForce)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!pForce && ActiveObjectsNearGrid(x, y))
|
if (!pForce && ActiveObjectsNearGrid(x, y))
|
||||||
{
|
{ return false; }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "Unloading grid[%u,%u] for map %u", x, y, i_id);
|
DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "Unloading grid[%u,%u] for map %u", x, y, i_id);
|
||||||
ObjectGridUnloader unloader(*grid);
|
ObjectGridUnloader unloader(*grid);
|
||||||
|
|
@ -950,7 +948,7 @@ void Map::SendInitTransports(Player* player)
|
||||||
|
|
||||||
// no transports at map
|
// no transports at map
|
||||||
if (tmap.find(player->GetMapId()) == tmap.end())
|
if (tmap.find(player->GetMapId()) == tmap.end())
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
UpdateData transData(player->GetMapId());
|
UpdateData transData(player->GetMapId());
|
||||||
|
|
||||||
|
|
@ -982,7 +980,7 @@ void Map::SendRemoveTransports(Player* player)
|
||||||
|
|
||||||
// no transports at map
|
// no transports at map
|
||||||
if (tmap.find(player->GetMapId()) == tmap.end())
|
if (tmap.find(player->GetMapId()) == tmap.end())
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
UpdateData transData(player->GetMapId());
|
UpdateData transData(player->GetMapId());
|
||||||
|
|
||||||
|
|
@ -991,7 +989,7 @@ void Map::SendRemoveTransports(Player* player)
|
||||||
// except used transport
|
// except used transport
|
||||||
for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i)
|
for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i)
|
||||||
if ((*i) != player->GetTransport() && (*i)->GetMapId() != i_id)
|
if ((*i) != player->GetTransport() && (*i)->GetMapId() != i_id)
|
||||||
(*i)->BuildOutOfRangeUpdateBlock(&transData);
|
{ (*i)->BuildOutOfRangeUpdateBlock(&transData); }
|
||||||
|
|
||||||
WorldPacket packet;
|
WorldPacket packet;
|
||||||
transData.BuildPacket(&packet);
|
transData.BuildPacket(&packet);
|
||||||
|
|
@ -1026,7 +1024,7 @@ void Map::AddObjectToRemoveList(WorldObject* obj)
|
||||||
void Map::RemoveAllObjectsInRemoveList()
|
void Map::RemoveAllObjectsInRemoveList()
|
||||||
{
|
{
|
||||||
if (i_objectsToRemove.empty())
|
if (i_objectsToRemove.empty())
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
// DEBUG_LOG("Object remover 1 check.");
|
// DEBUG_LOG("Object remover 1 check.");
|
||||||
while (!i_objectsToRemove.empty())
|
while (!i_objectsToRemove.empty())
|
||||||
|
|
@ -1041,9 +1039,9 @@ void Map::RemoveAllObjectsInRemoveList()
|
||||||
// ??? WTF
|
// ??? WTF
|
||||||
Corpse* corpse = GetCorpse(obj->GetObjectGuid());
|
Corpse* corpse = GetCorpse(obj->GetObjectGuid());
|
||||||
if (!corpse)
|
if (!corpse)
|
||||||
sLog.outError("Try delete corpse/bones %u that not in map", obj->GetGUIDLow());
|
{ sLog.outError("Try delete corpse/bones %u that not in map", obj->GetGUIDLow()); }
|
||||||
else
|
else
|
||||||
Remove(corpse, true);
|
{ Remove(corpse, true); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TYPEID_DYNAMICOBJECT:
|
case TYPEID_DYNAMICOBJECT:
|
||||||
|
|
@ -1068,14 +1066,14 @@ uint32 Map::GetPlayersCountExceptGMs() const
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||||
if (!itr->getSource()->isGameMaster())
|
if (!itr->getSource()->isGameMaster())
|
||||||
++count;
|
{ ++count; }
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::SendToPlayers(WorldPacket const* data) const
|
void Map::SendToPlayers(WorldPacket const* data) const
|
||||||
{
|
{
|
||||||
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||||
itr->getSource()->GetSession()->SendPacket(data);
|
{ itr->getSource()->GetSession()->SendPacket(data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Map::SendToPlayersInZone(WorldPacket const* data, uint32 zoneId) const
|
bool Map::SendToPlayersInZone(WorldPacket const* data, uint32 zoneId) const
|
||||||
|
|
@ -1115,8 +1113,8 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const
|
||||||
|
|
||||||
CellPair p = MaNGOS::ComputeCellPair(plr->GetPositionX(), plr->GetPositionY());
|
CellPair p = MaNGOS::ComputeCellPair(plr->GetPositionX(), plr->GetPositionY());
|
||||||
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
|
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
|
||||||
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
|
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
|
||||||
return true;
|
{ return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ActiveNonPlayers::const_iterator iter = m_activeNonPlayers.begin(); iter != m_activeNonPlayers.end(); ++iter)
|
for (ActiveNonPlayers::const_iterator iter = m_activeNonPlayers.begin(); iter != m_activeNonPlayers.end(); ++iter)
|
||||||
|
|
@ -1125,8 +1123,8 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const
|
||||||
|
|
||||||
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
|
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
|
||||||
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
|
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
|
||||||
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
|
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
|
||||||
return true;
|
{ return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1149,7 +1147,7 @@ void Map::AddToActive(WorldObject* obj)
|
||||||
c->GetRespawnCoord(x, y, z);
|
c->GetRespawnCoord(x, y, z);
|
||||||
GridPair p = MaNGOS::ComputeGridPair(x, y);
|
GridPair p = MaNGOS::ComputeGridPair(x, y);
|
||||||
if (getNGrid(p.x_coord, p.y_coord))
|
if (getNGrid(p.x_coord, p.y_coord))
|
||||||
getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock();
|
{ getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock(); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
|
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
|
||||||
|
|
@ -1167,11 +1165,11 @@ void Map::RemoveFromActive(WorldObject* obj)
|
||||||
{
|
{
|
||||||
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
|
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
|
||||||
if (itr == m_activeNonPlayersIter)
|
if (itr == m_activeNonPlayersIter)
|
||||||
++m_activeNonPlayersIter;
|
{ ++m_activeNonPlayersIter; }
|
||||||
m_activeNonPlayers.erase(itr);
|
m_activeNonPlayers.erase(itr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_activeNonPlayers.erase(obj);
|
{ m_activeNonPlayers.erase(obj); }
|
||||||
|
|
||||||
// also allow unloading spawn grid
|
// also allow unloading spawn grid
|
||||||
if (obj->GetTypeId() == TYPEID_UNIT)
|
if (obj->GetTypeId() == TYPEID_UNIT)
|
||||||
|
|
@ -1184,7 +1182,7 @@ void Map::RemoveFromActive(WorldObject* obj)
|
||||||
c->GetRespawnCoord(x, y, z);
|
c->GetRespawnCoord(x, y, z);
|
||||||
GridPair p = MaNGOS::ComputeGridPair(x, y);
|
GridPair p = MaNGOS::ComputeGridPair(x, y);
|
||||||
if (getNGrid(p.x_coord, p.y_coord))
|
if (getNGrid(p.x_coord, p.y_coord))
|
||||||
getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock();
|
{ getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock(); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
|
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
|
||||||
|
|
@ -1197,63 +1195,63 @@ void Map::RemoveFromActive(WorldObject* obj)
|
||||||
|
|
||||||
void Map::CreateInstanceData(bool load)
|
void Map::CreateInstanceData(bool load)
|
||||||
{
|
{
|
||||||
if (i_data != NULL)
|
if (i_data != NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 i_script_id = GetScriptId();
|
uint32 i_script_id = GetScriptId();
|
||||||
|
|
||||||
if (!i_script_id)
|
if (!i_script_id)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
i_data = sScriptMgr.CreateInstanceData(this);
|
i_data = sScriptMgr.CreateInstanceData(this);
|
||||||
if (!i_data)
|
if (!i_data)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (load)
|
if (load)
|
||||||
{
|
{
|
||||||
// TODO: make a global storage for this
|
// TODO: make a global storage for this
|
||||||
QueryResult* result;
|
QueryResult* result;
|
||||||
|
|
||||||
if (Instanceable())
|
if (Instanceable())
|
||||||
{
|
{
|
||||||
result = CharacterDatabase.PQuery("SELECT data FROM instance WHERE id = '%u'", i_InstanceId);
|
result = CharacterDatabase.PQuery("SELECT data FROM instance WHERE id = '%u'", i_InstanceId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = CharacterDatabase.PQuery("SELECT data FROM world WHERE map = '%u'", GetId());
|
result = CharacterDatabase.PQuery("SELECT data FROM world WHERE map = '%u'", GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
const char* data = fields[0].GetString();
|
const char* data = fields[0].GetString();
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Loading instance data for `%s` (Map: %u Instance: %u)", sScriptMgr.GetScriptName(i_script_id), GetId(), i_InstanceId);
|
DEBUG_LOG("Loading instance data for `%s` (Map: %u Instance: %u)", sScriptMgr.GetScriptName(i_script_id), GetId(), i_InstanceId);
|
||||||
i_data->Load(data);
|
i_data->Load(data);
|
||||||
}
|
}
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// for non-instanceable map always add data to table if not found, later code expected that for map in `word` exist always after load
|
// for non-instanceable map always add data to table if not found, later code expected that for map in `word` exist always after load
|
||||||
if (!Instanceable())
|
if (!Instanceable())
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("INSERT INTO world VALUES ('%u', '')", GetId());
|
CharacterDatabase.PExecute("INSERT INTO world VALUES ('%u', '')", GetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_LOG("New instance data, \"%s\" ,initialized!", sScriptMgr.GetScriptName(i_script_id));
|
DEBUG_LOG("New instance data, \"%s\" ,initialized!", sScriptMgr.GetScriptName(i_script_id));
|
||||||
i_data->Initialize();
|
i_data->Initialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
void Map::CreateInstanceData(bool load)
|
void Map::CreateInstanceData(bool load)
|
||||||
|
|
@ -1399,13 +1397,13 @@ bool DungeonMap::Add(Player* player)
|
||||||
// Is it needed?
|
// Is it needed?
|
||||||
|
|
||||||
if (!CanEnter(player))
|
if (!CanEnter(player))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
// check for existing instance binds
|
// check for existing instance binds
|
||||||
InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), GetDifficulty());
|
InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), GetDifficulty());
|
||||||
if (playerBind && playerBind->perm)
|
if (playerBind && playerBind->perm)
|
||||||
{
|
{
|
||||||
// cannot enter other instances if bound permanently
|
// can not enter other instances if bound permanently
|
||||||
if (playerBind->state != GetPersistanceState())
|
if (playerBind->state != GetPersistanceState())
|
||||||
{
|
{
|
||||||
sLog.outError("DungeonMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d",
|
sLog.outError("DungeonMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d",
|
||||||
|
|
@ -1447,10 +1445,10 @@ bool DungeonMap::Add(Player* player)
|
||||||
|
|
||||||
// bind to the group or keep using the group save
|
// bind to the group or keep using the group save
|
||||||
if (!groupBind)
|
if (!groupBind)
|
||||||
pGroup->BindToInstance(GetPersistanceState(), false);
|
{ pGroup->BindToInstance(GetPersistanceState(), false); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// cannot jump to a different instance without resetting it
|
// can not jump to a different instance without resetting it
|
||||||
if (groupBind->state != GetPersistentState())
|
if (groupBind->state != GetPersistentState())
|
||||||
{
|
{
|
||||||
sLog.outError("DungeonMap::Add: %s is being put in instance %d,%d,%d but he is in group (Id: %d) which is bound to instance %d,%d,%d!",
|
sLog.outError("DungeonMap::Add: %s is being put in instance %d,%d,%d but he is in group (Id: %d) which is bound to instance %d,%d,%d!",
|
||||||
|
|
@ -1463,9 +1461,9 @@ bool DungeonMap::Add(Player* player)
|
||||||
GetPersistanceState()->GetPlayerCount(), GetPersistanceState()->GetGroupCount());
|
GetPersistanceState()->GetPlayerCount(), GetPersistanceState()->GetGroupCount());
|
||||||
|
|
||||||
if (groupBind->state)
|
if (groupBind->state)
|
||||||
sLog.outError("GroupBind save players: %d, group count: %d", groupBind->state->GetPlayerCount(), groupBind->state->GetGroupCount());
|
{ sLog.outError("GroupBind save players: %d, group count: %d", groupBind->state->GetPlayerCount(), groupBind->state->GetGroupCount()); }
|
||||||
else
|
else
|
||||||
sLog.outError("GroupBind save NULL");
|
{ sLog.outError("GroupBind save NULL"); }
|
||||||
MANGOS_ASSERT(false);
|
MANGOS_ASSERT(false);
|
||||||
}
|
}
|
||||||
// if the group/leader is permanently bound to the instance
|
// if the group/leader is permanently bound to the instance
|
||||||
|
|
@ -1484,10 +1482,10 @@ bool DungeonMap::Add(Player* player)
|
||||||
{
|
{
|
||||||
// set up a solo bind or continue using it
|
// set up a solo bind or continue using it
|
||||||
if (!playerBind)
|
if (!playerBind)
|
||||||
player->BindToInstance(GetPersistanceState(), false);
|
{ player->BindToInstance(GetPersistanceState(), false); }
|
||||||
else
|
else
|
||||||
// cannot jump to a different instance without resetting it
|
// can not jump to a different instance without resetting it
|
||||||
MANGOS_ASSERT(playerBind->state == GetPersistentState());
|
{ MANGOS_ASSERT(playerBind->state == GetPersistentState()); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1501,7 +1499,7 @@ bool DungeonMap::Add(Player* player)
|
||||||
m_resetAfterUnload = false;
|
m_resetAfterUnload = false;
|
||||||
m_unloadWhenEmpty = false;
|
m_unloadWhenEmpty = false;
|
||||||
|
|
||||||
// this will acquire the same mutex so it cannot be in the previous block
|
// this will acquire the same mutex so it can not be in the previous block
|
||||||
Map::Add(player);
|
Map::Add(player);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1518,7 +1516,7 @@ void DungeonMap::Remove(Player* player, bool remove)
|
||||||
|
|
||||||
// if last player set unload timer
|
// if last player set unload timer
|
||||||
if (!m_unloadTimer && m_mapRefManager.getSize() == 1)
|
if (!m_unloadTimer && m_mapRefManager.getSize() == 1)
|
||||||
m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld.getConfig(CONFIG_UINT32_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
|
{ m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld.getConfig(CONFIG_UINT32_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY); }
|
||||||
|
|
||||||
Map::Remove(player, remove);
|
Map::Remove(player, remove);
|
||||||
|
|
||||||
|
|
@ -1540,7 +1538,7 @@ bool DungeonMap::Reset(InstanceResetMethod method)
|
||||||
{
|
{
|
||||||
// notify the players to leave the instance so it can be reset
|
// notify the players to leave the instance so it can be reset
|
||||||
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||||
itr->getSource()->SendResetFailedNotify(GetId());
|
{ itr->getSource()->SendResetFailedNotify(GetId()); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1548,7 +1546,7 @@ bool DungeonMap::Reset(InstanceResetMethod method)
|
||||||
{
|
{
|
||||||
// set the homebind timer for players inside (1 minute)
|
// set the homebind timer for players inside (1 minute)
|
||||||
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||||
itr->getSource()->m_InstanceValid = false;
|
{ itr->getSource()->m_InstanceValid = false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// the unload timer is not started
|
// the unload timer is not started
|
||||||
|
|
@ -1574,7 +1572,7 @@ void DungeonMap::PermBindAllPlayers(Player* player)
|
||||||
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||||
{
|
{
|
||||||
Player* plr = itr->getSource();
|
Player* plr = itr->getSource();
|
||||||
// players inside an instance cannot be bound to other instances
|
// players inside an instance can not be bound to other instances
|
||||||
// some players may already be permanently bound, in this case nothing happens
|
// some players may already be permanently bound, in this case nothing happens
|
||||||
InstancePlayerBind* bind = plr->GetBoundInstance(GetId(), GetDifficulty());
|
InstancePlayerBind* bind = plr->GetBoundInstance(GetId(), GetDifficulty());
|
||||||
if (!bind || !bind->perm)
|
if (!bind || !bind->perm)
|
||||||
|
|
@ -1588,16 +1586,16 @@ void DungeonMap::PermBindAllPlayers(Player* player)
|
||||||
|
|
||||||
// if the leader is not in the instance the group will not get a perm bind
|
// if the leader is not in the instance the group will not get a perm bind
|
||||||
if (group && group->GetLeaderGuid() == plr->GetObjectGuid())
|
if (group && group->GetLeaderGuid() == plr->GetObjectGuid())
|
||||||
group->BindToInstance(GetPersistanceState(), true);
|
{ group->BindToInstance(GetPersistanceState(), true); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DungeonMap::UnloadAll(bool pForce)
|
void DungeonMap::UnloadAll(bool pForce)
|
||||||
{
|
{
|
||||||
TeleportAllPlayersTo(TELEPORT_LOCATION_HOMEBIND);
|
TeleportAllPlayersTo(TELEPORT_LOCATION_HOMEBIND);
|
||||||
|
|
||||||
if (m_resetAfterUnload == true)
|
if (m_resetAfterUnload == true)
|
||||||
GetPersistanceState()->DeleteRespawnTimes();
|
{ GetPersistanceState()->DeleteRespawnTimes(); }
|
||||||
|
|
||||||
Map::UnloadAll(pForce);
|
Map::UnloadAll(pForce);
|
||||||
}
|
}
|
||||||
|
|
@ -1657,10 +1655,10 @@ void BattleGroundMap::InitVisibilityDistance()
|
||||||
bool BattleGroundMap::CanEnter(Player* player)
|
bool BattleGroundMap::CanEnter(Player* player)
|
||||||
{
|
{
|
||||||
if (!Map::CanEnter(player))
|
if (!Map::CanEnter(player))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (player->GetBattleGroundId() != GetInstanceId())
|
if (player->GetBattleGroundId() != GetInstanceId())
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
// player number limit is checked in bgmgr, no need to do it here
|
// player number limit is checked in bgmgr, no need to do it here
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1669,7 +1667,7 @@ bool BattleGroundMap::CanEnter(Player* player)
|
||||||
bool BattleGroundMap::Add(Player* player)
|
bool BattleGroundMap::Add(Player* player)
|
||||||
{
|
{
|
||||||
if (!CanEnter(player))
|
if (!CanEnter(player))
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
// reset instance validity, battleground maps do not homebind
|
// reset instance validity, battleground maps do not homebind
|
||||||
player->m_InstanceValid = true;
|
player->m_InstanceValid = true;
|
||||||
|
|
@ -1718,7 +1716,7 @@ bool Map::ScriptsStart(ScriptMapMapName const& scripts, uint32 id, Object* sourc
|
||||||
///- Find the script map
|
///- Find the script map
|
||||||
ScriptMapMap::const_iterator s = scripts.second.find(id);
|
ScriptMapMap::const_iterator s = scripts.second.find(id);
|
||||||
if (s == scripts.second.end())
|
if (s == scripts.second.end())
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
// prepare static data
|
// prepare static data
|
||||||
ObjectGuid sourceGuid = source->GetObjectGuid();
|
ObjectGuid sourceGuid = source->GetObjectGuid();
|
||||||
|
|
@ -1773,7 +1771,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
||||||
void Map::ScriptsProcess()
|
void Map::ScriptsProcess()
|
||||||
{
|
{
|
||||||
if (m_scriptSchedule.empty())
|
if (m_scriptSchedule.empty())
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
///- Process overdue queued scripts
|
///- Process overdue queued scripts
|
||||||
ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
|
ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
|
||||||
|
|
@ -1797,7 +1795,7 @@ void Map::ScriptsProcess()
|
||||||
sScriptMgr.DecreaseScheduledScriptCount();
|
sScriptMgr.DecreaseScheduledScriptCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++rmItr;
|
{ ++rmItr; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1906,7 +1904,7 @@ DynamicObject* Map::GetDynamicObject(ObjectGuid guid)
|
||||||
Unit* Map::GetUnit(ObjectGuid guid)
|
Unit* Map::GetUnit(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if (guid.IsPlayer())
|
if (guid.IsPlayer())
|
||||||
return GetPlayer(guid);
|
{ return GetPlayer(guid); }
|
||||||
|
|
||||||
return GetAnyTypeCreature(guid);
|
return GetAnyTypeCreature(guid);
|
||||||
}
|
}
|
||||||
|
|
@ -1985,7 +1983,7 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
|
||||||
*/
|
*/
|
||||||
class StaticMonsterChatBuilder
|
class StaticMonsterChatBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StaticMonsterChatBuilder(CreatureInfo const* cInfo, ChatMsg msgtype, int32 textId, Language language, Unit const* target, uint32 senderLowGuid = 0)
|
StaticMonsterChatBuilder(CreatureInfo const* cInfo, ChatMsg msgtype, int32 textId, Language language, Unit const* target, uint32 senderLowGuid = 0)
|
||||||
: i_cInfo(cInfo), i_msgtype(msgtype), i_textId(textId), i_language(language), i_target(target)
|
: i_cInfo(cInfo), i_msgtype(msgtype), i_textId(textId), i_language(language), i_target(target)
|
||||||
{
|
{
|
||||||
|
|
@ -2059,9 +2057,7 @@ void Map::MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, Language lan
|
||||||
|
|
||||||
Map::PlayerList const& pList = GetPlayers();
|
Map::PlayerList const& pList = GetPlayers();
|
||||||
for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||||
{
|
{ say_do(itr->getSource()); }
|
||||||
say_do(itr->getSource());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2079,7 +2075,7 @@ void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId /*=0*/) const
|
||||||
Map::PlayerList const& pList = GetPlayers();
|
Map::PlayerList const& pList = GetPlayers();
|
||||||
for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||||
if (!zoneId || itr->getSource()->GetZoneId() == zoneId)
|
if (!zoneId || itr->getSource()->GetZoneId() == zoneId)
|
||||||
itr->getSource()->SendDirectMessage(&data);
|
{ itr->getSource()->SendDirectMessage(&data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2320,16 +2316,16 @@ bool Map::GetReachableRandomPosition(Unit* unit, float& x, float& y, float& z, f
|
||||||
bool isSwimming = true;
|
bool isSwimming = true;
|
||||||
switch (unit->GetTypeId())
|
switch (unit->GetTypeId())
|
||||||
{
|
{
|
||||||
case TYPEID_PLAYER:
|
case TYPEID_PLAYER:
|
||||||
isFlying = static_cast<Player*>(unit)->IsFlying();
|
isFlying = static_cast<Player*>(unit)->IsFlying();
|
||||||
break;
|
break;
|
||||||
case TYPEID_UNIT:
|
case TYPEID_UNIT:
|
||||||
isFlying = static_cast<Creature*>(unit)->IsFlying();
|
isFlying = static_cast<Creature*>(unit)->IsFlying();
|
||||||
isSwimming = static_cast<Creature*>(unit)->IsSwimming();
|
isSwimming = static_cast<Creature*>(unit)->IsSwimming();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sLog.outError("Map::GetReachableRandomPosition> Unsupported unit type is passed!");
|
sLog.outError("Map::GetReachableRandomPosition> Unsupported unit type is passed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radius < 0.1f)
|
if (radius < 0.1f)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue