[9012] fix crash when achievement is completed and player isn't in world
--HG-- branch : trunk
This commit is contained in:
@@ -592,7 +592,8 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
||||
data << uint32(0); // 1=link supplied string as player name, 0=display plain string
|
||||
sWorld.SendGlobalMessage(&data);
|
||||
}
|
||||
else
|
||||
// if player is in world he can tell his friends about new achievement
|
||||
else if (GetPlayer()->IsInWorld())
|
||||
{
|
||||
CellPair p = MaNGOS::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY());
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
||||
Player* playerGroup = itr->getSource();
|
||||
if(!playerGroup)
|
||||
continue;
|
||||
if (player->IsWithinDist(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if (player->IsWithinDistInMap(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
playersNear.push_back(playerGroup);
|
||||
}
|
||||
|
||||
|
||||
@@ -736,7 +736,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
|
||||
if(corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType()==CORPSE_RESURRECTABLE_PVP) > time(NULL))
|
||||
return;
|
||||
|
||||
if (!corpse->IsWithinDist(GetPlayer(), CORPSE_RECLAIM_RADIUS, true))
|
||||
if (!corpse->IsWithinDistInMap(GetPlayer(), CORPSE_RECLAIM_RADIUS, true))
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
|
||||
@@ -1398,6 +1398,16 @@ bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2,
|
||||
return abs(sin(angle)) * GetExactDist2d(obj1->GetPositionX(), obj1->GetPositionY()) < size;
|
||||
}
|
||||
|
||||
bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const
|
||||
{
|
||||
return IsWithinDist(target, distance) && HasInArc( arc, target );
|
||||
}
|
||||
|
||||
bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const
|
||||
{
|
||||
return IsWithinDist(target, distance) && !HasInArc( 2 * M_PI - arc, target );
|
||||
}
|
||||
|
||||
void WorldObject::GetRandomPoint(const Position &pos, float distance, float &rand_x, float &rand_y, float &rand_z) const
|
||||
{
|
||||
if(!distance)
|
||||
|
||||
@@ -548,6 +548,8 @@ class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation
|
||||
bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const;
|
||||
bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
|
||||
bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
|
||||
bool isInFront(WorldObject const* target,float distance, float arc = M_PI) const;
|
||||
bool isInBack(WorldObject const* target, float distance, float arc = M_PI) const;
|
||||
|
||||
bool IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size = 0) const;
|
||||
|
||||
|
||||
+2
-2
@@ -734,11 +734,11 @@ namespace Trinity
|
||||
i_data->push_back(target);
|
||||
break;
|
||||
case PUSH_IN_FRONT:
|
||||
if(i_source->isInFrontInMap(target, i_radius, M_PI/3))
|
||||
if(i_source->isInFront(target, i_radius, M_PI/3))
|
||||
i_data->push_back(target);
|
||||
break;
|
||||
case PUSH_IN_BACK:
|
||||
if(i_source->isInBackInMap(target, i_radius, M_PI/3))
|
||||
if(i_source->isInBack(target, i_radius, M_PI/3))
|
||||
i_data->push_back(target);
|
||||
break;
|
||||
case PUSH_IN_LINE:
|
||||
|
||||
Reference in New Issue
Block a user