some sync from previous cores

This commit is contained in:
Antz 2017-01-08 21:44:07 +00:00 committed by Antz
parent 45ef1974be
commit 08fb832e0d

View file

@ -59,10 +59,10 @@ Map::~Map()
UnloadAll(true);
if (!m_scriptSchedule.empty())
sScriptMgr.DecreaseScheduledScriptCount(m_scriptSchedule.size());
{ sScriptMgr.DecreaseScheduledScriptCount(m_scriptSchedule.size()); }
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;
i_data = NULL;
@ -72,7 +72,7 @@ Map::~Map()
// release reference count
if (m_TerrainData->Release())
sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId());
{ sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId()); }
delete m_weatherSystem;
m_weatherSystem = NULL;
@ -81,10 +81,10 @@ Map::~Map()
void Map::LoadMapAndVMap(int gx, int gy)
{
if (m_bLoadedGrids[gx][gy])
return;
{ return; }
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)
@ -237,7 +237,7 @@ Map::EnsureGridCreated(const GridPair& p)
int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
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);
}
else
grid = getNGrid(cell.GridX(), cell.GridY());
{ grid = getNGrid(cell.GridX(), cell.GridY()); }
if (player)
AddToGrid(player, grid, cell);
{ AddToGrid(player, grid, cell); }
}
bool Map::EnsureGridLoaded(const Cell& cell)
@ -324,7 +324,7 @@ bool Map::Add(Player* player)
UpdateObjectVisibility(player, cell, p);
if (i_data)
i_data->OnPlayerEnter(player);
{ i_data->OnPlayerEnter(player); }
return true;
}
@ -346,9 +346,9 @@ Map::Add(T* obj)
Cell cell(p);
if (obj->isActiveObject())
EnsureGridLoadedAtEnter(cell);
{ EnsureGridLoadedAtEnter(cell); }
else
EnsureGridCreated(GridPair(cell.GridX(), cell.GridY()));
{ EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); }
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
MANGOS_ASSERT(grid != NULL);
@ -357,7 +357,7 @@ Map::Add(T* obj)
obj->AddToWorld();
if (obj->isActiveObject())
AddToActive(obj);
{ AddToActive(obj); }
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();
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
{ return; }
MaNGOS::MessageDeliverer post_man(*player, msg, to_self);
TypeContainerVisitor<MaNGOS::MessageDeliverer, WorldTypeMapContainer > message(post_man);
@ -402,7 +402,7 @@ void Map::MessageBroadcast(WorldObject const* obj, WorldPacket* msg)
cell.SetNoCreate();
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
// 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();
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);
TypeContainerVisitor<MaNGOS::MessageDistDeliverer , WorldTypeMapContainer > message(post_man);
@ -446,7 +446,7 @@ void Map::MessageDistBroadcast(WorldObject const* obj, WorldPacket* msg, float d
cell.SetNoCreate();
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
{ return; }
MaNGOS::ObjectMessageDistDeliverer post_man(*obj, msg, dist);
TypeContainerVisitor<MaNGOS::ObjectMessageDistDeliverer, WorldTypeMapContainer > message(post_man);
@ -502,7 +502,7 @@ void Map::Update(const uint32& t_diff)
Player* plr = m_mapRefIter->getSource();
if (!plr->IsInWorld() || !plr->IsPositionValid())
continue;
{ continue; }
// lets update mobs/objects in ALL visible cells around player!
CellArea area = Cell::CalculateCellArea(plr->GetPositionX(), plr->GetPositionY(), GetVisibilityDistance());
@ -540,7 +540,7 @@ void Map::Update(const uint32& t_diff)
++m_activeNonPlayersIter;
if (!obj->IsInWorld() || !obj->IsPositionValid())
continue;
{ continue; }
// lets update mobs/objects in ALL visible cells around player!
CellArea area = Cell::CalculateCellArea(obj->GetPositionX(), obj->GetPositionY(), GetVisibilityDistance());
@ -585,10 +585,10 @@ void Map::Update(const uint32& t_diff)
///- Process necessary scripts
if (!m_scriptSchedule.empty())
ScriptsProcess();
{ ScriptsProcess(); }
if (i_data)
i_data->Update(t_diff);
{ i_data->Update(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)
{
if (i_data)
i_data->OnPlayerLeave(player);
{ i_data->OnPlayerLeave(player); }
if (remove)
player->CleanupsBeforeDelete();
{ player->CleanupsBeforeDelete(); }
else
player->RemoveFromWorld();
{ player->RemoveFromWorld(); }
// this may be called during Map::Update
// 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
// instead of NULL in the case of prev
if (m_mapRefIter == player->GetMapRef())
m_mapRefIter = m_mapRefIter->nocheck_prev();
{ m_mapRefIter = m_mapRefIter->nocheck_prev(); }
player->GetMapRef().unlink();
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)
@ -618,7 +618,7 @@ void Map::Remove(Player* player, bool remove)
player->ResetMap();
if (remove)
DeleteFromWorld(player);
{ DeleteFromWorld(player); }
return;
}
@ -642,7 +642,7 @@ void Map::Remove(Player* player, bool remove)
player->ResetMap();
if (remove)
DeleteFromWorld(player);
{ DeleteFromWorld(player); }
}
template<class T>
@ -658,19 +658,19 @@ Map::Remove(T* obj, bool remove)
Cell cell(p);
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);
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
MANGOS_ASSERT(grid != NULL);
if (obj->isActiveObject())
RemoveFromActive(obj);
{ RemoveFromActive(obj); }
if (remove)
obj->CleanupsBeforeDelete();
{ obj->CleanupsBeforeDelete(); }
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)
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 (!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
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());
RemoveFromGrid(player, oldGrid, old_cell);
if (!old_cell.DiffGrid(new_cell))
AddToGrid(player, oldGrid, new_cell);
{ AddToGrid(player, oldGrid, new_cell); }
else
EnsureGridLoadedAtEnter(new_cell, player);
{ EnsureGridLoadedAtEnter(new_cell, player); }
NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY());
player->GetViewPoint().Event_GridChanged(&(*newGrid)(new_cell.CellX(), new_cell.CellY()));
@ -797,7 +797,7 @@ bool Map::CreatureRespawnRelocation(Creature* c)
return true;
}
else
return false;
{ return false; }
}
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))
{
return false;
}
{ return false; }
DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "Unloading grid[%u,%u] for map %u", x, y, i_id);
ObjectGridUnloader unloader(*grid);
@ -950,7 +948,7 @@ void Map::SendInitTransports(Player* player)
// no transports at map
if (tmap.find(player->GetMapId()) == tmap.end())
return;
{ return; }
UpdateData transData(player->GetMapId());
@ -982,7 +980,7 @@ void Map::SendRemoveTransports(Player* player)
// no transports at map
if (tmap.find(player->GetMapId()) == tmap.end())
return;
{ return; }
UpdateData transData(player->GetMapId());
@ -991,7 +989,7 @@ void Map::SendRemoveTransports(Player* player)
// except used transport
for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i)
if ((*i) != player->GetTransport() && (*i)->GetMapId() != i_id)
(*i)->BuildOutOfRangeUpdateBlock(&transData);
{ (*i)->BuildOutOfRangeUpdateBlock(&transData); }
WorldPacket packet;
transData.BuildPacket(&packet);
@ -1026,7 +1024,7 @@ void Map::AddObjectToRemoveList(WorldObject* obj)
void Map::RemoveAllObjectsInRemoveList()
{
if (i_objectsToRemove.empty())
return;
{ return; }
// DEBUG_LOG("Object remover 1 check.");
while (!i_objectsToRemove.empty())
@ -1041,9 +1039,9 @@ void Map::RemoveAllObjectsInRemoveList()
// ??? WTF
Corpse* corpse = GetCorpse(obj->GetObjectGuid());
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
Remove(corpse, true);
{ Remove(corpse, true); }
break;
}
case TYPEID_DYNAMICOBJECT:
@ -1068,14 +1066,14 @@ uint32 Map::GetPlayersCountExceptGMs() const
uint32 count = 0;
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
if (!itr->getSource()->isGameMaster())
++count;
{ ++count; }
return count;
}
void Map::SendToPlayers(WorldPacket const* data) const
{
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
@ -1115,8 +1113,8 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const
CellPair p = MaNGOS::ComputeCellPair(plr->GetPositionX(), plr->GetPositionY());
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))
return true;
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
{ return true; }
}
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());
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))
return true;
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
{ return true; }
}
return false;
@ -1149,7 +1147,7 @@ void Map::AddToActive(WorldObject* obj)
c->GetRespawnCoord(x, y, z);
GridPair p = MaNGOS::ComputeGridPair(x, y);
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
{
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
@ -1167,11 +1165,11 @@ void Map::RemoveFromActive(WorldObject* obj)
{
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
if (itr == m_activeNonPlayersIter)
++m_activeNonPlayersIter;
{ ++m_activeNonPlayersIter; }
m_activeNonPlayers.erase(itr);
}
else
m_activeNonPlayers.erase(obj);
{ m_activeNonPlayers.erase(obj); }
// also allow unloading spawn grid
if (obj->GetTypeId() == TYPEID_UNIT)
@ -1184,7 +1182,7 @@ void Map::RemoveFromActive(WorldObject* obj)
c->GetRespawnCoord(x, y, z);
GridPair p = MaNGOS::ComputeGridPair(x, y);
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
{
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
@ -1197,63 +1195,63 @@ void Map::RemoveFromActive(WorldObject* obj)
void Map::CreateInstanceData(bool load)
{
if (i_data != NULL)
{
return;
}
if (i_data != NULL)
{
return;
}
uint32 i_script_id = GetScriptId();
uint32 i_script_id = GetScriptId();
if (!i_script_id)
{
return;
}
if (!i_script_id)
{
return;
}
i_data = sScriptMgr.CreateInstanceData(this);
if (!i_data)
{
return;
}
i_data = sScriptMgr.CreateInstanceData(this);
if (!i_data)
{
return;
}
if (load)
{
// TODO: make a global storage for this
QueryResult* result;
if (load)
{
// TODO: make a global storage for this
QueryResult* result;
if (Instanceable())
{
result = CharacterDatabase.PQuery("SELECT data FROM instance WHERE id = '%u'", i_InstanceId);
}
else
{
result = CharacterDatabase.PQuery("SELECT data FROM world WHERE map = '%u'", GetId());
}
if (Instanceable())
{
result = CharacterDatabase.PQuery("SELECT data FROM instance WHERE id = '%u'", i_InstanceId);
}
else
{
result = CharacterDatabase.PQuery("SELECT data FROM world WHERE map = '%u'", GetId());
}
if (result)
{
Field* fields = result->Fetch();
const char* data = fields[0].GetString();
if (data)
{
DEBUG_LOG("Loading instance data for `%s` (Map: %u Instance: %u)", sScriptMgr.GetScriptName(i_script_id), GetId(), i_InstanceId);
i_data->Load(data);
}
delete result;
}
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
if (!Instanceable())
{
CharacterDatabase.PExecute("INSERT INTO world VALUES ('%u', '')", GetId());
}
}
}
else
{
DEBUG_LOG("New instance data, \"%s\" ,initialized!", sScriptMgr.GetScriptName(i_script_id));
i_data->Initialize();
}
if (result)
{
Field* fields = result->Fetch();
const char* data = fields[0].GetString();
if (data)
{
DEBUG_LOG("Loading instance data for `%s` (Map: %u Instance: %u)", sScriptMgr.GetScriptName(i_script_id), GetId(), i_InstanceId);
i_data->Load(data);
}
delete result;
}
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
if (!Instanceable())
{
CharacterDatabase.PExecute("INSERT INTO world VALUES ('%u', '')", GetId());
}
}
}
else
{
DEBUG_LOG("New instance data, \"%s\" ,initialized!", sScriptMgr.GetScriptName(i_script_id));
i_data->Initialize();
}
}
/*
void Map::CreateInstanceData(bool load)
@ -1399,13 +1397,13 @@ bool DungeonMap::Add(Player* player)
// Is it needed?
if (!CanEnter(player))
return false;
{ return false; }
// check for existing instance binds
InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), GetDifficulty());
if (playerBind && playerBind->perm)
{
// cannot enter other instances if bound permanently
// can not enter other instances if bound permanently
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",
@ -1447,10 +1445,10 @@ bool DungeonMap::Add(Player* player)
// bind to the group or keep using the group save
if (!groupBind)
pGroup->BindToInstance(GetPersistanceState(), false);
{ pGroup->BindToInstance(GetPersistanceState(), false); }
else
{
// cannot jump to a different instance without resetting it
// can not jump to a different instance without resetting it
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!",
@ -1463,9 +1461,9 @@ bool DungeonMap::Add(Player* player)
GetPersistanceState()->GetPlayerCount(), GetPersistanceState()->GetGroupCount());
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
sLog.outError("GroupBind save NULL");
{ sLog.outError("GroupBind save NULL"); }
MANGOS_ASSERT(false);
}
// 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
if (!playerBind)
player->BindToInstance(GetPersistanceState(), false);
{ player->BindToInstance(GetPersistanceState(), false); }
else
// cannot jump to a different instance without resetting it
MANGOS_ASSERT(playerBind->state == GetPersistentState());
// can not jump to a different instance without resetting it
{ MANGOS_ASSERT(playerBind->state == GetPersistentState()); }
}
}
@ -1501,7 +1499,7 @@ bool DungeonMap::Add(Player* player)
m_resetAfterUnload = 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);
return true;
@ -1518,7 +1516,7 @@ void DungeonMap::Remove(Player* player, bool remove)
// if last player set unload timer
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);
@ -1540,7 +1538,7 @@ bool DungeonMap::Reset(InstanceResetMethod method)
{
// notify the players to leave the instance so it can be reset
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
itr->getSource()->SendResetFailedNotify(GetId());
{ itr->getSource()->SendResetFailedNotify(GetId()); }
}
else
{
@ -1548,7 +1546,7 @@ bool DungeonMap::Reset(InstanceResetMethod method)
{
// set the homebind timer for players inside (1 minute)
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
@ -1574,7 +1572,7 @@ void DungeonMap::PermBindAllPlayers(Player* player)
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
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
InstancePlayerBind* bind = plr->GetBoundInstance(GetId(), GetDifficulty());
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 (group && group->GetLeaderGuid() == plr->GetObjectGuid())
group->BindToInstance(GetPersistanceState(), true);
{ group->BindToInstance(GetPersistanceState(), true); }
}
}
void DungeonMap::UnloadAll(bool pForce)
{
TeleportAllPlayersTo(TELEPORT_LOCATION_HOMEBIND);
if (m_resetAfterUnload == true)
GetPersistanceState()->DeleteRespawnTimes();
{ GetPersistanceState()->DeleteRespawnTimes(); }
Map::UnloadAll(pForce);
}
@ -1657,10 +1655,10 @@ void BattleGroundMap::InitVisibilityDistance()
bool BattleGroundMap::CanEnter(Player* player)
{
if (!Map::CanEnter(player))
return false;
{ return false; }
if (player->GetBattleGroundId() != GetInstanceId())
return false;
{ return false; }
// player number limit is checked in bgmgr, no need to do it here
return true;
@ -1669,7 +1667,7 @@ bool BattleGroundMap::CanEnter(Player* player)
bool BattleGroundMap::Add(Player* player)
{
if (!CanEnter(player))
return false;
{ return false; }
// reset instance validity, battleground maps do not homebind
player->m_InstanceValid = true;
@ -1718,7 +1716,7 @@ bool Map::ScriptsStart(ScriptMapMapName const& scripts, uint32 id, Object* sourc
///- Find the script map
ScriptMapMap::const_iterator s = scripts.second.find(id);
if (s == scripts.second.end())
return false;
{ return false; }
// prepare static data
ObjectGuid sourceGuid = source->GetObjectGuid();
@ -1773,7 +1771,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
void Map::ScriptsProcess()
{
if (m_scriptSchedule.empty())
return;
{ return; }
///- Process overdue queued scripts
ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
@ -1797,7 +1795,7 @@ void Map::ScriptsProcess()
sScriptMgr.DecreaseScheduledScriptCount();
}
else
++rmItr;
{ ++rmItr; }
}
}
else
@ -1906,7 +1904,7 @@ DynamicObject* Map::GetDynamicObject(ObjectGuid guid)
Unit* Map::GetUnit(ObjectGuid guid)
{
if (guid.IsPlayer())
return GetPlayer(guid);
{ return GetPlayer(guid); }
return GetAnyTypeCreature(guid);
}
@ -1985,7 +1983,7 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
*/
class StaticMonsterChatBuilder
{
public:
public:
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)
{
@ -2059,9 +2057,7 @@ void Map::MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, Language lan
Map::PlayerList const& pList = GetPlayers();
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();
for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
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;
switch (unit->GetTypeId())
{
case TYPEID_PLAYER:
isFlying = static_cast<Player*>(unit)->IsFlying();
break;
case TYPEID_UNIT:
isFlying = static_cast<Creature*>(unit)->IsFlying();
isSwimming = static_cast<Creature*>(unit)->IsSwimming();
break;
default:
sLog.outError("Map::GetReachableRandomPosition> Unsupported unit type is passed!");
return false;
case TYPEID_PLAYER:
isFlying = static_cast<Player*>(unit)->IsFlying();
break;
case TYPEID_UNIT:
isFlying = static_cast<Creature*>(unit)->IsFlying();
isSwimming = static_cast<Creature*>(unit)->IsSwimming();
break;
default:
sLog.outError("Map::GetReachableRandomPosition> Unsupported unit type is passed!");
return false;
}
if (radius < 0.1f)