[6850] Use the HashMapHolder instead of MapReference in Map::Update for now (the refs can get invalidated during the loop).

This commit is contained in:
Wyk3d 2008-11-27 00:22:03 +02:00
parent bdf7fb8394
commit ce387d8535
2 changed files with 12 additions and 3 deletions

View file

@ -573,12 +573,21 @@ void Map::Update(const uint32 &t_diff)
// for pets
TypeContainerVisitor<MaNGOS::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater);
for(MapRefManager::iterator iter = m_mapRefManager.begin(); iter != m_mapRefManager.end(); ++iter)
//TODO: Player guard
HashMapHolder<Player>::MapType& playerMap = HashMapHolder<Player>::GetContainer();
for(HashMapHolder<Player>::MapType::iterator iter = playerMap.begin(); iter != playerMap.end(); ++iter)
{
Player* plr = iter->getSource();
Player* plr = iter->second;
if(!plr->IsInWorld())
continue;
if(plr->GetMapId() != GetId())
continue;
if(plr->GetInstanceId() != GetInstanceId())
continue;
CellPair standing_cell(MaNGOS::ComputeCellPair(plr->GetPositionX(), plr->GetPositionY()));
// Check for correctness of standing_cell, it also avoids problems with update_cell

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6849"
#define REVISION_NR "6850"
#endif // __REVISION_NR_H__