From c4ddbead04aad3b080f3c255b688037154ad7357 Mon Sep 17 00:00:00 2001 From: SilverIce Date: Sun, 17 Oct 2010 19:19:47 +0300 Subject: [PATCH] [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 --- src/game/GridNotifiers.h | 2 -- src/game/GridNotifiersImpl.h | 17 ----------------- src/game/Map.cpp | 4 ---- src/game/Player.cpp | 5 ++++- src/game/Traveller.h | 2 +- src/shared/revision_nr.h | 2 +- 6 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index acce56b95..35fcd0eb9 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -150,7 +150,6 @@ namespace MaNGOS Player &i_player; PlayerRelocationNotifier(Player &pl) : i_player(pl) {} template void Visit(GridRefManager &) {} - void Visit(PlayerMapType &); void Visit(CreatureMapType &); }; @@ -1170,7 +1169,6 @@ namespace MaNGOS #ifndef WIN32 template<> void PlayerRelocationNotifier::Visit(CreatureMapType &); - template<> void PlayerRelocationNotifier::Visit(PlayerMapType &); template<> void CreatureRelocationNotifier::Visit(PlayerMapType &); template<> void CreatureRelocationNotifier::Visit(CreatureMapType &); template<> inline void DynamicObjectUpdater::Visit(CreatureMapType &); diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 8b50bf228..48e119b01 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -44,23 +44,6 @@ inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType &m) 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) { // update creature visibility at player/creature move diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 3a4c4401e..91c19e6c0 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -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()); - // 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()); RemoveFromGrid(player, oldGrid,old_cell); if( !old_cell.DiffGrid(new_cell) ) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 4fa2ced37..8012aa051 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6055,8 +6055,11 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele z = GetPositionZ(); // group update - if(GetGroup() && (old_x != x || old_y != y)) + if (GetGroup() && (old_x != x || old_y != y)) 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 diff --git a/src/game/Traveller.h b/src/game/Traveller.h index aab6f5835..9f8c44d89 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -141,7 +141,7 @@ inline float Traveller::GetMoveDestinationTo(float x, float y, float z) template<> inline void Traveller::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<> diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3f91c0098..9bd57889b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10615" + #define REVISION_NR "10616" #endif // __REVISION_NR_H__