mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
*Some update of relocation notify.
--HG-- branch : trunk
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
using namespace Trinity;
|
||||
|
||||
void
|
||||
/*void
|
||||
Trinity::PlayerNotifier::Visit(PlayerMapType &m)
|
||||
{
|
||||
for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
@@ -45,7 +45,7 @@ Trinity::PlayerNotifier::Visit(PlayerMapType &m)
|
||||
for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it)
|
||||
(*it)->UpdateVisibilityOf(iter->getSource());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void
|
||||
VisibleChangesNotifier::Visit(PlayerMapType &m)
|
||||
@@ -68,6 +68,12 @@ VisibleNotifier::Visit(PlayerMapType &m)
|
||||
continue;
|
||||
|
||||
iter->getSource()->UpdateVisibilityOf(&i_player);
|
||||
//i_player.UpdateVisibilityOf(iter->getSource());
|
||||
|
||||
//if (!i_player.GetSharedVisionList().empty())
|
||||
// for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it)
|
||||
// (*it)->UpdateVisibilityOf(iter->getSource());
|
||||
|
||||
i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow);
|
||||
i_clientGUIDs.erase(iter->getSource()->GetGUID());
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ class Player;
|
||||
namespace Trinity
|
||||
{
|
||||
|
||||
struct TRINITY_DLL_DECL PlayerNotifier
|
||||
/*struct TRINITY_DLL_DECL PlayerNotifier
|
||||
{
|
||||
explicit PlayerNotifier(Player &pl) : i_player(pl) {}
|
||||
void Visit(PlayerMapType &);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
Player &i_player;
|
||||
};
|
||||
};*/
|
||||
|
||||
struct TRINITY_DLL_DECL VisibleNotifier
|
||||
{
|
||||
|
||||
+38
-17
@@ -657,24 +657,30 @@ void Map::RelocationNotify()
|
||||
{
|
||||
//creatures may be added to the list during update
|
||||
i_lock = true;
|
||||
|
||||
//Notify
|
||||
for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
||||
{
|
||||
Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL);
|
||||
if(!unit) continue;
|
||||
if(!unit)
|
||||
continue;
|
||||
|
||||
unit->m_Notified = true;
|
||||
|
||||
if(!unit->IsInWorld())
|
||||
continue;
|
||||
CellPair val = Trinity::ComputeCellPair(unit->GetPositionX(), unit->GetPositionY());
|
||||
Cell cell(val);
|
||||
cell.SetNoCreate();
|
||||
//if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
// PlayerRelocationNotify((Player*)unit, cell, val);
|
||||
//else
|
||||
// CreatureRelocationNotify((Creature*)unit, cell, val);
|
||||
|
||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
UpdatePlayerVisibility((Player*)unit, cell, val);
|
||||
UpdateObjectsVisibilityFor((Player*)unit, cell, val);
|
||||
//UpdatePlayerVisibility((Player*)unit, cell, val);
|
||||
//Trinity::PlayerNotifier pl_notifier(*player);
|
||||
//VisitWorld(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), pl_notifier);
|
||||
|
||||
//UpdateObjectsVisibilityFor((Player*)unit, cell, val);
|
||||
Trinity::VisibleNotifier ob_notifier(*((Player*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier);
|
||||
ob_notifier.Notify();
|
||||
|
||||
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||
}
|
||||
@@ -683,7 +689,20 @@ void Map::RelocationNotify()
|
||||
Trinity::CreatureRelocationNotifier notifier(*((Creature*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||
}
|
||||
|
||||
// Update visibility back to player who is controlling the unit
|
||||
if(unit->GetSharedVisionList().size())
|
||||
{
|
||||
for(SharedVisionList::const_iterator it = unit->GetSharedVisionList().begin(); it != unit->GetSharedVisionList().end(); ++it)
|
||||
{
|
||||
Trinity::VisibleNotifier ob_notifier(**it);
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier);
|
||||
ob_notifier.Notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Clear list
|
||||
for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
||||
{
|
||||
if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL))
|
||||
@@ -693,6 +712,7 @@ void Map::RelocationNotify()
|
||||
}
|
||||
}
|
||||
i_unitsToNotify.clear();
|
||||
|
||||
i_lock = false;
|
||||
}
|
||||
|
||||
@@ -814,7 +834,8 @@ void Map::Remove(Player *player, bool remove)
|
||||
|
||||
SendRemoveTransports(player);
|
||||
|
||||
UpdateObjectsVisibilityFor(player,cell,p);
|
||||
//UpdateObjectsVisibilityFor(player,cell,p);
|
||||
AddUnitToNotify(player);
|
||||
|
||||
if( remove )
|
||||
DeleteFromWorld(player);
|
||||
@@ -903,8 +924,8 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
|
||||
//UpdateObjectsVisibilityFor(player,new_cell,new_val);
|
||||
|
||||
// also update what possessing player sees
|
||||
if(player->isPossessedByPlayer())
|
||||
UpdateObjectsVisibilityFor((Player*)player->GetCharmer(), new_cell, new_val);
|
||||
//if(player->isPossessedByPlayer())
|
||||
// UpdateObjectsVisibilityFor((Player*)player->GetCharmer(), new_cell, new_val);
|
||||
|
||||
//PlayerRelocationNotify(player,new_cell,new_val);
|
||||
AddUnitToNotify(player);
|
||||
@@ -947,8 +968,8 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang
|
||||
{
|
||||
creature->Relocate(x, y, z, ang);
|
||||
// Update visibility back to player who is controlling the creature
|
||||
if(creature->isPossessedByPlayer())
|
||||
UpdateObjectsVisibilityFor((Player*)creature->GetCharmer(), new_cell, new_val);
|
||||
//if(creature->isPossessedByPlayer())
|
||||
// UpdateObjectsVisibilityFor((Player*)creature->GetCharmer(), new_cell, new_val);
|
||||
|
||||
//CreatureRelocationNotify(creature,new_cell,new_val);
|
||||
AddUnitToNotify(creature);
|
||||
@@ -1389,7 +1410,7 @@ void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair
|
||||
cell_lock->Visit(cell_lock, player_notifier, *this);
|
||||
}
|
||||
|
||||
void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
|
||||
/*void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
|
||||
{
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
|
||||
@@ -1398,7 +1419,7 @@ void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
|
||||
|
||||
CellLock<ReadGuard> cell_lock(cell, cellpair);
|
||||
cell_lock->Visit(cell_lock, player_notifier, *this);
|
||||
}
|
||||
}*/
|
||||
|
||||
void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpair )
|
||||
{
|
||||
|
||||
+1
-1
@@ -231,7 +231,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
||||
virtual bool RemoveBones(uint64 guid, float x, float y);
|
||||
|
||||
void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair);
|
||||
void UpdatePlayerVisibility(Player* player, Cell cell, CellPair cellpair);
|
||||
//void UpdatePlayerVisibility(Player* player, Cell cell, CellPair cellpair);
|
||||
void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair);
|
||||
|
||||
void resetMarkedCells() { marked_cells.reset(); }
|
||||
|
||||
@@ -1409,8 +1409,9 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
|
||||
return;
|
||||
}
|
||||
// Update visibility after vision change
|
||||
Cell cell(pair);
|
||||
GetPlayer()->GetMap()->UpdateObjectsVisibilityFor(_player, cell, pair);
|
||||
//Cell cell(pair);
|
||||
//GetPlayer()->GetMap()->UpdateObjectsVisibilityFor(_player, cell, pair);
|
||||
GetPlayer()->SetToNotify();
|
||||
}
|
||||
|
||||
void WorldSession::HandleChooseTitleOpcode( WorldPacket & recv_data )
|
||||
|
||||
@@ -583,7 +583,7 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)
|
||||
obj->GetMap()->UpdateObjectVisibility(obj,cell,p);
|
||||
}
|
||||
|
||||
void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
|
||||
/*void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
|
||||
{
|
||||
CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
|
||||
Cell cell(p);
|
||||
@@ -591,7 +591,7 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
|
||||
|
||||
m->UpdatePlayerVisibility(player,cell,p);
|
||||
m->UpdateObjectsVisibilityFor(player,cell,p);
|
||||
}
|
||||
}*/
|
||||
|
||||
/// Define the static member of HashMapHolder
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor
|
||||
static void _buildUpdateObject(Object* obj, UpdateDataMapType &);
|
||||
|
||||
static void UpdateObjectVisibility(WorldObject* obj);
|
||||
static void UpdateVisibilityForPlayer(Player* player);
|
||||
//static void UpdateVisibilityForPlayer(Player* player);
|
||||
private:
|
||||
struct WorldObjectChangeAccumulator
|
||||
{
|
||||
|
||||
@@ -948,6 +948,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
}
|
||||
if(m_MaxVisibleDistance < m_MaxVisibleDistanceInFlight)
|
||||
m_MaxVisibleDistance = m_MaxVisibleDistanceInFlight;
|
||||
m_MaxVisibleDistance += 1.0f;
|
||||
|
||||
///- Read the "Data" directory from the config file
|
||||
std::string dataPath = sConfig.GetStringDefault("DataDir","./");
|
||||
|
||||
Reference in New Issue
Block a user