mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9725] removed PlayerNotifier and related Map::UpdatePlayerVisibility function, used UpdateObjectVisibility instead
(based on SilverIce's repo commit e226019) Signed-off-by: VladimirMangos <vladimir@getmangos.com> Note: this changes not affect in any good/bad way recent problem with player guids.
This commit is contained in:
parent
20162b6db4
commit
53eeebf2fe
6 changed files with 6 additions and 58 deletions
|
|
@ -27,22 +27,6 @@
|
||||||
|
|
||||||
using namespace MaNGOS;
|
using namespace MaNGOS;
|
||||||
|
|
||||||
void
|
|
||||||
MaNGOS::PlayerNotifier::Visit(PlayerMapType &m)
|
|
||||||
{
|
|
||||||
WorldObject const* viewPoint = i_player.GetViewPoint();
|
|
||||||
|
|
||||||
for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
|
||||||
{
|
|
||||||
Player* player = iter->getSource();
|
|
||||||
if( player == &i_player )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
player->UpdateVisibilityOf(player->GetViewPoint(),&i_player);
|
|
||||||
i_player.UpdateVisibilityOf(viewPoint,player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VisibleChangesNotifier::Visit(PlayerMapType &m)
|
VisibleChangesNotifier::Visit(PlayerMapType &m)
|
||||||
{
|
{
|
||||||
|
|
@ -56,23 +40,6 @@ VisibleChangesNotifier::Visit(PlayerMapType &m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
VisibleNotifier::Visit(PlayerMapType &m)
|
|
||||||
{
|
|
||||||
WorldObject const* viewPoint = i_player.GetViewPoint();
|
|
||||||
|
|
||||||
for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
|
||||||
{
|
|
||||||
Player* player = iter->getSource();
|
|
||||||
if( player == &i_player )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
player->UpdateVisibilityOf(player->GetViewPoint(),&i_player);
|
|
||||||
i_player.UpdateVisibilityOf(viewPoint,player,i_data,i_data_updates,i_visibleNow);
|
|
||||||
i_clientGUIDs.erase(player->GetGUID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VisibleNotifier::Notify()
|
VisibleNotifier::Notify()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,6 @@ class Player;
|
||||||
|
|
||||||
namespace MaNGOS
|
namespace MaNGOS
|
||||||
{
|
{
|
||||||
|
|
||||||
struct MANGOS_DLL_DECL PlayerNotifier
|
|
||||||
{
|
|
||||||
explicit PlayerNotifier(Player &pl) : i_player(pl) {}
|
|
||||||
void Visit(PlayerMapType &);
|
|
||||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
|
||||||
Player &i_player;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MANGOS_DLL_DECL VisibleNotifier
|
struct MANGOS_DLL_DECL VisibleNotifier
|
||||||
{
|
{
|
||||||
Player &i_player;
|
Player &i_player;
|
||||||
|
|
@ -55,7 +46,6 @@ namespace MaNGOS
|
||||||
|
|
||||||
explicit VisibleNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {}
|
explicit VisibleNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {}
|
||||||
template<class T> void Visit(GridRefManager<T> &m);
|
template<class T> void Visit(GridRefManager<T> &m);
|
||||||
void Visit(PlayerMapType &);
|
|
||||||
void Notify(void);
|
void Notify(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ bool Map::Add(Player *player)
|
||||||
SendInitSelf(player);
|
SendInitSelf(player);
|
||||||
SendInitTransports(player);
|
SendInitTransports(player);
|
||||||
|
|
||||||
UpdatePlayerVisibility(player,cell,p);
|
UpdateObjectVisibility(player,cell,p);
|
||||||
UpdateObjectsVisibilityFor(player,cell,p);
|
UpdateObjectsVisibilityFor(player,cell,p);
|
||||||
|
|
||||||
AddNotifier(player,cell,p);
|
AddNotifier(player,cell,p);
|
||||||
|
|
@ -758,6 +758,7 @@ void Map::Remove(Player *player, bool remove)
|
||||||
RemoveFromGrid(player,grid,cell);
|
RemoveFromGrid(player,grid,cell);
|
||||||
|
|
||||||
SendRemoveTransports(player);
|
SendRemoveTransports(player);
|
||||||
|
UpdateObjectVisibility(player,cell,p);
|
||||||
UpdateObjectsVisibilityFor(player,cell,p);
|
UpdateObjectsVisibilityFor(player,cell,p);
|
||||||
|
|
||||||
player->ResetMap();
|
player->ResetMap();
|
||||||
|
|
@ -838,9 +839,10 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
|
||||||
}
|
}
|
||||||
|
|
||||||
// if move then update what player see and who seen
|
// if move then update what player see and who seen
|
||||||
UpdatePlayerVisibility(player,new_cell,new_val);
|
|
||||||
UpdateObjectsVisibilityFor(player,new_cell,new_val);
|
UpdateObjectsVisibilityFor(player,new_cell,new_val);
|
||||||
|
UpdateObjectVisibility(player, new_cell, new_val);
|
||||||
PlayerRelocationNotify(player,new_cell,new_val);
|
PlayerRelocationNotify(player,new_cell,new_val);
|
||||||
|
|
||||||
NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY());
|
NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY());
|
||||||
if( !same_cell && newGrid->GetGridState()!= GRID_STATE_ACTIVE )
|
if( !same_cell && newGrid->GetGridState()!= GRID_STATE_ACTIVE )
|
||||||
{
|
{
|
||||||
|
|
@ -2023,16 +2025,6 @@ void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair
|
||||||
cell.Visit(cellpair, player_notifier, *this, *obj, GetVisibilityDistance());
|
cell.Visit(cellpair, player_notifier, *this, *obj, GetVisibilityDistance());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
|
|
||||||
{
|
|
||||||
cell.data.Part.reserved = ALL_DISTRICT;
|
|
||||||
|
|
||||||
MaNGOS::PlayerNotifier pl_notifier(*player);
|
|
||||||
TypeContainerVisitor<MaNGOS::PlayerNotifier, WorldTypeMapContainer > player_notifier(pl_notifier);
|
|
||||||
|
|
||||||
cell.Visit(cellpair, player_notifier, *this, *player, GetVisibilityDistance());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpair )
|
void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpair )
|
||||||
{
|
{
|
||||||
MaNGOS::VisibleNotifier notifier(*player);
|
MaNGOS::VisibleNotifier notifier(*player);
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
||||||
void AddObjectToRemoveList(WorldObject *obj);
|
void AddObjectToRemoveList(WorldObject *obj);
|
||||||
|
|
||||||
void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair);
|
void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair);
|
||||||
void UpdatePlayerVisibility(Player* player, Cell cell, CellPair cellpair);
|
|
||||||
void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair);
|
void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair);
|
||||||
|
|
||||||
void resetMarkedCells() { marked_cells.reset(); }
|
void resetMarkedCells() { marked_cells.reset(); }
|
||||||
|
|
|
||||||
|
|
@ -21929,7 +21929,7 @@ void Player::UpdateVisibilityForPlayer()
|
||||||
CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));
|
CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
|
|
||||||
m->UpdatePlayerVisibility(this, cell, p);
|
m->UpdateObjectVisibility(this, cell, p);
|
||||||
|
|
||||||
if (this != viewPoint)
|
if (this != viewPoint)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9724"
|
#define REVISION_NR "9725"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue