mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
Merge commit 'origin/master' into 320
Conflicts: src/game/Map.cpp src/game/MapInstanced.cpp src/game/Player.cpp src/game/SpellEffects.cpp src/game/Totem.cpp
This commit is contained in:
commit
1a47420fe8
43 changed files with 1208 additions and 714 deletions
|
|
@ -124,14 +124,12 @@ void Map::LoadMap(int gx,int gy, bool reload)
|
|||
if(GridMaps[gx][gy])
|
||||
return;
|
||||
|
||||
Map* baseMap = const_cast<Map*>(MapManager::Instance().CreateBaseMap(i_id));
|
||||
|
||||
// load grid map for base map
|
||||
if (!baseMap->GridMaps[gx][gy])
|
||||
baseMap->EnsureGridCreated(GridPair(63-gx,63-gy));
|
||||
if (!m_parentMap->GridMaps[gx][gy])
|
||||
m_parentMap->EnsureGridCreated(GridPair(63-gx,63-gy));
|
||||
|
||||
((MapInstanced*)(baseMap))->AddGridMapReference(GridPair(gx,gy));
|
||||
GridMaps[gx][gy] = baseMap->GridMaps[gx][gy];
|
||||
((MapInstanced*)(m_parentMap))->AddGridMapReference(GridPair(gx,gy));
|
||||
GridMaps[gx][gy] = m_parentMap->GridMaps[gx][gy];
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -184,11 +182,11 @@ void Map::DeleteStateMachine()
|
|||
delete si_GridStates[GRID_STATE_REMOVAL];
|
||||
}
|
||||
|
||||
Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
|
||||
Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _parent)
|
||||
: i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode),
|
||||
i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0),
|
||||
m_activeNonPlayersIter(m_activeNonPlayers.end()),
|
||||
i_gridExpiry(expiry)
|
||||
i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this)
|
||||
{
|
||||
for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
|
||||
{
|
||||
|
|
@ -295,6 +293,13 @@ void Map::DeleteFromWorld(T* obj)
|
|||
delete obj;
|
||||
}
|
||||
|
||||
template<>
|
||||
void Map::DeleteFromWorld(Player* pl)
|
||||
{
|
||||
ObjectAccessor::Instance().RemoveObject(pl);
|
||||
delete pl;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Map::AddNotifier(T* , Cell const& , CellPair const& )
|
||||
{
|
||||
|
|
@ -399,8 +404,7 @@ void Map::LoadGrid(const Cell& cell, bool no_unload)
|
|||
bool Map::Add(Player *player)
|
||||
{
|
||||
player->GetMapRef().link(this, player);
|
||||
|
||||
player->SetInstanceId(GetInstanceId());
|
||||
player->SetMap(this);
|
||||
|
||||
// update player state for other player and visa-versa
|
||||
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
|
||||
|
|
@ -431,6 +435,8 @@ Map::Add(T *obj)
|
|||
return;
|
||||
}
|
||||
|
||||
obj->SetMap(this);
|
||||
|
||||
Cell cell(p);
|
||||
if(obj->isActiveObject())
|
||||
EnsureGridLoadedAtEnter(cell);
|
||||
|
|
@ -688,8 +694,12 @@ void Map::Remove(Player *player, bool remove)
|
|||
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(remove)
|
||||
player->CleanupsBeforeDelete();
|
||||
|
||||
// invalid coordinates
|
||||
player->RemoveFromWorld();
|
||||
player->ResetMap();
|
||||
|
||||
if( remove )
|
||||
DeleteFromWorld(player);
|
||||
|
|
@ -709,13 +719,16 @@ void Map::Remove(Player *player, bool remove)
|
|||
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
|
||||
assert(grid != NULL);
|
||||
|
||||
if(remove)
|
||||
player->CleanupsBeforeDelete();
|
||||
|
||||
player->RemoveFromWorld();
|
||||
RemoveFromGrid(player,grid,cell);
|
||||
|
||||
SendRemoveTransports(player);
|
||||
|
||||
UpdateObjectsVisibilityFor(player,cell,p);
|
||||
|
||||
player->ResetMap();
|
||||
if( remove )
|
||||
DeleteFromWorld(player);
|
||||
}
|
||||
|
|
@ -760,6 +773,7 @@ Map::Remove(T *obj, bool remove)
|
|||
|
||||
UpdateObjectVisibility(obj,cell,p);
|
||||
|
||||
obj->ResetMap();
|
||||
if( remove )
|
||||
{
|
||||
// if option set then object already saved at this moment
|
||||
|
|
@ -1029,7 +1043,8 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool pForce)
|
|||
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId(), gy, gx);
|
||||
}
|
||||
else
|
||||
((MapInstanced*)(MapManager::Instance().CreateBaseMap(i_id)))->RemoveGridMapReference(GridPair(gx, gy));
|
||||
((MapInstanced*)m_parentMap)->RemoveGridMapReference(GridPair(gx, gy));
|
||||
|
||||
GridMaps[gx][gy] = NULL;
|
||||
}
|
||||
DEBUG_LOG("Unloading grid[%u,%u] for map %u finished", x,y, i_id);
|
||||
|
|
@ -2196,8 +2211,8 @@ template void Map::Remove(DynamicObject *, bool);
|
|||
|
||||
/* ******* Dungeon Instance Maps ******* */
|
||||
|
||||
InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
|
||||
: Map(id, expiry, InstanceId, SpawnMode),
|
||||
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)
|
||||
{
|
||||
|
|
@ -2534,8 +2549,8 @@ uint32 InstanceMap::GetMaxPlayers() const
|
|||
|
||||
/* ******* Battleground Instance Maps ******* */
|
||||
|
||||
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId)
|
||||
: Map(id, expiry, InstanceId, DUNGEON_DIFFICULTY_NORMAL)
|
||||
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent)
|
||||
: Map(id, expiry, InstanceId, DUNGEON_DIFFICULTY_NORMAL, _parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue