diff options
-rw-r--r-- | src/game/Object.cpp | 11 | ||||
-rw-r--r-- | src/game/Unit.cpp | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 204d654d000..46a824b99c7 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1387,8 +1387,6 @@ float WorldObject::GetAngle( const float x, const float y ) const float dx = x - GetPositionX(); float dy = y - GetPositionY(); - if(!dx && !dy) - return 0; float ang = atan2(dy, dx); ang = (ang >= 0) ? ang : 2 * M_PI + ang; return ang; @@ -1430,6 +1428,15 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const float angle = GetAngle( obj ); angle -= m_orientation; + if(angle > 100 || angle < -100) + { + sLog.outCrash("Invalid Angle %f: this %u %u %f %f %f %f, that %u %u %f %f %f %f", angle, + GetEntry(), GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), + obj->GetEntry(), obj->GetGUIDLow(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation()); + assert(false); + return false; + } + // move angle to range -pi ... +pi while( angle > M_PI) angle -= 2.0f * M_PI; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2e576b00472..cc143c0add3 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -456,7 +456,7 @@ void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, uint32 attacker_number = getAttackers().size(); if(attacker_number > 0) --attacker_number; GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*rand_norm() - , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / combat_reach / 3 : 0)); + , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / combat_reach * 0.3 : 0)); } void Unit::RemoveMovementImpairingAuras() @@ -12416,7 +12416,7 @@ void Unit::StopMoving() //float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true); //if (fabs(GetPositionZ() - z) < 2.0f) // Relocate(GetPositionX(), GetPositionY(), z); - Relocate(GetPositionX(), GetPositionY(),GetPositionZ()); + //Relocate(GetPositionX(), GetPositionY(),GetPositionZ()); SendMonsterStop(); |