diff options
39 files changed, 197 insertions, 197 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 62d7a1f4f58..8f3bf52c37e 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -1177,7 +1177,7 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 target, Unit* actionInvoker Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff) { - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1199,7 +1199,7 @@ Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff) void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range) { - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1214,7 +1214,7 @@ void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range) void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid) { - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 2322e88d105..95c07b665ae 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -363,7 +363,7 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float minimumRange) { Player* player = NULL; - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index f210f077fdd..06c1570ccd9 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -218,7 +218,7 @@ void npc_escortAI::UpdateAI(uint32 const diff) if (m_bCanReturnToStart) { float fRetX, fRetY, fRetZ; - me->GetRespawnCoord(fRetX, fRetY, fRetZ); + me->GetRespawnPosition(fRetX, fRetY, fRetZ); me->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 54c69080c41..650ae1b8efe 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2878,7 +2878,7 @@ uint32 SmartScript::DoChat(int8 id, uint64 whisperGuid) Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) { if (!me) return NULL; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -2897,7 +2897,7 @@ Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) void SmartScript::DoFindFriendlyCC(std::list<Creature*>& _list, float range) { if (!me) return; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -2913,7 +2913,7 @@ void SmartScript::DoFindFriendlyCC(std::list<Creature*>& _list, float range) void SmartScript::DoFindFriendlyMissingBuff(std::list<Creature*>& list, float range, uint32 spellid) { if (!me) return; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index aa4eeb602c0..d102c579abb 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -155,7 +155,7 @@ class SmartScript { GameObject* gameObject = NULL; - CellPair p(Trinity::ComputeCellPair(searchObject->GetPositionX(), searchObject->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -171,7 +171,7 @@ class SmartScript Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const { Creature* crea = NULL; - CellPair p(Trinity::ComputeCellPair(searchObject->GetPositionX(), searchObject->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index fca4df12587..ce03fb3ca87 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -666,7 +666,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) // if player is in world he can tell his friends about new achievement else if (GetPlayer()->IsInWorld()) { - CellPair p = Trinity::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 8d03530c7f9..5be49fb433d 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -1240,7 +1240,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object { // search near player then - CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index e76cbfcc76b..ade4c38ad2e 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -3470,7 +3470,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/) return true; } - CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index cdd5d61b1c9..31cc21659c9 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -95,7 +95,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) SetFloatValue(OBJECT_FIELD_SCALE_X, 1); SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID()); - m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); + _gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()); return true; } @@ -211,7 +211,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field* fields) return false; } - m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); + _gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()); return true; } diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index bd68eb688f5..2e45606b88f 100755 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -70,8 +70,8 @@ class Corpse : public WorldObject, public GridObject<Corpse> void ResetGhostTime() { m_time = time(NULL); } CorpseType GetType() const { return m_type; } - GridPair const& GetGrid() const { return m_grid; } - void SetGrid(GridPair const& grid) { m_grid = grid; } + GridCoord const& GetGridCoord() const { return _gridCoord; } + void SetGridCoord(GridCoord const& gridCoord) { _gridCoord = gridCoord; } Loot loot; // remove insignia ONLY at BG Player* lootRecipient; @@ -88,7 +88,7 @@ class Corpse : public WorldObject, public GridObject<Corpse> private: CorpseType m_type; time_t m_time; - GridPair m_grid; // gride for corpse position for fast search + GridCoord _gridCoord; // gride for corpse position for fast search }; #endif diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index f9930fd47c7..a4dfe76dd21 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -245,7 +245,7 @@ void Creature::RemoveCorpse(bool setSpawnTime) m_respawnTime = time(NULL) + respawnDelay; float x, y, z, o; - GetRespawnCoord(x, y, z, &o); + GetRespawnPosition(x, y, z, &o); SetHomePosition(x, y, z, o); GetMap()->CreatureRelocation(this, x, y, z, o); } @@ -659,7 +659,7 @@ void Creature::DoFleeToGetAssistance() { Creature* creature = NULL; - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1760,7 +1760,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* pVictim) // select nearest hostile unit within the given distance (regardless of threat list). Unit* Creature::SelectNearestTarget(float dist) const { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1787,7 +1787,7 @@ Unit* Creature::SelectNearestTarget(float dist) const // select nearest hostile unit within the given attack distance (i.e. distance is ignored if > than ATTACK_DISTANCE), regardless of threat list. Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1850,7 +1850,7 @@ void Creature::CallAssistance() std::list<Creature*> assistList; { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1883,7 +1883,7 @@ void Creature::CallForHelp(float fRadius) if (fRadius <= 0.0f || !getVictim() || isPet() || isCharmed()) return; - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -2205,7 +2205,7 @@ time_t Creature::GetRespawnTimeEx() const return now; } -void Creature::GetRespawnCoord(float &x, float &y, float &z, float* ori, float* dist) const +void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, float* dist) const { if (m_DBTableGuid) { diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 5a3c80234d8..9f5d8ec202e 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -456,7 +456,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } void Update(uint32 time); // overwrited Unit::Update - void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; + void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; uint32 GetEquipmentId() const { return GetCreatureInfo()->equipmentId; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index c58cf9d59e0..c00ceacaf65 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -931,7 +931,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target) GameObject* trapGO = NULL; { // using original GO distance - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -951,7 +951,7 @@ GameObject* GameObject::LookupFishingHoleAround(float range) { GameObject* ok = NULL; - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; Trinity::NearestGameObjectFishingHole u_check(*this, range); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index c55892c6f82..5e020941a2a 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1868,7 +1868,7 @@ namespace Trinity void WorldObject::MonsterSay(const char* text, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -1883,7 +1883,7 @@ void WorldObject::MonsterSay(const char* text, uint32 language, uint64 TargetGui void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -1898,7 +1898,7 @@ void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid) void WorldObject::MonsterYell(const char* text, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -1913,7 +1913,7 @@ void WorldObject::MonsterYell(const char* text, uint32 language, uint64 TargetGu void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -1948,7 +1948,7 @@ void WorldObject::MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsB void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -2395,7 +2395,7 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const { - CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -2409,7 +2409,7 @@ void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const { - CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -2529,7 +2529,7 @@ void WorldObject::GetNearPoint(WorldObject const* /*searcher*/, float &x, float // adding used positions around object { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -2826,7 +2826,7 @@ struct WorldObjectChangeAccumulator void WorldObject::BuildUpdate(UpdateDataMapType& data_map) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index f98702d4393..306d19d2001 100755 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -216,8 +216,8 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse) return; // build mapid*cellid -> guid_set map - CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); - uint32 cell_id = (cell_pair.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); + uint32 cell_id = (cellCoord.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID())); @@ -237,20 +237,20 @@ void ObjectAccessor::AddCorpse(Corpse* corpse) i_player2corpse[corpse->GetOwnerGUID()] = corpse; // build mapid*cellid -> guid_set map - CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); - uint32 cell_id = (cell_pair.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); + uint32 cell_id = (cellCoord.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId()); } } -void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid, Map* map) +void ObjectAccessor::AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map) { ACE_GUARD(LockType, g, i_corpseGuard); for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter) { - if (iter->second->GetGrid() == gridpair) + if (iter->second->GetGridCoord() == gridpair) { // verify, if the corpse in our instance (add only corpses which are) if (map->Instanceable()) @@ -301,7 +301,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia for (uint8 i = OBJECT_FIELD_TYPE + 1; i < CORPSE_END; ++i) // don't overwrite guid and object type bones->SetUInt32Value(i, corpse->GetUInt32Value(i)); - bones->SetGrid(corpse->GetGrid()); + bones->SetGridCoord(corpse->GetGridCoord()); // bones->m_time = m_time; // don't overwrite time // bones->m_type = m_type; // don't overwrite type bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation()); diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index a9be8b4971f..27bc47269e9 100755 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -155,14 +155,14 @@ class ObjectAccessor if (!obj || obj->GetMapId() != mapid) return NULL; - CellPair p = Trinity::ComputeCellPair(x, y); + CellCoord p = Trinity::ComputeCellCoord(x, y); if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog->outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); return NULL; } - CellPair q = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog->outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); @@ -250,7 +250,7 @@ class ObjectAccessor Corpse* GetCorpseForPlayerGUID(uint64 guid); void RemoveCorpse(Corpse* corpse); void AddCorpse(Corpse* corpse); - void AddCorpsesToGrid(GridPair const& gridpair, GridType& grid, Map* map); + void AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map); Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false); void RemoveOldCorpses(); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index ae7e2d57991..b9eab8588fe 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1568,8 +1568,8 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.creatures.insert(guid); @@ -1584,8 +1584,8 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data) { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.creatures.erase(guid); @@ -1880,8 +1880,8 @@ void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.gameobjects.insert(guid); @@ -1896,8 +1896,8 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.gameobjects.erase(guid); diff --git a/src/server/game/Grids/Cells/Cell.h b/src/server/game/Grids/Cells/Cell.h index 56c4d96e427..ba396106f46 100755 --- a/src/server/game/Grids/Cells/Cell.h +++ b/src/server/game/Grids/Cells/Cell.h @@ -49,7 +49,7 @@ struct CellArea CellArea(int right, int left, int upper, int lower) : right_offset(right), left_offset(left), upper_offset(upper), lower_offset(lower) {} bool operator!() const { return !right_offset && !left_offset && !upper_offset && !lower_offset; } - void ResizeBorders(CellPair& begin_cell, CellPair& end_cell) const + void ResizeBorders(CellCoord& begin_cell, CellCoord& end_cell) const { begin_cell.dec_x(left_offset); begin_cell.dec_y(lower_offset); @@ -67,7 +67,7 @@ struct Cell { Cell() { data.All = 0; } Cell(const Cell &cell) { data.All = cell.data.All; } - explicit Cell(CellPair const& p); + explicit Cell(CellCoord const& p); void operator|=(Cell &cell) { @@ -131,9 +131,9 @@ struct Cell bool NoCreate() const { return data.Part.nocreate; } void SetNoCreate() { data.Part.nocreate = 1; } - CellPair cellPair() const + CellCoord GetCellCoord() const { - return CellPair( + return CellCoord( data.Part.grid_x*MAX_NUMBER_OF_CELLS+data.Part.cell_x, data.Part.grid_y*MAX_NUMBER_OF_CELLS+data.Part.cell_y); } @@ -160,15 +160,15 @@ struct Cell uint32 All; } data; - template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &) const; - template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, const WorldObject&, float) const; - template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, float, float, float) const; + template<class T, class CONTAINER> void Visit(const CellCoord&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &) const; + template<class T, class CONTAINER> void Visit(const CellCoord&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, const WorldObject&, float) const; + template<class T, class CONTAINER> void Visit(const CellCoord&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, float, float, float) const; static CellArea CalculateCellArea(const WorldObject &obj, float radius); static CellArea CalculateCellArea(float x, float y, float radius); private: - template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair&, const CellPair&) const; + template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, const CellCoord&, const CellCoord&) const; }; #endif diff --git a/src/server/game/Grids/Cells/CellImpl.h b/src/server/game/Grids/Cells/CellImpl.h index 77cf6a0b5c0..18337f8fadc 100755..100644 --- a/src/server/game/Grids/Cells/CellImpl.h +++ b/src/server/game/Grids/Cells/CellImpl.h @@ -25,7 +25,7 @@ #include "Map.h" #include "Object.h" -inline Cell::Cell(CellPair const& p) +inline Cell::Cell(CellCoord const& p) { data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS; data.Part.grid_y = p.y_coord / MAX_NUMBER_OF_CELLS; @@ -37,7 +37,7 @@ inline Cell::Cell(CellPair const& p) template<class T, class CONTAINER> inline void -Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m) const +Cell::Visit(const CellCoord& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m) const { if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) return; @@ -50,8 +50,8 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v } // set up the cell range based on the district - CellPair begin_cell = standing_cell; - CellPair end_cell = standing_cell; + CellCoord begin_cell = standing_cell; + CellCoord end_cell = standing_cell; switch (district) { @@ -119,8 +119,8 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v { for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; y++) { - CellPair cell_pair(x, y); - Cell r_zone(cell_pair); + CellCoord cellCoord(x, y); + Cell r_zone(cellCoord); r_zone.data.Part.nocreate = this->data.Part.nocreate; m.Visit(r_zone, visitor); } @@ -168,7 +168,7 @@ inline CellArea Cell::CalculateCellArea(float x, float y, float radius) template<class T, class CONTAINER> inline void -Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, float radius, float x_off, float y_off) const +Cell::Visit(const CellCoord& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, float radius, float x_off, float y_off) const { if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) return; @@ -194,8 +194,8 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v return; } - CellPair begin_cell = standing_cell; - CellPair end_cell = standing_cell; + CellCoord begin_cell = standing_cell; + CellCoord end_cell = standing_cell; area.ResizeBorders(begin_cell, end_cell); //visit all cells, found in CalculateCellArea() @@ -217,11 +217,11 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v { for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; ++y) { - CellPair cell_pair(x, y); + CellCoord cellCoord(x, y); //lets skip standing cell since we already visited it - if (cell_pair != standing_cell) + if (cellCoord != standing_cell) { - Cell r_zone(cell_pair); + Cell r_zone(cellCoord); r_zone.data.Part.nocreate = this->data.Part.nocreate; m.Visit(r_zone, visitor); } @@ -231,7 +231,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v template<class T, class CONTAINER> inline void -Cell::Visit(const CellPair& l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject &obj, float radius) const +Cell::Visit(const CellCoord& l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject &obj, float radius) const { //we should increase search radius by object's radius, otherwise //we could have problems with huge creatures, which won't attack nearest players etc @@ -240,7 +240,7 @@ Cell::Visit(const CellPair& l, TypeContainerVisitor<T, CONTAINER> &visitor, Map template<class T, class CONTAINER> inline void -Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const +Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellCoord& begin_cell, const CellCoord& end_cell) const { //here is an algorithm for 'filling' circum-squared octagon uint32 x_shift = (uint32)ceilf((end_cell.x_coord - begin_cell.x_coord) * 0.3f - 0.5f); @@ -253,8 +253,8 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel { for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; ++y) { - CellPair cell_pair(x, y); - Cell r_zone(cell_pair); + CellCoord cellCoord(x, y); + Cell r_zone(cellCoord); r_zone.data.Part.nocreate = this->data.Part.nocreate; m.Visit(r_zone, visitor); } @@ -277,14 +277,14 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel { //we visit cells symmetrically from both sides, heading from center to sides and from up to bottom //e.g. filling 2 trapezoids after filling central cell strip... - CellPair cell_pair_left(x_start - step, y); - Cell r_zone_left(cell_pair_left); + CellCoord cellCoord_left(x_start - step, y); + Cell r_zone_left(cellCoord_left); r_zone_left.data.Part.nocreate = this->data.Part.nocreate; m.Visit(r_zone_left, visitor); //right trapezoid cell visit - CellPair cell_pair_right(x_end + step, y); - Cell r_zone_right(cell_pair_right); + CellCoord cellCoord_right(x_end + step, y); + Cell r_zone_right(cellCoord_right); r_zone_right.data.Part.nocreate = this->data.Part.nocreate; m.Visit(r_zone_right, visitor); } diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h index 0bd5a2db71c..70d38720005 100755..100644 --- a/src/server/game/Grids/GridDefines.h +++ b/src/server/game/Grids/GridDefines.h @@ -139,8 +139,8 @@ bool operator!=(const CoordPair<LIMIT> &p1, const CoordPair<LIMIT> &p2) return !(p1 == p2); } -typedef CoordPair<MAX_NUMBER_OF_GRIDS> GridPair; -typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellPair; +typedef CoordPair<MAX_NUMBER_OF_GRIDS> GridCoord; +typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellCoord; namespace Trinity { @@ -156,17 +156,17 @@ namespace Trinity return RET_TYPE(x_val, y_val); } - inline GridPair ComputeGridPair(float x, float y) + inline GridCoord ComputeGridCoord(float x, float y) { - return Compute<GridPair, CENTER_GRID_ID>(x, y, CENTER_GRID_OFFSET, SIZE_OF_GRIDS); + return Compute<GridCoord, CENTER_GRID_ID>(x, y, CENTER_GRID_OFFSET, SIZE_OF_GRIDS); } - inline CellPair ComputeCellPair(float x, float y) + inline CellCoord ComputeCellCoord(float x, float y) { - return Compute<CellPair, CENTER_GRID_CELL_ID>(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL); + return Compute<CellCoord, CENTER_GRID_CELL_ID>(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL); } - inline CellPair ComputeCellPair(float x, float y, float &x_off, float &y_off) + inline CellCoord ComputeCellCoord(float x, float y, float &x_off, float &y_off) { double x_offset = (double(x) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; double y_offset = (double(y) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; @@ -175,7 +175,7 @@ namespace Trinity int y_val = int(y_offset + CENTER_GRID_CELL_ID + 0.5f); x_off = (float(x_offset) - x_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; y_off = (float(y_offset) - y_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; - return CellPair(x_val, y_val); + return CellCoord(x_val, y_val); } inline void NormalizeMapCoord(float &c) diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index dc938859e92..0377713a520 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -215,7 +215,7 @@ void DelayedUnitRelocation::Visit(PlayerMapType &m) if (player != viewPoint && !viewPoint->IsPositionValid()) continue; - CellPair pair2(Trinity::ComputeCellPair(viewPoint->GetPositionX(), viewPoint->GetPositionY())); + CellCoord pair2(Trinity::ComputeCellCoord(viewPoint->GetPositionX(), viewPoint->GetPositionY())); Cell cell2(pair2); //cell.SetNoCreate(); need load cells around viewPoint or player, that's why its commented diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 0cd15143cee..af86af25db5 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -81,9 +81,9 @@ namespace Trinity { Map &i_map; Cell &cell; - CellPair &p; + CellCoord &p; const float i_radius; - DelayedUnitRelocation(Cell &c, CellPair &pair, Map &map, float radius) : + DelayedUnitRelocation(Cell &c, CellCoord &pair, Map &map, float radius) : i_map(map), cell(c), p(pair), i_radius(radius) {} template<class T> void Visit(GridRefManager<T> &) {} void Visit(CreatureMapType &); diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index ee488f404dc..68fc39b39eb 100755 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -82,19 +82,19 @@ class ObjectWorldLoader uint32 i_corpses; }; -template<class T> void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellPair const& /*cell_pair*/) +template<class T> void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellCoord const& /*cellCoord*/) { } -template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellPair const& cell_pair) +template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellCoord const& cellCoord) { - Cell cell(cell_pair); + Cell cell(cellCoord); obj->SetCurrentCell(cell); } template <class T> -void AddObjectHelper(CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map, T *obj) +void AddObjectHelper(CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* map, T *obj) { obj->GetGridRef().link(&m, obj); ObjectGridLoader::SetObjectCell(obj, cell); @@ -106,7 +106,7 @@ void AddObjectHelper(CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* m } template <class T> -void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map) +void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* map) { for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid) { @@ -123,7 +123,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> & } } -void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType &m, uint32 &count, Map* map) +void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapType &m, uint32 &count, Map* map) { if (cell_corpses.empty()) return; @@ -154,12 +154,12 @@ ObjectGridLoader::Visit(GameObjectMapType &m) { uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellPair cell_pair(x, y); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord(x, y); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); - LoadHelper(cell_guids.gameobjects, cell_pair, m, i_gameObjects, i_map); + LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map); } void @@ -167,12 +167,12 @@ ObjectGridLoader::Visit(CreatureMapType &m) { uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellPair cell_pair(x, y); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord(x, y); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); - LoadHelper(cell_guids.creatures, cell_pair, m, i_creatures, i_map); + LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map); } void @@ -180,12 +180,12 @@ ObjectWorldLoader::Visit(CorpseMapType &m) { uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellPair cell_pair(x, y); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord(x, y); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; // corpses are always added to spawn mode 0 and they are spawned by their instance id CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), 0, cell_id); - LoadHelper(cell_guids.corpses, cell_pair, m, i_corpses, i_map); + LoadHelper(cell_guids.corpses, cellCoord, m, i_corpses, i_map); } void diff --git a/src/server/game/Grids/ObjectGridLoader.h b/src/server/game/Grids/ObjectGridLoader.h index 5fc5dc47e71..e87860fa0ee 100755 --- a/src/server/game/Grids/ObjectGridLoader.h +++ b/src/server/game/Grids/ObjectGridLoader.h @@ -44,7 +44,7 @@ class ObjectGridLoader void LoadN(void); - template<class T> static void SetObjectCell(T* obj, CellPair const& cellPair); + template<class T> static void SetObjectCell(T* obj, CellCoord const& cellCoord); private: Cell i_cell; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 8824f302f56..44fb7b3fc83 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -141,9 +141,9 @@ void Map::LoadMap(int gx, int gy, bool reload) // load grid map for base map if (!m_parentMap->GridMaps[gx][gy]) - m_parentMap->EnsureGridCreated(GridPair(63-gx, 63-gy)); + m_parentMap->EnsureGridCreated(GridCoord(63-gx, 63-gy)); - ((MapInstanced*)(m_parentMap))->AddGridMapReference(GridPair(gx, gy)); + ((MapInstanced*)(m_parentMap))->AddGridMapReference(GridCoord(gx, gy)); GridMaps[gx][gy] = m_parentMap->GridMaps[gx][gy]; return; } @@ -265,7 +265,7 @@ void Map::RemoveFromGrid(T* obj, NGridType *grid, Cell const& cell) template<class T> void Map::SwitchGridContainers(T* obj, bool on) { - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); @@ -273,7 +273,7 @@ void Map::SwitchGridContainers(T* obj, bool on) } Cell cell(p); - if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) + if (!loaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); @@ -323,7 +323,7 @@ void Map::DeleteFromWorld(Player* pl) } void -Map::EnsureGridCreated(const GridPair &p) +Map::EnsureGridCreated(const GridCoord &p) { if (!getNGrid(p.x_coord, p.y_coord)) { @@ -376,7 +376,7 @@ Map::EnsureGridLoadedAtEnter(const Cell &cell, Player* player) bool Map::EnsureGridLoaded(const Cell &cell) { - EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); + EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(grid != NULL); @@ -390,7 +390,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) loader.LoadN(); // Add resurrectable corpses to world object list in grid - sObjectAccessor->AddCorpsesToGrid(GridPair(cell.GridX(), cell.GridY()), (*grid)(cell.CellX(), cell.CellY()), this); + sObjectAccessor->AddCorpsesToGrid(GridCoord(cell.GridX(), cell.GridY()), (*grid)(cell.CellX(), cell.CellY()), this); return true; } @@ -399,7 +399,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) void Map::LoadGrid(float x, float y) { - CellPair pair = Trinity::ComputeCellPair(x, y); + CellCoord pair = Trinity::ComputeCellCoord(x, y); Cell cell(pair); EnsureGridLoaded(cell); } @@ -408,7 +408,7 @@ bool Map::AddToMap(Player* player) { // Check if we are adding to correct map ASSERT (player->GetMap() == this); - CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog->outError("Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord); @@ -450,7 +450,7 @@ template<class T> void Map::AddToMap(T *obj) { - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); @@ -467,7 +467,7 @@ Map::AddToMap(T *obj) if (obj->isActiveObject()) EnsureGridLoadedAtEnter(cell); else - EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); + EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(grid != NULL); @@ -487,14 +487,14 @@ Map::AddToMap(T *obj) obj->UpdateObjectVisibility(true); } -bool Map::loaded(const GridPair &p) const +bool Map::loaded(const GridCoord &p) const { return (getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord)); } void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor, TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor) { - CellPair standing_cell(Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY())); + CellCoord standing_cell(Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY())); // Check for correctness of standing_cell, it also avoids problems with update_cell if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) @@ -502,7 +502,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj // the overloaded operators handle range checking // so there's no need for range checking inside the loop - CellPair begin_cell(standing_cell), end_cell(standing_cell); + CellCoord begin_cell(standing_cell), end_cell(standing_cell); //lets update mobs/objects in ALL visible cells around object! CellArea area = Cell::CalculateCellArea(*obj, obj->GetGridActivationRange()); area.ResizeBorders(begin_cell, end_cell); @@ -518,7 +518,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj continue; markCell(cell_id); - CellPair pair(x, y); + CellCoord pair(x, y); Cell cell(pair); cell.data.Part.reserved = CENTER_DISTRICT; cell.Visit(pair, gridVisitor, *this); @@ -620,8 +620,8 @@ void Map::ProcessRelocationNotifies(const uint32 diff) uint32 gx = grid->getX(), gy = grid->getY(); - CellPair cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); - CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); + CellCoord cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); + CellCoord cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); for (uint32 x = cell_min.x_coord; x < cell_max.x_coord; ++x) { @@ -631,7 +631,7 @@ void Map::ProcessRelocationNotifies(const uint32 diff) if (!isCellMarked(cell_id)) continue; - CellPair pair(x, y); + CellCoord pair(x, y); Cell cell(pair); cell.SetNoCreate(); @@ -661,8 +661,8 @@ void Map::ProcessRelocationNotifies(const uint32 diff) uint32 gx = grid->getX(), gy = grid->getY(); - CellPair cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); - CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); + CellCoord cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); + CellCoord cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); for (uint32 x = cell_min.x_coord; x < cell_max.x_coord; ++x) { @@ -672,7 +672,7 @@ void Map::ProcessRelocationNotifies(const uint32 diff) if (!isCellMarked(cell_id)) continue; - CellPair pair(x, y); + CellCoord pair(x, y); Cell cell(pair); cell.SetNoCreate(); Visit(cell, grid_notifier); @@ -687,7 +687,7 @@ void Map::RemoveFromMap(Player* player, bool remove) player->RemoveFromWorld(); SendRemoveTransports(player); - CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) sLog->outCrash("Map::Remove: Player is in invalid cell!"); else @@ -720,13 +720,13 @@ Map::RemoveFromMap(T *obj, bool remove) if (obj->isActiveObject()) RemoveFromActive(obj); - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) sLog->outError("Map::Remove: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); else { Cell cell(p); - if (loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) + if (loaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) { sLog->outStaticDebug("Remove object " UI64FMTD " from grid[%u, %u]", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); @@ -753,8 +753,8 @@ Map::PlayerRelocation(Player* player, float x, float y, float z, float orientati { ASSERT(player); - CellPair old_val = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - CellPair new_val = Trinity::ComputeCellPair(x, y); + CellCoord old_val = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); + CellCoord new_val = Trinity::ComputeCellCoord(x, y); Cell old_cell(old_val); Cell new_cell(new_val); @@ -785,7 +785,7 @@ Map::CreatureRelocation(Creature* creature, float x, float y, float z, float ang Cell old_cell = creature->GetCurrentCell(); - CellPair new_val = Trinity::ComputeCellPair(x, y); + CellCoord new_val = Trinity::ComputeCellCoord(x, y); Cell new_cell(new_val); if (!respawnRelocationOnFail && !getNGrid(new_cell.GridX(), new_cell.GridY())) @@ -849,11 +849,11 @@ void Map::MoveAllCreaturesInMoveList() continue; // do move or do move to respawn or remove creature if previous all fail - if (CreatureCellRelocation(c, Cell(Trinity::ComputeCellPair(c->_newPosition.m_positionX, c->_newPosition.m_positionY)))) + if (CreatureCellRelocation(c, Cell(Trinity::ComputeCellCoord(c->_newPosition.m_positionX, c->_newPosition.m_positionY)))) { // update pos c->Relocate(c->_newPosition); - //CreatureRelocationNotify(c, new_cell, new_cell.cellPair()); + //CreatureRelocationNotify(c, new_cell, new_cell.cellCoord()); c->UpdateObjectVisibility(false); } else @@ -924,14 +924,14 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) } // in diff. loaded grid normal creature - if (loaded(GridPair(new_cell.GridX(), new_cell.GridY()))) + if (loaded(GridCoord(new_cell.GridX(), new_cell.GridY()))) { #ifdef TRINITY_DEBUG sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif RemoveFromGrid(c, getNGrid(old_cell.GridX(), old_cell.GridY()), old_cell); - EnsureGridCreated(GridPair(new_cell.GridX(), new_cell.GridY())); + EnsureGridCreated(GridCoord(new_cell.GridX(), new_cell.GridY())); AddToGrid(c, getNGrid(new_cell.GridX(), new_cell.GridY()), new_cell); return true; @@ -947,8 +947,8 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) bool Map::CreatureRespawnRelocation(Creature* c, bool diffGridOnly) { float resp_x, resp_y, resp_z, resp_o; - c->GetRespawnCoord(resp_x, resp_y, resp_z, &resp_o); - CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y); + c->GetRespawnPosition(resp_x, resp_y, resp_z, &resp_o); + CellCoord resp_val = Trinity::ComputeCellCoord(resp_x, resp_y); Cell resp_cell(resp_val); //creature will be unloaded with grid @@ -967,7 +967,7 @@ bool Map::CreatureRespawnRelocation(Creature* c, bool diffGridOnly) { c->Relocate(resp_x, resp_y, resp_z, resp_o); c->GetMotionMaster()->Initialize(); // prevent possible problems with default move generators - //CreatureRelocationNotify(c, resp_cell, resp_cell.cellPair()); + //CreatureRelocationNotify(c, resp_cell, resp_cell.GetCellCoord()); c->UpdateObjectVisibility(false); return true; } @@ -1030,7 +1030,7 @@ bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll) VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId(), gx, gy); } else - ((MapInstanced*)m_parentMap)->RemoveGridMapReference(GridPair(gx, gy)); + ((MapInstanced*)m_parentMap)->RemoveGridMapReference(GridCoord(gx, gy)); GridMaps[gx][gy] = NULL; } @@ -1589,7 +1589,7 @@ inline GridMap* Map::GetGrid(float x, float y) int gy=(int)(32-y/SIZE_OF_GRIDS); //grid y // ensure GridMap is loaded - EnsureGridCreated(GridPair(63-gx, 63-gy)); + EnsureGridCreated(GridCoord(63-gx, 63-gy)); return GridMaps[gx][gy]; } @@ -1877,7 +1877,7 @@ bool Map::CheckGridIntegrity(Creature* c, bool moved) const { Cell const& cur_cell = c->GetCurrentCell(); - CellPair xy_val = Trinity::ComputeCellPair(c->GetPositionX(), c->GetPositionY()); + CellCoord xy_val = Trinity::ComputeCellCoord(c->GetPositionX(), c->GetPositionY()); Cell xy_cell(xy_val); if (xy_cell != cur_cell) { @@ -1897,7 +1897,7 @@ const char* Map::GetMapName() const return i_mapEntry ? i_mapEntry->name[sWorld->GetDefaultDbcLocale()] : "UNNAMEDMAP\x0"; } -void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair) +void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellCoord cellpair) { cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1906,7 +1906,7 @@ void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair) cell.Visit(cellpair, player_notifier, *this, *obj, obj->GetVisibilityRange()); } -void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair) +void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpair) { Trinity::VisibleNotifier notifier(*player); @@ -2135,8 +2135,8 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const ASSERT(x < MAX_NUMBER_OF_GRIDS); ASSERT(y < MAX_NUMBER_OF_GRIDS); - CellPair cell_min(x*MAX_NUMBER_OF_CELLS, y*MAX_NUMBER_OF_CELLS); - CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); + CellCoord cell_min(x*MAX_NUMBER_OF_CELLS, y*MAX_NUMBER_OF_CELLS); + CellCoord cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); //we must find visible range in cells so we unload only non-visible cells... float viewDist = GetVisibilityRange(); @@ -2151,7 +2151,7 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const { Player* plr = iter->getSource(); - CellPair p = Trinity::ComputeCellPair(plr->GetPositionX(), plr->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(plr->GetPositionX(), plr->GetPositionY()); if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) && (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord)) return true; @@ -2161,7 +2161,7 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const { WorldObject* obj = *iter; - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) && (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord)) return true; @@ -2178,13 +2178,13 @@ void Map::AddToActive(Creature* c) if (!c->isPet() && c->GetDBTableGUIDLow()) { float x, y, z; - c->GetRespawnCoord(x, y, z); - GridPair p = Trinity::ComputeGridPair(x, y); + c->GetRespawnPosition(x, y, z); + GridCoord p = Trinity::ComputeGridCoord(x, y); if (getNGrid(p.x_coord, p.y_coord)) getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock(); else { - GridPair p2 = Trinity::ComputeGridPair(c->GetPositionX(), c->GetPositionY()); + GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); sLog->outError("Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } @@ -2199,13 +2199,13 @@ void Map::RemoveFromActive(Creature* c) if (!c->isPet() && c->GetDBTableGUIDLow()) { float x, y, z; - c->GetRespawnCoord(x, y, z); - GridPair p = Trinity::ComputeGridPair(x, y); + c->GetRespawnPosition(x, y, z); + GridCoord p = Trinity::ComputeGridCoord(x, y); if (getNGrid(p.x_coord, p.y_coord)) getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock(); else { - GridPair p2 = Trinity::ComputeGridPair(c->GetPositionX(), c->GetPositionY()); + GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); sLog->outError("Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 0fff299feff..7dd7faedec2 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -263,18 +263,18 @@ class Map : public GridRefManager<NGridType> bool IsRemovalGrid(float x, float y) const { - GridPair p = Trinity::ComputeGridPair(x, y); + GridCoord p = Trinity::ComputeGridCoord(x, y); return !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL; } bool IsLoaded(float x, float y) const { - GridPair p = Trinity::ComputeGridPair(x, y); + GridCoord p = Trinity::ComputeGridCoord(x, y); return loaded(p); } - bool GetUnloadLock(const GridPair &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); } - void SetUnloadLock(const GridPair &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); } + bool GetUnloadLock(const GridCoord &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); } + void SetUnloadLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); } void LoadGrid(float x, float y); bool UnloadGrid(const uint32 x, const uint32 y, bool pForce); virtual void UnloadAll(); @@ -371,8 +371,8 @@ class Map : public GridRefManager<NGridType> void AddObjectToSwitchList(WorldObject* obj, bool on); virtual void DelayedUpdate(const uint32 diff); - void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair); - void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair); + void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellCoord cellpair); + void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpair); void resetMarkedCells() { marked_cells.reset(); } bool isCellMarked(uint32 pCellId) { return marked_cells.test(pCellId); } @@ -447,8 +447,8 @@ class Map : public GridRefManager<NGridType> bool _creatureToMoveLock; std::vector<Creature*> _creaturesToMove; - bool loaded(const GridPair &) const; - void EnsureGridCreated(const GridPair &); + bool loaded(const GridCoord &) const; + void EnsureGridCreated(const GridCoord &); bool EnsureGridLoaded(Cell const&); void EnsureGridLoadedAtEnter(Cell const&, Player* player = NULL); @@ -471,7 +471,7 @@ class Map : public GridRefManager<NGridType> void UpdateActiveCells(const float &x, const float &y, const uint32 t_diff); protected: - void SetUnloadReferenceLock(const GridPair &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); } + void SetUnloadReferenceLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); } ACE_Thread_Mutex Lock; @@ -624,7 +624,7 @@ Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor) const uint32 cell_x = cell.CellX(); const uint32 cell_y = cell.CellY(); - if (!cell.NoCreate() || loaded(GridPair(x, y))) + if (!cell.NoCreate() || loaded(GridCoord(x, y))) { EnsureGridLoaded(cell); getNGrid(x, y)->Visit(cell_x, cell_y, visitor); @@ -635,7 +635,7 @@ template<class NOTIFIER> inline void Map::VisitAll(const float &x, const float &y, float radius, NOTIFIER ¬ifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -651,7 +651,7 @@ template<class NOTIFIER> inline void Map::VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER ¬ifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -669,7 +669,7 @@ template<class NOTIFIER> inline void Map::VisitWorld(const float &x, const float &y, float radius, NOTIFIER ¬ifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -682,7 +682,7 @@ template<class NOTIFIER> inline void Map::VisitGrid(const float &x, const float &y, float radius, NOTIFIER ¬ifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h index 1913f0add51..af303ed0e9e 100755 --- a/src/server/game/Maps/MapInstanced.h +++ b/src/server/game/Maps/MapInstanced.h @@ -43,17 +43,17 @@ class MapInstanced : public Map Map* FindMap(uint32 InstanceId) const { return _FindMap(InstanceId); } bool DestroyInstance(InstancedMaps::iterator &itr); - void AddGridMapReference(const GridPair &p) + void AddGridMapReference(const GridCoord &p) { ++GridMapReference[p.x_coord][p.y_coord]; - SetUnloadReferenceLock(GridPair(63-p.x_coord, 63-p.y_coord), true); + SetUnloadReferenceLock(GridCoord(63-p.x_coord, 63-p.y_coord), true); } - void RemoveGridMapReference(GridPair const& p) + void RemoveGridMapReference(GridCoord const& p) { --GridMapReference[p.x_coord][p.y_coord]; if (!GridMapReference[p.x_coord][p.y_coord]) - SetUnloadReferenceLock(GridPair(63-p.x_coord, 63-p.y_coord), false); + SetUnloadReferenceLock(GridCoord(63-p.x_coord, 63-p.y_coord), false); } InstancedMaps &GetInstancedMaps() { return m_InstancedMaps; } diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 0b7abacad28..8b1c69362f2 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -292,7 +292,7 @@ void MapManager::DoDelayedMovesAndRemoves() bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y) { - GridPair p = Trinity::ComputeGridPair(x, y); + GridCoord p = Trinity::ComputeGridCoord(x, y); int gx=63-p.x_coord; int gy=63-p.y_coord; diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index b141f889196..8f51eccf791 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -270,7 +270,7 @@ inline GameObject* Map::_FindGameObject(WorldObject* pSearchObject, uint32 guid) { GameObject* pGameObject = NULL; - CellPair p(Trinity::ComputeCellPair(pSearchObject->GetPositionX(), pSearchObject->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(pSearchObject->GetPositionX(), pSearchObject->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -818,7 +818,7 @@ void Map::ScriptsProcess() { WorldObject* wSource = dynamic_cast <WorldObject*> (source); - CellPair p(Trinity::ComputeCellPair(wSource->GetPositionX(), wSource->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(wSource->GetPositionX(), wSource->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp index 83d92df4f7a..d1a70cd89de 100755 --- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp @@ -566,7 +566,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) Unit* unit = ObjectAccessor::GetUnit(*_player, guid); - CellPair p = Trinity::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 98b0303a30b..9fc74ae1345 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5711,7 +5711,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const // eff_radius == 0 float radius = GetSpellInfo()->GetMaxRange(false); - CellPair p(Trinity::ComputeCellPair(target->GetPositionX(), target->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(target->GetPositionX(), target->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 16243396ebb..c5e096b9a62 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -598,7 +598,7 @@ WorldObject* Spell::FindCorpseUsing() // non-standard target selection float max_range = m_spellInfo->GetMaxRange(false); - CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -5820,7 +5820,7 @@ SpellCastResult Spell::CheckItems() // check spell focus object if (m_spellInfo->RequiresSpellFocus) { - CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp index 2a270527fb8..eb791b35e58 100644 --- a/src/server/scripts/Commands/cs_gps.cpp +++ b/src/server/scripts/Commands/cs_gps.cpp @@ -70,7 +70,7 @@ public: return false; } } - CellPair cell_val = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord cell_val = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); Cell cell(cell_val); uint32 zone_id, area_id; @@ -89,7 +89,7 @@ public: float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); - GridPair p = Trinity::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY()); + GridCoord p = Trinity::ComputeGridCoord(obj->GetPositionX(), obj->GetPositionY()); // 63? WHY? int gx = 63 - p.x_coord; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 4de719d684e..881e407d7c8 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -484,7 +484,7 @@ public: float x, y, z; me->GetPosition(x, y, z); - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index ba2d638d45f..026b2d2fda3 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -189,7 +189,7 @@ class boss_akilzon : public CreatureScript for (uint8 i = 2; i < StormCount; ++i) bp0 *= 2; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index d2ad81b4910..e49891f0b51 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -233,7 +233,7 @@ class boss_janalai : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -267,7 +267,7 @@ class boss_janalai : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -519,7 +519,7 @@ class mob_janalai_hatcher : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 17968766a5f..20fb8fdf68c 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -162,7 +162,7 @@ class boss_nalorakk : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 6186369a3a0..077ab9dda36 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -934,7 +934,7 @@ void hyjalAI::JustDied(Unit* /*killer*/) } void hyjalAI::HideNearPos(float x, float y) { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -961,7 +961,7 @@ void hyjalAI::HideNearPos(float x, float y) } void hyjalAI::RespawnNearPos(float x, float y) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -992,7 +992,7 @@ void hyjalAI::WaypointReached(uint32 i) } //do some talking //all alive guards walk near here - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1034,7 +1034,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) { if (TeleportTimer <= diff) { - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index dea3d6eaede..605f3a11c8a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -118,7 +118,7 @@ public: return; float x=0.0f, y=0.0f, z=0.0f; - me->GetRespawnCoord(x, y, z); + me->GetRespawnPosition(x, y, z); if (uiCheckDistanceTimer <= uiDiff) uiCheckDistanceTimer = 5*IN_MILLISECONDS; |