diff options
author | Trazom62 <none@none> | 2010-03-19 22:28:00 +0100 |
---|---|---|
committer | Trazom62 <none@none> | 2010-03-19 22:28:00 +0100 |
commit | 7a8dff70ed6ff534681a8e839f7b2d6a35fa7692 (patch) | |
tree | c4f0bf8bf500dc260a459d3ef14717a0d91646c1 /src | |
parent | b6258cf1cffdf3ac5b64f0d92bc825c989703208 (diff) |
Fix Object::IsInMap to check instanceId.
Fig group loot distance checks to also check map instanceId.
Fixes issue #1172.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Group.cpp | 14 | ||||
-rw-r--r-- | src/game/Object.h | 9 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 23fbf1f1010..e25e098d06b 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -609,7 +609,7 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) continue; if (i->AllowedForPlayer(member)) { - if (member->IsWithinDist(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (member->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { r->playerVote[member->GetGUID()] = NOT_EMITED_YET; r->totalPlayersRolling++; @@ -674,7 +674,7 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject) if (playerToRoll->CanUseItem(item) && i->AllowedForPlayer(playerToRoll)) { - if (playerToRoll->IsWithinDist(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (playerToRoll->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET; r->totalPlayersRolling++; @@ -724,7 +724,7 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) if (!looter->IsInWorld()) continue; - if (looter->IsWithinDist(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (looter->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { data << looter->GetGUID(); ++real_count; @@ -736,7 +736,7 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player *looter = itr->getSource(); - if (looter->IsWithinDist(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (looter->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) looter->GetSession()->SendPacket(&data); } } @@ -1437,7 +1437,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) { // not update if only update if need and ok Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid); - if (looter && looter->IsWithinDist(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (looter && looter->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) return; } ++guid_itr; @@ -1448,7 +1448,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr) { if (Player* pl = ObjectAccessor::FindPlayer(itr->guid)) - if (pl->IsWithinDist(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (pl->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { pNewLooter = pl; break; @@ -1461,7 +1461,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr) { if (Player* pl = ObjectAccessor::FindPlayer(itr->guid)) - if (pl->IsWithinDist(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (pl->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { pNewLooter = pl; break; diff --git a/src/game/Object.h b/src/game/Object.h index dd8b808b920..82da2e4bdb6 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -560,10 +560,13 @@ class WorldObject : public Object, public WorldLocation bool IsInMap(const WorldObject* obj) const { - if (obj) - return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj); - else + if (!obj || !IsInWorld() || !(obj->IsInWorld()) || GetMap() != obj->GetMap() || !InSamePhase(obj)) + return false; + + if (GetMap()->Instanceable() && GetInstanceId() != obj->GetInstanceId()) return false; + + return true; } bool IsWithinDist3d(float x, float y, float z, float dist) const { return IsInDist(x, y, z, dist + GetObjectSize()); } |