mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[10616] Simplified trade distance checks, GROUP_UPDATE_FLAG_POSITION flag handling moved out of Map
note: need avoid Map::PlayerRelocation calls now and use Player::SetPosition instead
This commit is contained in:
parent
608815855f
commit
c4ddbead04
6 changed files with 6 additions and 26 deletions
|
|
@ -150,7 +150,6 @@ namespace MaNGOS
|
||||||
Player &i_player;
|
Player &i_player;
|
||||||
PlayerRelocationNotifier(Player &pl) : i_player(pl) {}
|
PlayerRelocationNotifier(Player &pl) : i_player(pl) {}
|
||||||
template<class T> void Visit(GridRefManager<T> &) {}
|
template<class T> void Visit(GridRefManager<T> &) {}
|
||||||
void Visit(PlayerMapType &);
|
|
||||||
void Visit(CreatureMapType &);
|
void Visit(CreatureMapType &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1170,7 +1169,6 @@ namespace MaNGOS
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
template<> void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType &);
|
template<> void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType &);
|
||||||
template<> void PlayerRelocationNotifier::Visit<Player>(PlayerMapType &);
|
|
||||||
template<> void CreatureRelocationNotifier::Visit<Player>(PlayerMapType &);
|
template<> void CreatureRelocationNotifier::Visit<Player>(PlayerMapType &);
|
||||||
template<> void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType &);
|
template<> void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType &);
|
||||||
template<> inline void DynamicObjectUpdater::Visit<Creature>(CreatureMapType &);
|
template<> inline void DynamicObjectUpdater::Visit<Creature>(CreatureMapType &);
|
||||||
|
|
|
||||||
|
|
@ -44,23 +44,6 @@ inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType &m)
|
||||||
iter->getSource()->Update(i_timeDiff);
|
iter->getSource()->Update(i_timeDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m)
|
|
||||||
{
|
|
||||||
for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
|
||||||
{
|
|
||||||
if (&i_player==iter->getSource())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// visibility for players updated by ObjectAccessor::UpdateVisibilityFor calls in appropriate places
|
|
||||||
|
|
||||||
// Cancel Trade
|
|
||||||
if (i_player.GetTrader()==iter->getSource())
|
|
||||||
// iteraction distance
|
|
||||||
if (!i_player.IsWithinDistInMap(iter->getSource(), INTERACTION_DISTANCE))
|
|
||||||
i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void PlayerCreatureRelocationWorker(Player* pl, WorldObject const* viewPoint, Creature* c)
|
inline void PlayerCreatureRelocationWorker(Player* pl, WorldObject const* viewPoint, Creature* c)
|
||||||
{
|
{
|
||||||
// update creature visibility at player/creature move
|
// update creature visibility at player/creature move
|
||||||
|
|
|
||||||
|
|
@ -755,10 +755,6 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
|
||||||
{
|
{
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_PLAYER_MOVES, "Player %s relocation grid[%u,%u]cell[%u,%u]->grid[%u,%u]cell[%u,%u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
|
DEBUG_FILTER_LOG(LOG_FILTER_PLAYER_MOVES, "Player %s relocation grid[%u,%u]cell[%u,%u]->grid[%u,%u]cell[%u,%u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
|
||||||
|
|
||||||
// update player position for group at taxi flight
|
|
||||||
if(player->GetGroup() && player->IsTaxiFlying())
|
|
||||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
|
|
||||||
|
|
||||||
NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY());
|
NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY());
|
||||||
RemoveFromGrid(player, oldGrid,old_cell);
|
RemoveFromGrid(player, oldGrid,old_cell);
|
||||||
if( !old_cell.DiffGrid(new_cell) )
|
if( !old_cell.DiffGrid(new_cell) )
|
||||||
|
|
|
||||||
|
|
@ -6055,8 +6055,11 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
|
||||||
z = GetPositionZ();
|
z = GetPositionZ();
|
||||||
|
|
||||||
// group update
|
// group update
|
||||||
if(GetGroup() && (old_x != x || old_y != y))
|
if (GetGroup() && (old_x != x || old_y != y))
|
||||||
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
|
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
|
||||||
|
|
||||||
|
if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
|
||||||
|
GetSession()->SendCancelTrade(); // will clode both side trade windows
|
||||||
}
|
}
|
||||||
|
|
||||||
// code block for underwater state update
|
// code block for underwater state update
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ inline float Traveller<Player>::GetMoveDestinationTo(float x, float y, float z)
|
||||||
template<>
|
template<>
|
||||||
inline void Traveller<Player>::Relocation(float x, float y, float z, float orientation)
|
inline void Traveller<Player>::Relocation(float x, float y, float z, float orientation)
|
||||||
{
|
{
|
||||||
i_traveller.GetMap()->PlayerRelocation(&i_traveller, x, y, z, orientation);
|
i_traveller.SetPosition(x, y, z, orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10615"
|
#define REVISION_NR "10616"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue