Over 100 camangos Cata commits applied (to c12950)

Over 100 camangos Cata commits applied. up to and inclusing c12950.
This commit is contained in:
Charles A Edwards 2016-08-20 17:10:24 +01:00 committed by Antz
parent b4ec0440aa
commit eef77eadb9
117 changed files with 4314 additions and 3547 deletions

View file

@ -747,7 +747,7 @@ void Map::CreatureRelocation(Creature* creature, float x, float y, float z, floa
MANGOS_ASSERT(CheckGridIntegrity(creature, true));
}
bool Map::CreatureCellRelocation(Creature* c, Cell new_cell)
bool Map::CreatureCellRelocation(Creature* c, const Cell& new_cell)
{
Cell const& old_cell = c->GetCurrentCell();
if (old_cell.DiffGrid(new_cell))
@ -1311,6 +1311,32 @@ void Map::CreateInstanceData(bool load)
}
} */
void Map::TeleportAllPlayersTo(TeleportLocation loc)
{
while (HavePlayers())
{
if (Player* plr = m_mapRefManager.getFirst()->getSource())
{
// Teleport to specified location and removes the player from this map (if the map exists).
// Todo : we can add some specific location if needed (ex: map exit location for dungeon)
switch (loc)
{
case TELEPORT_LOCATION_HOMEBIND:
plr->TeleportToHomebind();
break;
case TELEPORT_LOCATION_BG_ENTRY_POINT:
plr->TeleportToBGEntryPoint();
break;
default:
break;
}
// just in case, remove the player from the list explicitly here as well to prevent a possible infinite loop
// note that this remove is not needed if the code works well in other places
plr->GetMapRef().unlink();
}
}
}
void Map::SetWeather(uint32 zoneId, WeatherType type, float grade, bool permanently)
{
Weather* wth = m_weatherSystem->FindOrCreateWeather(zoneId);
@ -1565,15 +1591,7 @@ void DungeonMap::PermBindAllPlayers(Player* player)
void DungeonMap::UnloadAll(bool pForce)
{
if (HavePlayers())
{
sLog.outError("DungeonMap::UnloadAll: there are still players in the instance at unload, should not happen!");
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
Player* plr = itr->getSource();
plr->TeleportToHomebind();
}
}
TeleportAllPlayersTo(TELEPORT_LOCATION_HOMEBIND);
if (m_resetAfterUnload == true)
GetPersistanceState()->DeleteRespawnTimes();
@ -1669,17 +1687,10 @@ void BattleGroundMap::SetUnload()
void BattleGroundMap::UnloadAll(bool pForce)
{
while (HavePlayers())
{
if (Player* plr = m_mapRefManager.getFirst()->getSource())
{
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
// TeleportTo removes the player from this map (if the map exists) -> calls BattleGroundMap::Remove -> invalidates the iterator.
// just in case, remove the player from the list explicitly here as well to prevent a possible infinite loop
// note that this remove is not needed if the code works well in other places
plr->GetMapRef().unlink();
}
}
TeleportAllPlayersTo(TELEPORT_LOCATION_BG_ENTRY_POINT);
Map::UnloadAll(pForce);
TeleportAllPlayersTo(TELEPORT_LOCATION_BG_ENTRY_POINT);
Map::UnloadAll(pForce);
}