refactor(Core/Misc): fabs() to std::fabs() (#9790)
- prefer std functions over C functions
This commit is contained in:
parent
ac99eb48e1
commit
913e65f97f
26 changed files with 43 additions and 43 deletions
|
|
@ -41,7 +41,7 @@ namespace VMAP
|
|||
const Vector3 p(ray.direction().cross(e2));
|
||||
const float a = e1.dot(p);
|
||||
|
||||
if (fabs(a) < EPS)
|
||||
if (std::fabs(a) < EPS)
|
||||
{
|
||||
// Determinant is ill-conditioned; abort early
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -234,8 +234,8 @@ public:
|
|||
//int Cycles = std::max((int)ceilf(max_dist/tMaxX),(int)ceilf(max_dist/tMaxY));
|
||||
//int i = 0;
|
||||
|
||||
float tDeltaX = voxel * fabs(kx_inv);
|
||||
float tDeltaY = voxel * fabs(ky_inv);
|
||||
float tDeltaX = voxel * std::fabs(kx_inv);
|
||||
float tDeltaY = voxel * std::fabs(ky_inv);
|
||||
do
|
||||
{
|
||||
if (Node* node = nodes[cell.x][cell.y])
|
||||
|
|
|
|||
|
|
@ -620,7 +620,7 @@ void npc_escortAI::GenerateWaypointArray(Movement::PointsArray* points)
|
|||
for (uint32 i = 1; i < pVector.size() - 1; ++i)
|
||||
{
|
||||
offset = middle - pVector[i];
|
||||
if (fabs(offset.x) >= 0xFF || fabs(offset.y) >= 0xFF || fabs(offset.z) >= 0x7F)
|
||||
if (std::fabs(offset.x) >= 0xFF || std::fabs(offset.y) >= 0xFF || std::fabs(offset.z) >= 0x7F)
|
||||
{
|
||||
// offset is too big, split points
|
||||
continueLoop = true;
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points)
|
|||
for (uint32 i = 1; i < pVector.size() - 1; ++i)
|
||||
{
|
||||
offset = middle - pVector[i];
|
||||
if (fabs(offset.x) >= 0xFF || fabs(offset.y) >= 0xFF || fabs(offset.z) >= 0x7F)
|
||||
if (std::fabs(offset.x) >= 0xFF || std::fabs(offset.y) >= 0xFF || std::fabs(offset.z) >= 0x7F)
|
||||
{
|
||||
// offset is too big, split points
|
||||
continueLoop = true;
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
|||
|
||||
// xinef: rozpierdol tc, niedojeby ze szok
|
||||
if (temp.action.type == SMART_ACTION_MOVE_TO_POS)
|
||||
if (temp.target.type == SMART_TARGET_SELF && (fabs(temp.target.x) > 200.0f || fabs(temp.target.y) > 200.0f || fabs(temp.target.z) > 200.0f))
|
||||
if (temp.target.type == SMART_TARGET_SELF && (std::fabs(temp.target.x) > 200.0f || std::fabs(temp.target.y) > 200.0f || std::fabs(temp.target.z) > 200.0f))
|
||||
temp.target.type = SMART_TARGET_POSITION;
|
||||
|
||||
// creature entry / guid not found in storage, create empty event list for it and increase counters
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ int32 ArenaTeam::GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating,
|
|||
// Work in progress:
|
||||
/*
|
||||
// This is a simulation, as there is not much info on how it really works
|
||||
float confidence_mod = min(1.0f - fabs(mod), 0.5f);
|
||||
float confidence_mod = min(1.0f - std::fabs(mod), 0.5f);
|
||||
|
||||
// Apply confidence factor to the mod:
|
||||
mod *= confidence_factor
|
||||
|
|
|
|||
|
|
@ -216,9 +216,9 @@ namespace lfg
|
|||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel - i._avgItemLevel) < 0.01f
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && std::fabs(_avgItemLevel - i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5 - i._mp5) < 0.01f && fabs(_mp5combat - i._mp5combat) < 0.01f
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && std::fabs(_mp5 - i._mp5) < 0.01f && std::fabs(_mp5combat - i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
|
|||
|
||||
// Xinef: this should be automatized, if turn angle is greater than PI/2 (90<39>) we should swap formation angle
|
||||
float followAngle = pFormationInfo.follow_angle;
|
||||
if (static_cast<float>(M_PI) - fabs(fabs(m_leader->GetOrientation() - pathAngle) - static_cast<float>(M_PI)) > static_cast<float>(M_PI)* 0.5f)
|
||||
if (static_cast<float>(M_PI) - std::fabs(std::fabs(m_leader->GetOrientation() - pathAngle) - static_cast<float>(M_PI)) > static_cast<float>(M_PI)* 0.5f)
|
||||
{
|
||||
// pussywizard: in both cases should be 2*M_PI - follow_angle
|
||||
// pussywizard: also, GetCurrentWaypointID() returns 0..n-1, while point_1 must be > 0, so +1
|
||||
|
|
|
|||
|
|
@ -1022,7 +1022,7 @@ bool Position::HasInLine(WorldObject const* target, float width) const
|
|||
return false;
|
||||
width += target->GetObjectSize();
|
||||
float angle = GetRelativeAngle(target);
|
||||
return fabs(sin(angle)) * GetExactDist2d(target->GetPositionX(), target->GetPositionY()) < width;
|
||||
return std::fabs(sin(angle)) * GetExactDist2d(target->GetPositionX(), target->GetPositionY()) < width;
|
||||
}
|
||||
|
||||
std::string Position::ToString() const
|
||||
|
|
@ -1247,7 +1247,7 @@ InstanceScript* WorldObject::GetInstanceScript() const
|
|||
|
||||
float WorldObject::GetDistanceZ(const WorldObject* obj) const
|
||||
{
|
||||
float dz = fabs(GetPositionZ() - obj->GetPositionZ());
|
||||
float dz = std::fabs(GetPositionZ() - obj->GetPositionZ());
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
float dist = dz - sizefactor;
|
||||
return (dist > 0 ? dist : 0);
|
||||
|
|
@ -1555,7 +1555,7 @@ void Position::GetSinCos(const float x, const float y, float& vsin, float& vcos)
|
|||
float dx = GetPositionX() - x;
|
||||
float dy = GetPositionY() - y;
|
||||
|
||||
if (fabs(dx) < 0.001f && fabs(dy) < 0.001f)
|
||||
if (std::fabs(dx) < 0.001f && std::fabs(dy) < 0.001f)
|
||||
{
|
||||
float angle = (float)rand_norm() * static_cast<float>(2 * M_PI);
|
||||
vcos = cos(angle);
|
||||
|
|
@ -1651,7 +1651,7 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2,
|
|||
float A = (obj2->GetPositionY() - obj1->GetPositionY()) / (obj2->GetPositionX() - obj1->GetPositionX());
|
||||
float B = -1;
|
||||
float C = obj1->GetPositionY() - A * obj1->GetPositionX();
|
||||
float dist = fabs(A * GetPositionX() + B * GetPositionY() + C) / sqrt(A * A + B * B);
|
||||
float dist = std::fabs(A * GetPositionX() + B * GetPositionY() + C) / sqrt(A * A + B * B);
|
||||
return dist <= size;
|
||||
}
|
||||
|
||||
|
|
@ -2786,7 +2786,7 @@ bool WorldObject::GetClosePoint(float& x, float& y, float& z, float size, float
|
|||
// angle calculated from current orientation
|
||||
GetNearPoint(forWho, x, y, z, size, distance2d, GetOrientation() + angle);
|
||||
|
||||
if (fabs(this->GetPositionZ() - z) > 3.0f || !IsWithinLOS(x, y, z))
|
||||
if (std::fabs(this->GetPositionZ() - z) > 3.0f || !IsWithinLOS(x, y, z))
|
||||
{
|
||||
x = this->GetPositionX();
|
||||
y = this->GetPositionY();
|
||||
|
|
@ -2830,7 +2830,7 @@ void WorldObject::GetContactPoint(const WorldObject* obj, float& x, float& y, fl
|
|||
GetNearPoint(obj, x, y, z, obj->GetObjectSize(), distance2d, GetAngle(obj));
|
||||
|
||||
// Exclude gameobjects from LoS calculations
|
||||
if (fabs(this->GetPositionZ() - z) > 3.0f || (GetTypeId() != TYPEID_GAMEOBJECT && !IsWithinLOS(x, y, z)))
|
||||
if (std::fabs(this->GetPositionZ() - z) > 3.0f || (GetTypeId() != TYPEID_GAMEOBJECT && !IsWithinLOS(x, y, z)))
|
||||
{
|
||||
x = this->GetPositionX();
|
||||
y = this->GetPositionY();
|
||||
|
|
@ -2844,7 +2844,7 @@ void WorldObject::GetChargeContactPoint(const WorldObject* obj, float& x, float&
|
|||
// angle to face `obj` to `this` using distance includes size of `obj`
|
||||
GetNearPoint(obj, x, y, z, obj->GetObjectSize(), distance2d, GetAngle(obj));
|
||||
|
||||
if (fabs(this->GetPositionZ() - z) > 3.0f || !IsWithinLOS(x, y, z))
|
||||
if (std::fabs(this->GetPositionZ() - z) > 3.0f || !IsWithinLOS(x, y, z))
|
||||
{
|
||||
x = this->GetPositionX();
|
||||
y = this->GetPositionY();
|
||||
|
|
@ -2874,20 +2874,20 @@ void WorldObject::MovePosition(Position& pos, float dist, float angle)
|
|||
|
||||
ground = GetMapHeight(destx, desty, MAX_HEIGHT);
|
||||
floor = GetMapHeight(destx, desty, pos.m_positionZ);
|
||||
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
|
||||
destz = std::fabs(ground - pos.m_positionZ) <= std::fabs(floor - pos.m_positionZ) ? ground : floor;
|
||||
|
||||
float step = dist / 10.0f;
|
||||
|
||||
for (uint8 j = 0; j < 10; ++j)
|
||||
{
|
||||
// do not allow too big z changes
|
||||
if (fabs(pos.m_positionZ - destz) > 6.0f)
|
||||
if (std::fabs(pos.m_positionZ - destz) > 6.0f)
|
||||
{
|
||||
destx -= step * cos(angle);
|
||||
desty -= step * sin(angle);
|
||||
ground = GetMapHeight(destx, desty, MAX_HEIGHT);
|
||||
floor = GetMapHeight(destx, desty, pos.m_positionZ);
|
||||
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
|
||||
destz = std::fabs(ground - pos.m_positionZ) <= std::fabs(floor - pos.m_positionZ) ? ground : floor;
|
||||
}
|
||||
// we have correct destz now
|
||||
else
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ struct ObjectPosSelector
|
|||
if (nextUsedPos.second.sign * sign < 0) // last node from diff. list (-pi+alpha)
|
||||
next_angle = 2 * M_PI - next_angle; // move to positive
|
||||
|
||||
return fabs(angle) + angle_step2 <= next_angle;
|
||||
return std::fabs(angle) + angle_step2 <= next_angle;
|
||||
}
|
||||
|
||||
bool CheckOriginal() const
|
||||
|
|
@ -104,7 +104,7 @@ struct ObjectPosSelector
|
|||
// next possible angle
|
||||
angle = m_smallStepAngle[uptype] + m_anglestep * sign;
|
||||
|
||||
if (fabs(angle) > M_PI)
|
||||
if (std::fabs(angle) > M_PI)
|
||||
{
|
||||
m_smallStepOk[uptype] = false;
|
||||
return false;
|
||||
|
|
@ -112,7 +112,7 @@ struct ObjectPosSelector
|
|||
|
||||
if (m_smallStepNextUsedPos[uptype])
|
||||
{
|
||||
if (fabs(angle) >= m_smallStepNextUsedPos[uptype]->first)
|
||||
if (std::fabs(angle) >= m_smallStepNextUsedPos[uptype]->first)
|
||||
{
|
||||
m_smallStepOk[uptype] = false;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1887,7 +1887,7 @@ void Player::Regenerate(Powers power)
|
|||
return;
|
||||
|
||||
addvalue += m_powerFraction[power];
|
||||
uint32 integerValue = uint32(fabs(addvalue));
|
||||
uint32 integerValue = uint32(std::fabs(addvalue));
|
||||
|
||||
if (addvalue < 0.0f)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ bool Unit::GetRandomContactPoint(const Unit* obj, float& x, float& y, float& z,
|
|||
GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI / 2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
|
||||
|
||||
// pussywizard
|
||||
if (fabs(this->GetPositionZ() - z) > this->GetCollisionHeight() || !IsWithinLOS(x, y, z))
|
||||
if (std::fabs(this->GetPositionZ() - z) > this->GetCollisionHeight() || !IsWithinLOS(x, y, z))
|
||||
{
|
||||
x = this->GetPositionX();
|
||||
y = this->GetPositionY();
|
||||
|
|
@ -1910,7 +1910,7 @@ void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)
|
|||
float discreteResistProbability[11];
|
||||
for (uint32 i = 0; i < 11; ++i)
|
||||
{
|
||||
discreteResistProbability[i] = 0.5f - 2.5f * fabs(0.1f * i - averageResist);
|
||||
discreteResistProbability[i] = 0.5f - 2.5f * std::fabs(0.1f * i - averageResist);
|
||||
if (discreteResistProbability[i] < 0.0f)
|
||||
discreteResistProbability[i] = 0.0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_player->GetTransport() && fabs(_player->GetSpeed(move_type) - newspeed) > 0.01f)
|
||||
if (!_player->GetTransport() && std::fabs(_player->GetSpeed(move_type) - newspeed) > 0.01f)
|
||||
{
|
||||
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2053,7 +2053,7 @@ float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float
|
|||
|
||||
// we are already under the surface or vmap height above map heigt
|
||||
// or if the distance of the vmap height is less the land height distance
|
||||
if (vmapHeight > mapHeight || fabs(mapHeight - z) > fabs(vmapHeight - z))
|
||||
if (vmapHeight > mapHeight || std::fabs(mapHeight - z) > std::fabs(vmapHeight - z))
|
||||
return vmapHeight;
|
||||
else
|
||||
return mapHeight; // better use .map surface height
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
|
|||
}
|
||||
|
||||
// Abort too if the ground is very near
|
||||
if (fabs(_owner->GetPositionZ() - tz) < 0.1f)
|
||||
if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f)
|
||||
return;
|
||||
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void ConfusedMovementGenerator<T>::DoInitialize(T* unit)
|
|||
Acore::NormalizeMapCoord(wanderY);
|
||||
|
||||
float new_z = unit->GetMapHeight(wanderX, wanderY, z);
|
||||
if (new_z <= INVALID_HEIGHT || fabs(z - new_z) > 3.0f) // pussywizard
|
||||
if (new_z <= INVALID_HEIGHT || std::fabs(z - new_z) > 3.0f) // pussywizard
|
||||
{
|
||||
i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx - 1][0] : x;
|
||||
i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx - 1][1] : y;
|
||||
|
|
|
|||
|
|
@ -160,11 +160,11 @@ bool FleeingMovementGenerator<T>::_getPoint(T* owner, float& x, float& y, float&
|
|||
break;
|
||||
}
|
||||
|
||||
if (!(temp_z - z) || distance / fabs(temp_z - z) > 1.0f)
|
||||
if (!(temp_z - z) || distance / std::fabs(temp_z - z) > 1.0f)
|
||||
{
|
||||
float temp_z_left = _map->GetHeight(owner->GetPhaseMask(), temp_x + 1.0f * cos(angle + static_cast<float>(M_PI / 2)), temp_y + 1.0f * sin(angle + static_cast<float>(M_PI / 2)), z, true);
|
||||
float temp_z_right = _map->GetHeight(owner->GetPhaseMask(), temp_x + 1.0f * cos(angle - static_cast<float>(M_PI / 2)), temp_y + 1.0f * sin(angle - static_cast<float>(M_PI / 2)), z, true);
|
||||
if (fabs(temp_z_left - temp_z) < 1.2f && fabs(temp_z_right - temp_z) < 1.2f)
|
||||
if (std::fabs(temp_z_left - temp_z) < 1.2f && std::fabs(temp_z_right - temp_z) < 1.2f)
|
||||
{
|
||||
// use new values
|
||||
x = temp_x;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
|
|||
for (; itrNext != finalPath.end(); ++itr, ++itrNext)
|
||||
{
|
||||
distDiff = sqrt(((*itr).x - (*itrNext).x) * ((*itr).x - (*itrNext).x) + ((*itr).y - (*itrNext).y) * ((*itr).y - (*itrNext).y));
|
||||
zDiff = fabs((*itr).z - (*itrNext).z);
|
||||
zDiff = std::fabs((*itr).z - (*itrNext).z);
|
||||
|
||||
// Xinef: tree climbing, cut as much as we can
|
||||
if (zDiff > 2.0f ||
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ namespace Movement
|
|||
for (uint32 i = 1; i < path.size() - 1; ++i)
|
||||
{
|
||||
offset = path[i] - middle;
|
||||
if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET)
|
||||
if (std::fabs(offset.x) >= MAX_OFFSET || std::fabs(offset.y) >= MAX_OFFSET || std::fabs(offset.z) >= MAX_OFFSET)
|
||||
{
|
||||
LOG_ERROR("movement", "MoveSplineInitArgs::_checkPathBounds check failed");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ struct PoolObject
|
|||
{
|
||||
uint32 guid;
|
||||
float chance;
|
||||
PoolObject(uint32 _guid, float _chance): guid(_guid), chance(fabs(_chance)) {}
|
||||
PoolObject(uint32 _guid, float _chance): guid(_guid), chance(std::fabs(_chance)) {}
|
||||
};
|
||||
|
||||
class Pool // for Pool of Pool case
|
||||
|
|
|
|||
|
|
@ -1695,8 +1695,8 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
|||
|
||||
const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3)
|
||||
// TODO: all calculation should be based on src instead of m_caster
|
||||
const float objDist2d = fabs(m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)));
|
||||
const float dz = fabs((*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ);
|
||||
const float objDist2d = std::fabs(m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)));
|
||||
const float dz = std::fabs((*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ);
|
||||
|
||||
LOG_ERROR("spells", "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.",
|
||||
(*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);
|
||||
|
|
@ -1726,7 +1726,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
|||
// RP-GG only, search in straight line, as item have no trajectory
|
||||
if (m_CastItem)
|
||||
{
|
||||
if (dist < bestDist && fabs(dz) < 6.0f) // closes target, also check Z difference)
|
||||
if (dist < bestDist && std::fabs(dz) < 6.0f) // closes target, also check Z difference)
|
||||
{
|
||||
bestDist = dist;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2502,7 +2502,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
|||
//float x, y, z;
|
||||
//m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
// xinef: vehicles summoned in air, eg. Cold Hearted quest
|
||||
if (fabs(m_caster->GetPositionZ() - destTarget->GetPositionZ()) > 6.0f)
|
||||
if (std::fabs(m_caster->GetPositionZ() - destTarget->GetPositionZ()) > 6.0f)
|
||||
destTarget->m_positionZ = m_caster->GetPositionZ();
|
||||
|
||||
summon = m_originalCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_caster, m_spellInfo->Id);
|
||||
|
|
|
|||
|
|
@ -1766,7 +1766,7 @@ public:
|
|||
if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ() + 10.0f, destX, destY, summoner->GetPositionZ() + 10.0f, summoner->GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS) && destX > 4585.0f && destY > 2716.0f && destY < 2822.0f)
|
||||
{
|
||||
float destZ = summoner->GetMapHeight(summoner->GetPhaseMask(), destX, destY, summoner->GetPositionZ());
|
||||
if (fabs(destZ - summoner->GetPositionZ()) < 10.0f) // valid z found
|
||||
if (std::fabs(destZ - summoner->GetPositionZ()) < 10.0f) // valid z found
|
||||
{
|
||||
dest._position.Relocate(destX, destY, destZ);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1635,7 +1635,7 @@ public:
|
|||
if (floorZ > 190.0f) destZ = floorZ + 25.0f;
|
||||
else destZ = me->GetPositionZ() + 25.0f;
|
||||
me->GetMotionMaster()->MoveTakeoff(0, me->GetPositionX(), me->GetPositionY(), destZ, me->GetSpeed(MOVE_RUN));
|
||||
float moveTime = fabs(destZ - me->GetPositionZ()) / (me->GetSpeed(MOVE_RUN) * 0.001f);
|
||||
float moveTime = std::fabs(destZ - me->GetPositionZ()) / (me->GetSpeed(MOVE_RUN) * 0.001f);
|
||||
_events.ScheduleEvent(EVENT_ICY_BLAST, uint32(moveTime) + urand(60000, 70000));
|
||||
_events.ScheduleEvent(EVENT_ICY_BLAST_CAST, uint32(moveTime) + 250);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -850,7 +850,7 @@ public:
|
|||
if( me->GetUInt32Value(UNIT_NPC_EMOTESTATE) != EMOTE_STATE_WORK )
|
||||
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_WORK);
|
||||
|
||||
if (fabs(me->GetOrientation() - me->GetAngle(c)) > M_PI / 4)
|
||||
if (std::fabs(me->GetOrientation() - me->GetAngle(c)) > M_PI / 4)
|
||||
me->SetFacingToObject(c);
|
||||
|
||||
c->AI()->SetData(2, 0);
|
||||
|
|
|
|||
|
|
@ -2361,7 +2361,7 @@ public:
|
|||
}
|
||||
|
||||
Unit* _target = ObjectAccessor::GetUnit(*owner, _targetGUID);
|
||||
if (!_target || !_target->IsAlive() || fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground
|
||||
if (!_target || !_target->IsAlive() || std::fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground
|
||||
{
|
||||
SetDuration(0);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue