aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/collision/BoundingIntervalHierarchy.cpp12
-rw-r--r--src/server/collision/DynamicTree.cpp2
-rw-r--r--src/server/collision/Management/VMapManager2.cpp2
-rw-r--r--src/server/collision/Maps/MapTree.cpp2
-rw-r--r--src/server/collision/Maps/MapTree.h4
-rw-r--r--src/server/collision/Maps/TileAssembler.h2
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp2
-rw-r--r--src/server/collision/Models/ModelInstance.cpp4
-rw-r--r--src/server/collision/Models/WorldModel.cpp6
-rw-r--r--src/server/collision/RegularGrid.h4
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp2
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp12
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp2
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp4
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp67
-rw-r--r--src/server/game/Conditions/ConditionMgr.h2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp2
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.cpp8
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp4
-rw-r--r--src/server/game/Entities/Object/Object.cpp42
-rw-r--r--src/server/game/Entities/Object/Object.h18
-rw-r--r--src/server/game/Entities/Object/ObjectPosSelector.cpp2
-rw-r--r--src/server/game/Entities/Object/ObjectPosSelector.h12
-rw-r--r--src/server/game/Entities/Pet/PetDefines.h2
-rw-r--r--src/server/game/Entities/Player/Player.cpp63
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp2
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp28
-rw-r--r--src/server/game/Entities/Unit/Unit.h4
-rw-r--r--src/server/game/Grids/GridDefines.h4
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp6
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
-rw-r--r--src/server/game/Loot/LootMgr.h2
-rw-r--r--src/server/game/Maps/Map.cpp2
-rw-r--r--src/server/game/Maps/TransportMgr.cpp14
-rw-r--r--src/server/game/Movement/MotionMaster.cpp4
-rw-r--r--src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp10
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp6
-rw-r--r--src/server/game/Movement/Spline/MovementTypedefs.h2
-rw-r--r--src/server/game/Movement/Spline/MovementUtil.cpp8
-rw-r--r--src/server/game/Movement/Spline/Spline.cpp4
-rw-r--r--src/server/game/Movement/Waypoints/Path.h4
-rw-r--r--src/server/game/Pools/PoolMgr.h2
-rw-r--r--src/server/game/Spells/Spell.cpp16
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp4
-rw-r--r--src/server/scripts/Events/childrens_week.cpp16
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp2
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp6
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp6
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp2
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp2
-rw-r--r--src/server/scripts/Spells/spell_item.cpp2
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp2
-rw-r--r--src/server/shared/Common.h4
-rw-r--r--src/server/shared/Define.h1
-rw-r--r--src/server/shared/Packets/ByteBuffer.h2
-rw-r--r--src/server/shared/Utilities/Timer.h2
-rw-r--r--src/server/shared/Utilities/Util.h6
-rw-r--r--src/server/worldserver/TCSoap/TCSoap.h1
87 files changed, 293 insertions, 249 deletions
diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp
index d90009c03f3..c933fc8f4e3 100644
--- a/src/server/collision/BoundingIntervalHierarchy.cpp
+++ b/src/server/collision/BoundingIntervalHierarchy.cpp
@@ -72,11 +72,11 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
axis = d.primaryAxis();
split = 0.5f * (gridBox.lo[axis] + gridBox.hi[axis]);
// partition L/R subsets
- clipL = -G3D::inf();
- clipR = G3D::inf();
+ clipL = -G3D::finf();
+ clipR = G3D::finf();
rightOrig = right; // save this for later
- float nodeL = G3D::inf();
- float nodeR = -G3D::inf();
+ float nodeL = G3D::finf();
+ float nodeR = -G3D::finf();
for (int i = left; i <= right;)
{
int obj = dat.indices[i];
@@ -187,13 +187,13 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
stats.updateInner();
tempTree[nodeIndex + 0] = (prevAxis << 30) | nextIndex;
tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip);
- tempTree[nodeIndex + 2] = floatToRawIntBits(G3D::inf());
+ tempTree[nodeIndex + 2] = floatToRawIntBits(G3D::finf());
} else {
// create a node with a right child
// write leaf node
stats.updateInner();
tempTree[nodeIndex + 0] = (prevAxis << 30) | (nextIndex - 3);
- tempTree[nodeIndex + 1] = floatToRawIntBits(-G3D::inf());
+ tempTree[nodeIndex + 1] = floatToRawIntBits(-G3D::finf());
tempTree[nodeIndex + 2] = floatToRawIntBits(prevClip);
}
// count stats for the unused leaf
diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp
index f6d85df704a..a88c7573707 100644
--- a/src/server/collision/DynamicTree.cpp
+++ b/src/server/collision/DynamicTree.cpp
@@ -256,5 +256,5 @@ float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist,
if (callback.didHit())
return v.z - maxSearchDist;
else
- return -G3D::inf();
+ return -G3D::finf();
}
diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp
index 1d267cbd2a5..484fdcd8ea4 100644
--- a/src/server/collision/Management/VMapManager2.cpp
+++ b/src/server/collision/Management/VMapManager2.cpp
@@ -194,7 +194,7 @@ namespace VMAP
{
Vector3 pos = convertPositionToInternalRep(x, y, z);
float height = instanceTree->second->getHeight(pos, maxSearchDist);
- if (!(height < G3D::inf()))
+ if (!(height < G3D::finf()))
return height = VMAP_INVALID_HEIGHT_VALUE; // No height
return height;
diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp
index 6b82e06aff7..d62b2b21224 100644
--- a/src/server/collision/Maps/MapTree.cpp
+++ b/src/server/collision/Maps/MapTree.cpp
@@ -225,7 +225,7 @@ namespace VMAP
float StaticMapTree::getHeight(const Vector3& pPos, float maxSearchDist) const
{
- float height = G3D::inf();
+ float height = G3D::finf();
Vector3 dir = Vector3(0, 0, -1);
G3D::Ray ray(pPos, dir); // direction with length of 1
float maxDist = maxSearchDist;
diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h
index e16f5701de1..2f483a8822c 100644
--- a/src/server/collision/Maps/MapTree.h
+++ b/src/server/collision/Maps/MapTree.h
@@ -31,7 +31,7 @@ namespace VMAP
struct LocationInfo
{
- LocationInfo(): hitInstance(nullptr), hitModel(nullptr), ground_Z(-G3D::inf()) { }
+ LocationInfo(): hitInstance(nullptr), hitModel(nullptr), ground_Z(-G3D::finf()) { }
const ModelInstance* hitInstance;
const GroupModel* hitModel;
float ground_Z;
@@ -89,7 +89,7 @@ namespace VMAP
struct AreaInfo
{
- AreaInfo(): result(false), ground_Z(-G3D::inf()), flags(0), adtId(0),
+ AreaInfo(): result(false), ground_Z(-G3D::finf()), flags(0), adtId(0),
rootId(0), groupId(0) { }
bool result;
float ground_Z;
diff --git a/src/server/collision/Maps/TileAssembler.h b/src/server/collision/Maps/TileAssembler.h
index 26a884551cd..2167f1e5689 100644
--- a/src/server/collision/Maps/TileAssembler.h
+++ b/src/server/collision/Maps/TileAssembler.h
@@ -46,7 +46,7 @@ namespace VMAP
float iScale;
void init()
{
- iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi()*iDir.y/180.f, G3D::pi()*iDir.x/180.f, G3D::pi()*iDir.z/180.f);
+ iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif()*iDir.y/180.f, G3D::pif()*iDir.x/180.f, G3D::pif()*iDir.z/180.f);
}
G3D::Vector3 transform(const G3D::Vector3& pIn) const;
void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; }
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index de97943bb37..bb2837be4c4 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -166,7 +166,7 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto
return false;
float time = ray.intersectionTime(iBound);
- if (time == G3D::inf())
+ if (time == G3D::finf())
return false;
// child bounds are defined in object space:
diff --git a/src/server/collision/Models/ModelInstance.cpp b/src/server/collision/Models/ModelInstance.cpp
index 475984c4fd3..bd84548d792 100644
--- a/src/server/collision/Models/ModelInstance.cpp
+++ b/src/server/collision/Models/ModelInstance.cpp
@@ -28,7 +28,7 @@ namespace VMAP
{
ModelInstance::ModelInstance(const ModelSpawn &spawn, WorldModel* model): ModelSpawn(spawn), iModel(model)
{
- iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi()*iRot.y/180.f, G3D::pi()*iRot.x/180.f, G3D::pi()*iRot.z/180.f).inverse();
+ iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif()*iRot.y/180.f, G3D::pif()*iRot.x/180.f, G3D::pif()*iRot.z/180.f).inverse();
iInvScale = 1.f/iScale;
}
@@ -40,7 +40,7 @@ namespace VMAP
return false;
}
float time = pRay.intersectionTime(iBound);
- if (time == G3D::inf())
+ if (time == G3D::finf())
{
// std::cout << "Ray does not hit '" << name << "'\n";
diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp
index d6b0a76f23b..5962b343544 100644
--- a/src/server/collision/Models/WorldModel.cpp
+++ b/src/server/collision/Models/WorldModel.cpp
@@ -42,7 +42,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;
}
@@ -388,7 +388,7 @@ namespace VMAP
return false;
GModelRayCallback callback(triangles, vertices);
Vector3 rPos = pos - 0.1f * down;
- float dist = G3D::inf();
+ float dist = G3D::finf();
G3D::Ray ray(rPos, down);
bool hit = IntersectRay(ray, dist, false);
if (hit)
@@ -446,7 +446,7 @@ namespace VMAP
class WModelAreaCallback {
public:
WModelAreaCallback(const std::vector<GroupModel> &vals, const Vector3 &down):
- prims(vals.begin()), hit(vals.end()), minVol(G3D::inf()), zDist(G3D::inf()), zVec(down) { }
+ prims(vals.begin()), hit(vals.end()), minVol(G3D::finf()), zDist(G3D::finf()), zVec(down) { }
std::vector<GroupModel>::const_iterator prims;
std::vector<GroupModel>::const_iterator hit;
float minVol;
diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h
index d1832c1ea06..6a2a07968ad 100644
--- a/src/server/collision/RegularGrid.h
+++ b/src/server/collision/RegularGrid.h
@@ -159,8 +159,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])
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 4bce9113082..603c34e2403 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -236,7 +236,7 @@ void PetAI::UpdateAI(uint32 diff)
SpellCastTargets targets;
targets.SetUnitTarget(target);
- if (!me->HasInArc(M_PI, target))
+ if (!me->HasInArc(float(M_PI), target))
{
me->SetInFront(target);
if (target && target->GetTypeId() == TYPEID_PLAYER)
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 55f69a113be..58e82bfcbbf 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1623,7 +1623,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
float attackDistance = float(e.action.setRangedMovement.distance);
- float attackAngle = float(e.action.setRangedMovement.angle) / 180.0f * M_PI;
+ float attackAngle = float(e.action.setRangedMovement.angle) / 180.0f * float(M_PI);
ObjectList* targets = GetTargets(e, unit);
if (targets)
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 07b41edebbe..40935a0712c 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -547,16 +547,8 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
continue;
- if (usable != 0x00)
- {
- if (player->CanUseItem(item) != EQUIP_ERR_OK)
- continue;
-
- if (proto->Class == ITEM_CLASS_RECIPE)
- if (SpellEntry const* spell = sSpellStore.LookupEntry(proto->Spells[0].SpellId))
- if (player->HasSpell(spell->EffectTriggerSpell[EFFECT_INDEX_0]))
- continue;
- }
+ if (usable != 0x00 && player->CanUseItem(item) != EQUIP_ERR_OK)
+ continue;
// Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey)
// No need to do any of this if no search term was entered
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 5ef3426d602..41de1970344 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -908,7 +908,7 @@ void BfCapturePoint::SendChangePhase()
// send this too, sometimes the slider disappears, dunno why :(
SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
// send these updates to only the ones in this objective
- SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
+ SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) std::ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
// send this too, sometimes it resets :S
SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
}
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 17d95dbbe6b..630780f43bf 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -637,7 +637,7 @@ float ArenaTeam::GetChanceAgainst(uint32 ownRating, uint32 opponentRating)
{
// Returns the chance to win against a team with the given rating, used in the rating adjustment calculation
// ELO system
- return 1.0f / (1.0f + exp(log(10.0f) * (float)((float)opponentRating - (float)ownRating) / 650.0f));
+ return 1.0f / (1.0f + std::exp(std::log(10.0f) * (float(opponentRating) - float(ownRating)) / 650.0f));
}
int32 ArenaTeam::GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 10ede74685c..11e07566092 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -712,7 +712,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveYard(Player* player)
safeloc = BG_SA_GYEntries[BG_SA_DEFENDER_LAST_GY];
closest = sWorldSafeLocsStore.LookupEntry(safeloc);
- nearest = sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y) + (closest->z - z)*(closest->z - z));
+ nearest = std::sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y) + (closest->z - z)*(closest->z - z));
for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++)
{
@@ -720,7 +720,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveYard(Player* player)
continue;
ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
- dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y) + (ret->z - z)*(ret->z - z));
+ dist = std::sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y) + (ret->z - z)*(ret->z - z));
if (dist < nearest)
{
closest = ret;
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 6083895ab26..34ed979291b 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -211,10 +211,25 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = GetClosestGameObjectWithEntry(object, ConditionValue1, (float)ConditionValue2) ? true : false;
break;
}
- case CONDITION_OBJECT_ENTRY:
+ case CONDITION_OBJECT_ENTRY_GUID:
{
if (uint32(object->GetTypeId()) == ConditionValue1)
- condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2);
+ {
+ condMeets = !ConditionValue2 || (object->GetEntry() == ConditionValue2);
+
+ if (ConditionValue3)
+ {
+ switch (object->GetTypeId())
+ {
+ case TYPEID_UNIT:
+ condMeets &= object->ToCreature()->GetDBTableGUIDLow() == ConditionValue3;
+ break;
+ case TYPEID_GAMEOBJECT:
+ condMeets &= object->ToGameObject()->GetDBTableGUIDLow() == ConditionValue3;
+ break;
+ }
+ }
+ }
break;
}
case CONDITION_TYPE_MASK:
@@ -419,7 +434,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
case CONDITION_NEAR_GAMEOBJECT:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
- case CONDITION_OBJECT_ENTRY:
+ case CONDITION_OBJECT_ENTRY_GUID:
switch (ConditionValue1)
{
case TYPEID_UNIT:
@@ -1841,35 +1856,67 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
TC_LOG_ERROR("sql.sql", "NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
- case CONDITION_OBJECT_ENTRY:
+ case CONDITION_OBJECT_ENTRY_GUID:
{
switch (cond->ConditionValue1)
{
case TYPEID_UNIT:
if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2))
{
- TC_LOG_ERROR("sql.sql", "ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2);
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing creature template entry (%u), skipped", cond->ConditionValue2);
return false;
}
+ if (cond->ConditionValue3)
+ {
+ if (CreatureData const* creatureData = sObjectMgr->GetCreatureData(cond->ConditionValue3))
+ {
+ if (cond->ConditionValue2 && creatureData->id != cond->ConditionValue2)
+ {
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has guid %u set but does not match creature entry (%u), skipped", cond->ConditionValue3, cond->ConditionValue2);
+ return false;
+ }
+ }
+ else
+ {
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing creature guid (%u), skipped", cond->ConditionValue3);
+ return false;
+ }
+ }
break;
case TYPEID_GAMEOBJECT:
if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2))
{
- TC_LOG_ERROR("sql.sql", "ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2);
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue2);
return false;
}
+ if (cond->ConditionValue3)
+ {
+ if (GameObjectData const* goData = sObjectMgr->GetGOData(cond->ConditionValue3))
+ {
+ if (cond->ConditionValue2 && goData->id != cond->ConditionValue2)
+ {
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has guid %u set but does not match gameobject entry (%u), skipped", cond->ConditionValue3, cond->ConditionValue2);
+ return false;
+ }
+ }
+ else
+ {
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing gameobject guid (%u), skipped", cond->ConditionValue3);
+ return false;
+ }
+ }
break;
case TYPEID_PLAYER:
case TYPEID_CORPSE:
if (cond->ConditionValue2)
- TC_LOG_ERROR("sql.sql", "ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ if (cond->ConditionValue3)
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
default:
- TC_LOG_ERROR("sql.sql", "ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1);
+ TC_LOG_ERROR("sql.sql", "ObjectEntryGuid condition has wrong typeid set (%u), skipped", cond->ConditionValue1);
return false;
}
- if (cond->ConditionValue3)
- TC_LOG_ERROR("sql.sql", "ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_TYPE_MASK:
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 9a48985b90d..317db5b2019 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -63,7 +63,7 @@ enum ConditionTypes
CONDITION_QUEST_COMPLETE = 28, // quest_id 0 0 true if player has quest_id with all objectives complete, but not yet rewarded
CONDITION_NEAR_CREATURE = 29, // creature entry distance 0 true if there is a creature of entry in range
CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance 0 true if there is a gameobject of entry in range
- CONDITION_OBJECT_ENTRY = 31, // TypeID entry 0 true if object is type TypeID and the entry is 0 or matches entry of the object
+ CONDITION_OBJECT_ENTRY_GUID = 31, // TypeID entry guid true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object
CONDITION_TYPE_MASK = 32, // TypeMask 0 0 true if object is type object's TypeMask matches provided TypeMask
CONDITION_RELATION_TO = 33, // ConditionTarget RelationType 0 true if object is in given relation with object specified by ConditionTarget
CONDITION_REACTION_TO = 34, // ConditionTarget rankMask 0 true if object's reaction matches rankMask object specified by ConditionTarget
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 2a2795bba64..6a6caa72e76 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1089,7 +1089,7 @@ void Creature::SelectLevel()
float basedamage = stats->GenerateBaseDamage(cInfo);
float weaponBaseMinDamage = basedamage;
- float weaponBaseMaxDamage = basedamage * 1.5;
+ float weaponBaseMaxDamage = basedamage * 1.5f;
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, weaponBaseMinDamage);
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 14a76ae07ce..f02543a60af 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -107,7 +107,7 @@ void FormationMgr::LoadCreatureFormations()
if (group_member->leaderGUID != memberGUID)
{
group_member->follow_dist = fields[2].GetFloat();
- group_member->follow_angle = fields[3].GetFloat() * M_PI / 180;
+ group_member->follow_angle = fields[3].GetFloat() * float(M_PI) / 180;
}
else
{
@@ -218,7 +218,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
if (!m_leader)
return;
- float pathangle = atan2(m_leader->GetPositionY() - y, m_leader->GetPositionX() - x);
+ float pathangle = std::atan2(m_leader->GetPositionY() - y, m_leader->GetPositionX() - x);
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
@@ -229,9 +229,9 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
if (itr->second->point_1)
{
if (m_leader->GetCurrentWaypointID() == itr->second->point_1)
- itr->second->follow_angle = (2 * M_PI) - itr->second->follow_angle;
+ itr->second->follow_angle = (2 * float(M_PI)) - itr->second->follow_angle;
if (m_leader->GetCurrentWaypointID() == itr->second->point_2)
- itr->second->follow_angle = (2 * M_PI) + itr->second->follow_angle;
+ itr->second->follow_angle = (2 * float(M_PI)) + itr->second->follow_angle;
}
float angle = itr->second->follow_angle;
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 71e223527f3..567ada4cccf 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -1270,7 +1270,7 @@ void GameObject::Use(Unit* user)
// the object orientation + 1/2 pi
// every slot will be on that straight line
- float orthogonalOrientation = GetOrientation()+M_PI*0.5f;
+ float orthogonalOrientation = GetOrientation() + float(M_PI) * 0.5f;
// find nearest slot
bool found_free_slot = false;
for (ChairSlotAndUser::iterator itr = ChairListSlots.begin(); itr != ChairListSlots.end(); ++itr)
@@ -1835,7 +1835,7 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
float dx = x - GetPositionX();
float dy = y - GetPositionY();
float dz = z - GetPositionZ();
- float dist = sqrt(dx*dx + dy*dy);
+ float dist = std::sqrt(dx*dx + dy*dy);
//! Check if the distance between the 2 objects is 0, can happen if both objects are on the same position.
//! The code below this check wont crash if dist is 0 because 0/0 in float operations is valid, and returns infinite
if (G3D::fuzzyEq(dist, 0.0f))
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 623680dad7e..32a9496803d 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1190,11 +1190,11 @@ bool Position::operator==(Position const &a)
bool Position::HasInLine(WorldObject const* target, float width) const
{
- if (!HasInArc(M_PI, target))
+ if (!HasInArc(float(M_PI), target))
return false;
width += target->GetObjectSize();
float angle = GetRelativeAngle(target);
- return fabs(sin(angle)) * GetExactDist2d(target->GetPositionX(), target->GetPositionY()) < width;
+ return std::fabs(std::sin(angle)) * GetExactDist2d(target->GetPositionX(), target->GetPositionY()) < width;
}
std::string Position::ToString() const
@@ -1379,7 +1379,7 @@ InstanceScript* WorldObject::GetInstanceScript()
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);
@@ -1602,7 +1602,7 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
void Position::RelocateOffset(const Position & offset)
{
- m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI));
+ m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI)));
m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
m_positionZ = GetPositionZ() + offset.GetPositionZ();
SetOrientation(GetOrientation() + offset.GetOrientation());
@@ -1633,8 +1633,8 @@ float Position::GetAngle(const float x, const float y) const
float dx = x - GetPositionX();
float dy = y - GetPositionY();
- float ang = atan2(dy, dx);
- ang = (ang >= 0) ? ang : 2 * M_PI + ang;
+ float ang = std::atan2(dy, dx);
+ ang = (ang >= 0) ? ang : 2 * float(M_PI) + ang;
return ang;
}
@@ -1643,7 +1643,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 = std::cos(angle);
@@ -1651,7 +1651,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
}
else
{
- float dist = sqrt((dx*dx) + (dy*dy));
+ float dist = std::sqrt((dx*dx) + (dy*dy));
vcos = dx / dist;
vsin = dy / dist;
}
@@ -1671,8 +1671,8 @@ bool Position::HasInArc(float arc, const Position* obj, float border) const
// move angle to range -pi ... +pi
angle = NormalizeOrientation(angle);
- if (angle > M_PI)
- angle -= 2.0f*M_PI;
+ if (angle > float(M_PI))
+ angle -= 2.0f * float(M_PI);
float lborder = -1 * (arc/border); // in range -pi..0
float rborder = (arc/border); // in range 0..pi
@@ -1706,7 +1706,7 @@ bool WorldObject::isInFront(WorldObject const* target, float arc) const
bool WorldObject::isInBack(WorldObject const* target, float arc) const
{
- return !HasInArc(2 * M_PI - arc, target);
+ return !HasInArc(2 * float(M_PI) - arc, target);
}
void WorldObject::GetRandomPoint(const Position &pos, float distance, float &rand_x, float &rand_y, float &rand_z) const
@@ -2002,7 +2002,7 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
if (distance < combatReach)
return true;
- if (!HasInArc(M_PI, obj))
+ if (!HasInArc(float(M_PI), obj))
return false;
GameObject const* go = ToGameObject();
@@ -2670,7 +2670,7 @@ void WorldObject::GetNearPoint(WorldObject const* /*searcher*/, float &x, float
float first_z = z;
// loop in a circle to look for a point in LoS using small steps
- for (float angle = M_PI / 8; angle < M_PI * 2; angle += M_PI / 8)
+ for (float angle = float(M_PI) / 8; angle < float(M_PI) * 2; angle += float(M_PI) / 8)
{
GetNearPoint2D(x, y, distance2d + searcher_size, absAngle + angle);
z = GetPositionZ();
@@ -2740,20 +2740,20 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
- 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)
+ if (std::fabs(pos.m_positionZ - destz) > 6)
{
destx -= step * std::cos(angle);
desty -= step * std::sin(angle);
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
- 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
@@ -2774,7 +2774,7 @@ float NormalizeZforCollision(WorldObject* obj, float x, float y, float z)
{
float ground = obj->GetMap()->GetHeight(obj->GetPhaseMask(), x, y, MAX_HEIGHT, true);
float floor = obj->GetMap()->GetHeight(obj->GetPhaseMask(), x, y, z + 2.0f, true);
- float helper = fabs(ground - z) <= fabs(floor - z) ? ground : floor;
+ float helper = std::fabs(ground - z) <= std::fabs(floor - z) ? ground : floor;
if (z > helper) // must be above ground
{
if (Unit* unit = obj->ToUnit())
@@ -2789,7 +2789,7 @@ float NormalizeZforCollision(WorldObject* obj, float x, float y, float z)
if (liquid_status.level > z) // z is underwater
return z;
else
- return fabs(liquid_status.level - z) <= fabs(helper - z) ? liquid_status.level : helper;
+ return std::fabs(liquid_status.level - z) <= std::fabs(helper - z) ? liquid_status.level : helper;
}
}
return helper;
@@ -2818,7 +2818,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// move back a bit
destx -= CONTACT_DISTANCE * std::cos(angle);
desty -= CONTACT_DISTANCE * std::sin(angle);
- dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
+ dist = std::sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
// check dynamic collision
@@ -2829,7 +2829,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
{
destx -= CONTACT_DISTANCE * std::cos(angle);
desty -= CONTACT_DISTANCE * std::sin(angle);
- dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
+ dist = std::sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
float step = dist / 10.0f;
@@ -2837,7 +2837,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
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 * std::cos(angle);
desty -= step * std::sin(angle);
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 108eb3ce0b7..a44c9fa2866 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -263,7 +263,7 @@ class Object
void BuildFieldsUpdate(Player*, UpdateDataMapType &) const;
void SetFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags |= flag; }
- void RemoveFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags &= ~flag; }
+ void RemoveFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags &= uint16(~flag); }
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
@@ -412,19 +412,19 @@ struct Position
float GetExactDist2dSq(float x, float y) const
{ float dx = m_positionX - x; float dy = m_positionY - y; return dx*dx + dy*dy; }
float GetExactDist2d(const float x, const float y) const
- { return sqrt(GetExactDist2dSq(x, y)); }
+ { return std::sqrt(GetExactDist2dSq(x, y)); }
float GetExactDist2dSq(Position const* pos) const
{ float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; return dx*dx + dy*dy; }
float GetExactDist2d(Position const* pos) const
- { return sqrt(GetExactDist2dSq(pos)); }
+ { return std::sqrt(GetExactDist2dSq(pos)); }
float GetExactDistSq(float x, float y, float z) const
{ float dz = m_positionZ - z; return GetExactDist2dSq(x, y) + dz*dz; }
float GetExactDist(float x, float y, float z) const
- { return sqrt(GetExactDistSq(x, y, z)); }
+ { return std::sqrt(GetExactDistSq(x, y, z)); }
float GetExactDistSq(Position const* pos) const
{ float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; float dz = m_positionZ - pos->m_positionZ; return dx*dx + dy*dy + dz*dz; }
float GetExactDist(Position const* pos) const
- { return sqrt(GetExactDistSq(pos)); }
+ { return std::sqrt(GetExactDistSq(pos)); }
void GetPositionOffsetTo(Position const & endPos, Position & retOffset) const;
@@ -455,11 +455,11 @@ struct Position
if (o < 0)
{
float mod = o *-1;
- mod = fmod(mod, 2.0f * static_cast<float>(M_PI));
+ mod = std::fmod(mod, 2.0f * static_cast<float>(M_PI));
mod = -mod + 2.0f * static_cast<float>(M_PI);
return mod;
}
- return fmod(o, 2.0f * static_cast<float>(M_PI));
+ return std::fmod(o, 2.0f * static_cast<float>(M_PI));
}
};
ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
@@ -718,8 +718,8 @@ class 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 arc = M_PI) const;
- bool isInBack(WorldObject const* target, float arc = M_PI) const;
+ bool isInFront(WorldObject const* target, float arc = float(M_PI)) const;
+ bool isInBack(WorldObject const* target, float arc = float(M_PI)) const;
bool IsInBetween(WorldObject const* obj1, WorldObject const* obj2, float size = 0) const;
diff --git a/src/server/game/Entities/Object/ObjectPosSelector.cpp b/src/server/game/Entities/Object/ObjectPosSelector.cpp
index fa7c5dffafa..da2049ac62f 100644
--- a/src/server/game/Entities/Object/ObjectPosSelector.cpp
+++ b/src/server/game/Entities/Object/ObjectPosSelector.cpp
@@ -21,7 +21,7 @@
ObjectPosSelector::ObjectPosSelector(float x, float y, float size, float dist)
: m_center_x(x), m_center_y(y), m_size(size), m_dist(dist)
{
- m_anglestep = acos(m_dist/(m_dist+2*m_size));
+ m_anglestep = std::acos(m_dist/(m_dist+2*m_size));
m_nextUsedPos[USED_POS_PLUS] = m_UsedPosLists[USED_POS_PLUS].end();
m_nextUsedPos[USED_POS_MINUS] = m_UsedPosLists[USED_POS_MINUS].end();
diff --git a/src/server/game/Entities/Object/ObjectPosSelector.h b/src/server/game/Entities/Object/ObjectPosSelector.h
index 5bac179880f..44b85dae3dd 100644
--- a/src/server/game/Entities/Object/ObjectPosSelector.h
+++ b/src/server/game/Entities/Object/ObjectPosSelector.h
@@ -60,10 +60,10 @@ struct ObjectPosSelector
float angle_step2 = GetAngle(nextUsedPos.second);
float next_angle = nextUsedPos.first;
- if (nextUsedPos.second.sign * sign < 0) // last node from diff. list (-pi+alpha)
- next_angle = 2*M_PI-next_angle; // move to positive
+ if (nextUsedPos.second.sign * sign < 0) // last node from diff. list (-pi+alpha)
+ next_angle = 2 * float(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
@@ -105,7 +105,7 @@ struct ObjectPosSelector
// next possible angle
angle = m_smallStepAngle[uptype] + m_anglestep * sign;
- if (fabs(angle) > M_PI)
+ if (std::fabs(angle) > float(M_PI))
{
m_smallStepOk[uptype] = false;
return false;
@@ -113,7 +113,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;
@@ -136,7 +136,7 @@ struct ObjectPosSelector
UsedPosList::value_type const* nextUsedPos(UsedPosType uptype);
// angle from used pos to next possible free pos
- float GetAngle(UsedPos const& usedPos) const { return acos(m_dist/(usedPos.dist+usedPos.size+m_size)); }
+ float GetAngle(UsedPos const& usedPos) const { return std::acos(m_dist/(usedPos.dist+usedPos.size+m_size)); }
float m_center_x;
float m_center_y;
diff --git a/src/server/game/Entities/Pet/PetDefines.h b/src/server/game/Entities/Pet/PetDefines.h
index f590bef233e..67435c30577 100644
--- a/src/server/game/Entities/Pet/PetDefines.h
+++ b/src/server/game/Entities/Pet/PetDefines.h
@@ -75,6 +75,6 @@ enum PetTalk
};
#define PET_FOLLOW_DIST 1.0f
-#define PET_FOLLOW_ANGLE (M_PI/2)
+#define PET_FOLLOW_ANGLE float(M_PI/2)
#endif
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index a23b9b4b0e2..12050c482f7 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -1668,7 +1668,7 @@ void Player::Update(uint32 p_time)
}
}
//120 degrees of radiant range
- else if (!HasInArc(2*M_PI/3, victim))
+ else if (!HasInArc(2 * float(M_PI) / 3, victim))
{
setAttackTimer(BASE_ATTACK, 100);
if (m_swingErrorMsg != 2) // send single time (client auto repeat)
@@ -1696,7 +1696,7 @@ void Player::Update(uint32 p_time)
{
if (!IsWithinMeleeRange(victim))
setAttackTimer(OFF_ATTACK, 100);
- else if (!HasInArc(2*M_PI/3, victim))
+ else if (!HasInArc(2 * float(M_PI) / 3, victim))
setAttackTimer(OFF_ATTACK, 100);
else
{
@@ -2660,7 +2660,7 @@ void Player::Regenerate(Powers power)
return;
addvalue += m_powerFraction[powerIndex];
- uint32 integerValue = uint32(fabs(addvalue));
+ uint32 integerValue = uint32(std::fabs(addvalue));
if (addvalue < 0.0f)
{
@@ -7107,7 +7107,7 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto
else
victim_guid = 0; // Don't show HK: <rank> message, only log.
- honor_f = ceil(Trinity::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
+ honor_f = std::ceil(Trinity::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
// count the number of playerkills in one day
ApplyModUInt32Value(PLAYER_FIELD_KILLS, 1, true);
@@ -9087,7 +9087,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot->FillLoot(1, LootTemplates_Creature, this, true);
// It may need a better formula
// Now it works like this: lvl10: ~6copper, lvl70: ~9silver
- bones->loot.gold = uint32(urand(50, 150) * 0.016f * pow(float(pLevel)/5.76f, 2.5f) * sWorld->getRate(RATE_DROP_MONEY));
+ bones->loot.gold = uint32(urand(50, 150) * 0.016f * std::pow(float(pLevel) / 5.76f, 2.5f) * sWorld->getRate(RATE_DROP_MONEY));
}
if (bones->lootRecipient != this)
@@ -11830,39 +11830,42 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
{
// Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
- if (proto)
- {
- if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
- return EQUIP_ERR_CANT_EQUIP_EVER;
+ if (!proto)
+ return EQUIP_ERR_ITEM_NOT_FOUND;
- if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
- return EQUIP_ERR_CANT_EQUIP_EVER;
+ if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
+ return EQUIP_ERR_CANT_EQUIP_EVER;
- if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
- return EQUIP_ERR_CANT_EQUIP_EVER;
+ if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
+ return EQUIP_ERR_CANT_EQUIP_EVER;
- if (proto->RequiredSkill != 0)
- {
- if (GetSkillValue(proto->RequiredSkill) == 0)
- return EQUIP_ERR_PROFICIENCY_NEEDED;
- else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
- return EQUIP_ERR_CANT_EQUIP_SKILL;
- }
+ if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
+ return EQUIP_ERR_CANT_EQUIP_EVER;
- if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
- return EQUIP_ERR_PROFICIENCY_NEEDED;
+ if (proto->RequiredSkill != 0)
+ {
+ if (GetSkillValue(proto->RequiredSkill) == 0)
+ return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
+ else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
+ return EQUIP_ERR_CANT_EQUIP_SKILL;
+ }
- if (getLevel() < proto->RequiredLevel)
- return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
+ if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
+ return EQUIP_ERR_PROFICIENCY_NEEDED;
- // If World Event is not active, prevent using event dependant items
- if (proto->HolidayId && !IsHolidayActive((HolidayIds)proto->HolidayId))
- return EQUIP_ERR_CLIENT_LOCKED_OUT;
+ if (getLevel() < proto->RequiredLevel)
+ return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
- return EQUIP_ERR_OK;
- }
+ // If World Event is not active, prevent using event dependant items
+ if (proto->HolidayId && !IsHolidayActive((HolidayIds)proto->HolidayId))
+ return EQUIP_ERR_CLIENT_LOCKED_OUT;
- return EQUIP_ERR_ITEM_NOT_FOUND;
+ // learning (recipes, mounts, pets, etc.)
+ if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
+ if (HasSpell(proto->Spells[1].SpellId))
+ return EQUIP_ERR_NONE;
+
+ return EQUIP_ERR_OK;
}
InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObject const* lootedObject) const
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 4d4b28d6082..40e073a1500 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -206,7 +206,7 @@ void Transport::Update(uint32 diff)
G3D::Vector3 pos, dir;
_currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos);
_currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir);
- UpdatePosition(pos.x, pos.y, pos.z, atan2(dir.y, dir.x) + M_PI);
+ UpdatePosition(pos.x, pos.y, pos.z, std::atan2(dir.y, dir.x) + float(M_PI));
}
else
{
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 6ef74785d16..541a7c711ec 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -750,7 +750,7 @@ void Player::UpdateManaRegen()
// SpiritRegen(SPI, INT, LEVEL) = (0.001 + (SPI x sqrt(INT) x BASE_REGEN[LEVEL])) x 5
if (GetStat(STAT_INTELLECT) > 0.0f)
- spirit_regen *= sqrt(GetStat(STAT_INTELLECT));
+ spirit_regen *= std::sqrt(GetStat(STAT_INTELLECT));
// CombatRegen = 5% of Base Mana
float base_regen = GetCreateMana() * 0.01f + GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 9b4e7e5ac45..6742852a481 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -62,7 +62,7 @@
#include "MovementStructures.h"
#include "WorldSession.h"
-#include <math.h>
+#include <cmath>
float baseMoveSpeed[MAX_MOVE_TYPE] =
{
@@ -1322,7 +1322,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
- GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
+ GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(float(M_PI), this)
&& (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss())&& !victim->IsVehicle())
{
// -probability is between 0% and 40%
@@ -1336,7 +1336,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
uint32 VictimDefense = victim->GetMaxSkillValueForLevel(this);
uint32 AttackerMeleeSkill = GetMaxSkillValueForLevel();
- Probability *= AttackerMeleeSkill/(float)VictimDefense*0.16;
+ Probability *= AttackerMeleeSkill/(float)VictimDefense*0.16f;
if (Probability < 0)
Probability = 0;
@@ -1456,7 +1456,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
for (AuraEffectList::const_iterator j = resIgnoreAuras.begin(); j != resIgnoreAuras.end(); ++j)
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
- armor = floor(AddPct(armor, -(*j)->GetAmount()));
+ armor = std::floor(AddPct(armor, -(*j)->GetAmount()));
}
// Apply Player CR_ARMOR_PENETRATION rating
@@ -1544,7 +1544,7 @@ uint32 Unit::CalcSpellResistance(Unit* victim, SpellSchoolMask schoolMask, Spell
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;
}
@@ -1932,7 +1932,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
// Dodge chance
// only players can't dodge if attacker is behind
- if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
+ if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(float(M_PI), this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
{
TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
}
@@ -1961,7 +1961,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
// parry & block chances
// check if attack comes from behind, nobody can parry or block if attacker is behind
- if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
+ if (!victim->HasInArc(float(M_PI), this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind.");
else
{
@@ -2139,7 +2139,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac
if (spellProto && spellProto->Attributes & SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK)
return false;
- if (victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION) || victim->HasInArc(M_PI, this))
+ if (victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION) || victim->HasInArc(float(M_PI), this))
{
// Check creatures flags_extra for disable block
if (victim->GetTypeId() == TYPEID_UNIT &&
@@ -2259,7 +2259,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
canDodge = false;
// only if in front
- if (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
+ if (victim->HasInArc(float(M_PI), this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
{
int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
tmp += deflect_chance;
@@ -2270,7 +2270,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
}
// Check for attack from behind
- if (!victim->HasInArc(M_PI, this))
+ if (!victim->HasInArc(float(M_PI), this))
{
if (!victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
{
@@ -2425,7 +2425,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
return SPELL_MISS_RESIST;
// cast by caster in front of victim
- if (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
+ if (victim->HasInArc(float(M_PI), this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
{
int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
tmp += deflect_chance;
@@ -2918,7 +2918,7 @@ bool Unit::isInFrontInMap(Unit const* target, float distance, float arc) const
bool Unit::isInBackInMap(Unit const* target, float distance, float arc) const
{
- return IsWithinDistInMap(target, distance) && !HasInArc(2 * M_PI - arc, target);
+ return IsWithinDistInMap(target, distance) && !HasInArc(2 * float(M_PI) - arc, target);
}
bool Unit::isInAccessiblePlaceFor(Creature const* c) const
@@ -9901,7 +9901,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spe
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
- return floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
+ return std::floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}
void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
@@ -15232,7 +15232,7 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType)
void Unit::JumpTo(float speedXY, float speedZ, bool forward)
{
- float angle = forward ? 0 : M_PI;
+ float angle = forward ? 0 : float(M_PI);
if (GetTypeId() == TYPEID_UNIT)
GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
else
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index d80b4697f48..b9d3a287456 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1919,8 +1919,8 @@ class Unit : public WorldObject
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct);
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
- bool isInFrontInMap(Unit const* target, float distance, float arc = M_PI) const;
- bool isInBackInMap(Unit const* target, float distance, float arc = M_PI) const;
+ bool isInFrontInMap(Unit const* target, float distance, float arc = float(M_PI)) const;
+ bool isInBackInMap(Unit const* target, float distance, float arc = float(M_PI)) const;
// Visibility system
bool IsVisible() const;
diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h
index 9ed8549e9a1..04973237365 100644
--- a/src/server/game/Grids/GridDefines.h
+++ b/src/server/game/Grids/GridDefines.h
@@ -201,8 +201,8 @@ namespace Trinity
int x_val = int(x_offset + CENTER_GRID_CELL_ID + 0.5f);
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;
+ x_off = (float(x_offset) - float(x_val) + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL;
+ y_off = (float(y_offset) - float(y_val) + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL;
return CellCoord(x_val, y_val);
}
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index c9891de3c16..1162622af60 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -879,9 +879,9 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
float dz = player->GetPositionZ() - atEntry->z;
float dx = rotPlayerX - atEntry->x;
float dy = rotPlayerY - atEntry->y;
- if ((fabs(dx) > atEntry->box_x / 2 + delta) ||
- (fabs(dy) > atEntry->box_y / 2 + delta) ||
- (fabs(dz) > atEntry->box_z / 2 + delta))
+ if ((std::fabs(dx) > atEntry->box_x / 2 + delta) ||
+ (std::fabs(dy) > atEntry->box_y / 2 + delta) ||
+ (std::fabs(dz) > atEntry->box_z / 2 + delta))
{
TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u",
player->GetName().c_str(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId);
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index dabe40e427e..b59f9aca943 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -479,7 +479,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
{
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 09809d50b10..09905572aae 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -136,7 +136,7 @@ struct LootStoreItem
// Constructor, converting ChanceOrQuestChance -> (chance, needs_quest)
// displayid is filled in IsValid() which must be called after
LootStoreItem(uint32 _itemid, float _chanceOrQuestChance, uint16 _lootmode, uint8 _group, int32 _mincountOrRef, uint8 _maxcount)
- : itemid(_itemid), chance(fabs(_chanceOrQuestChance)), mincountOrRef(_mincountOrRef), lootmode(_lootmode),
+ : itemid(_itemid), chance(std::fabs(_chanceOrQuestChance)), mincountOrRef(_mincountOrRef), lootmode(_lootmode),
group(_group), needs_quest(_chanceOrQuestChance < 0), maxcount(_maxcount)
{ }
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 61773656642..31b16309fcd 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -2171,7 +2171,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 (z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z))
+ if (z < mapHeight || vmapHeight > mapHeight || std::fabs(mapHeight - z) > std::fabs(vmapHeight - z))
return vmapHeight;
else
return mapHeight; // better use .map surface height
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index ba7d3784157..7df509a6d21 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -139,7 +139,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
KeyFrame k(node_i);
G3D::Vector3 h;
orientationSpline.evaluate_derivative(i + 1, 0.0f, h);
- k.InitialOrientation = Position::NormalizeOrientation(atan2(h.y, h.x) + M_PI);
+ k.InitialOrientation = Position::NormalizeOrientation(std::atan2(h.y, h.x) + float(M_PI));
keyFrames.push_back(k);
splinePath.push_back(G3D::Vector3(node_i.x, node_i.y, node_i.z));
@@ -213,7 +213,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
for (size_t j = start; j < i + extra; ++j)
{
keyFrames[j].Index = j - start + 1;
- keyFrames[j].DistFromPrev = spline->length(j - start, j + 1 - start);
+ keyFrames[j].DistFromPrev = float(spline->length(j - start, j + 1 - start));
if (j > 0)
keyFrames[j - 1].NextDistFromPrev = keyFrames[j].DistFromPrev;
keyFrames[j].Spline = spline;
@@ -276,22 +276,22 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
if (keyFrames[i].DistSinceStop < keyFrames[i].DistUntilStop) // is still accelerating
{
// calculate accel+brake time for this short segment
- float segment_time = 2.0f * sqrt((keyFrames[i].DistUntilStop + keyFrames[i].DistSinceStop) / accel);
+ float segment_time = 2.0f * std::sqrt((keyFrames[i].DistUntilStop + keyFrames[i].DistSinceStop) / accel);
// substract acceleration time
- keyFrames[i].TimeTo = segment_time - sqrt(2 * keyFrames[i].DistSinceStop / accel);
+ keyFrames[i].TimeTo = segment_time - std::sqrt(2 * keyFrames[i].DistSinceStop / accel);
}
else // slowing down
- keyFrames[i].TimeTo = sqrt(2 * keyFrames[i].DistUntilStop / accel);
+ keyFrames[i].TimeTo = std::sqrt(2 * keyFrames[i].DistUntilStop / accel);
}
else if (keyFrames[i].DistSinceStop < accel_dist) // still accelerating (but will reach full speed)
{
// calculate accel + cruise + brake time for this long segment
float segment_time = (keyFrames[i].DistUntilStop + keyFrames[i].DistSinceStop) / speed + (speed / accel);
// substract acceleration time
- keyFrames[i].TimeTo = segment_time - sqrt(2 * keyFrames[i].DistSinceStop / accel);
+ keyFrames[i].TimeTo = segment_time - std::sqrt(2 * keyFrames[i].DistSinceStop / accel);
}
else if (keyFrames[i].DistUntilStop < accel_dist) // already slowing down (but reached full speed)
- keyFrames[i].TimeTo = sqrt(2 * keyFrames[i].DistUntilStop / accel);
+ keyFrames[i].TimeTo = std::sqrt(2 * keyFrames[i].DistUntilStop / accel);
else // at full speed
keyFrames[i].TimeTo = (keyFrames[i].DistUntilStop / speed) + (0.5f * speed / accel);
}
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 72bb0e1d56e..c0d20c20639 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -345,7 +345,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
float dist = 2 * moveTimeHalf * speedXY;
float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ);
- _owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI);
+ _owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + float(M_PI));
Movement::MoveSplineInit init(_owner);
init.MoveTo(x, y, z);
@@ -399,7 +399,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
}
// 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)
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index 95c342b70b3..dbe8c8b0329 100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
@@ -61,7 +61,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
if (is_air_ok) // 3D system above ground and above water (flying mode)
{
// Limit height change
- const float distanceZ = float(rand_norm()) * sqrtf(travelDistZ)/2.0f;
+ const float distanceZ = float(rand_norm()) * std::sqrt(travelDistZ)/2.0f;
destZ = respZ + distanceZ;
float levelZ = map->GetWaterOrGroundLevel(destX, destY, destZ-2.0f);
@@ -73,24 +73,24 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
else // 2D only
{
// 10.0 is the max that vmap high can check (MAX_CAN_FALL_DISTANCE)
- travelDistZ = travelDistZ >= 100.0f ? 10.0f : sqrtf(travelDistZ);
+ travelDistZ = travelDistZ >= 100.0f ? 10.0f : std::sqrt(travelDistZ);
// The fastest way to get an accurate result 90% of the time.
// Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long.
destZ = map->GetHeight(creature->GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, false);
- if (fabs(destZ - respZ) > travelDistZ) // Map check
+ if (std::fabs(destZ - respZ) > travelDistZ) // Map check
{
// Vmap Horizontal or above
destZ = map->GetHeight(creature->GetPhaseMask(), destX, destY, respZ - 2.0f, true);
- if (fabs(destZ - respZ) > travelDistZ)
+ if (std::fabs(destZ - respZ) > travelDistZ)
{
// Vmap Higher
destZ = map->GetHeight(creature->GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, true);
// let's forget this bad coords where a z cannot be find and retry at next tick
- if (fabs(destZ - respZ) > travelDistZ)
+ if (std::fabs(destZ - respZ) > travelDistZ)
return;
}
}
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index 6e3d7680637..4247197b3b0 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -47,7 +47,7 @@ Location MoveSpline::ComputePosition() const
if (splineflags.final_angle)
c.orientation = facing.angle;
else if (splineflags.final_point)
- c.orientation = atan2(facing.f.y - c.y, facing.f.x - c.x);
+ c.orientation = std::atan2(facing.f.y - c.y, facing.f.x - c.x);
//nothing to do for MoveSplineFlag::Final_Target flag
}
else
@@ -56,7 +56,7 @@ Location MoveSpline::ComputePosition() const
{
Vector3 hermite;
spline.evaluate_derivative(point_Idx, u, hermite);
- c.orientation = atan2(hermite.y, hermite.x);
+ c.orientation = std::atan2(hermite.y, hermite.x);
}
if (splineflags.orientationInversed)
@@ -226,7 +226,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const
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)
{
TC_LOG_ERROR("misc", "MoveSplineInitArgs::_checkPathBounds check failed");
return false;
diff --git a/src/server/game/Movement/Spline/MovementTypedefs.h b/src/server/game/Movement/Spline/MovementTypedefs.h
index 134e7a45425..a69af9e3a83 100644
--- a/src/server/game/Movement/Spline/MovementTypedefs.h
+++ b/src/server/game/Movement/Spline/MovementTypedefs.h
@@ -69,7 +69,7 @@ namespace Movement
typedef counter<uint32, 0xFFFFFFFF> UInt32Counter;
- extern double gravity;
+ extern float gravity;
extern UInt32Counter splineIdGen;
extern std::string MovementFlags_ToString(uint32 flags);
extern std::string MovementFlagsExtra_ToString(uint32 flags);
diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp
index f5bdba378d1..3f629238948 100644
--- a/src/server/game/Movement/Spline/MovementUtil.cpp
+++ b/src/server/game/Movement/Spline/MovementUtil.cpp
@@ -17,12 +17,12 @@
*/
#include "MoveSplineFlag.h"
-#include <math.h>
+#include <cmath>
#include <string>
namespace Movement
{
- double gravity = 19.29110527038574;
+ float gravity = static_cast<float>(19.29110527038574);
UInt32Counter splineIdGen;
/// Velocity bounds that makes fall speed limited
@@ -45,14 +45,14 @@ namespace Movement
if (path_length >= terminal_safeFall_length)
time = (path_length - terminal_safeFall_length) / terminalSafefallVelocity + terminal_safeFall_fallTime;
else
- time = sqrtf(2.0f * path_length / gravity);
+ time = std::sqrt(2.0f * path_length / gravity);
}
else
{
if (path_length >= terminal_length)
time = (path_length - terminal_length) / terminalVelocity + terminal_fallTime;
else
- time = sqrtf(2.0f * path_length / gravity);
+ time = std::sqrt(2.0f * path_length / gravity);
}
return time;
diff --git a/src/server/game/Movement/Spline/Spline.cpp b/src/server/game/Movement/Spline/Spline.cpp
index 6424afc5d6e..b8a028b6fc0 100644
--- a/src/server/game/Movement/Spline/Spline.cpp
+++ b/src/server/game/Movement/Spline/Spline.cpp
@@ -165,7 +165,7 @@ float SplineBase::SegLengthCatmullRom(index_type index) const
curPos = nextPos = p[1];
index_type i = 1;
- double length = 0;
+ float length = 0;
while (i <= STEPS_PER_SEGMENT)
{
C_Evaluate(p, float(i) / float(STEPS_PER_SEGMENT), s_catmullRomCoeffs, nextPos);
@@ -188,7 +188,7 @@ float SplineBase::SegLengthBezier3(index_type index) const
curPos = nextPos;
index_type i = 1;
- double length = 0;
+ float length = 0;
while (i <= STEPS_PER_SEGMENT)
{
C_Evaluate(p, float(i) / float(STEPS_PER_SEGMENT), s_Bezier3Coeffs, nextPos);
diff --git a/src/server/game/Movement/Waypoints/Path.h b/src/server/game/Movement/Waypoints/Path.h
index 4c275cbc15d..c7e701c49ad 100644
--- a/src/server/game/Movement/Waypoints/Path.h
+++ b/src/server/game/Movement/Waypoints/Path.h
@@ -63,7 +63,7 @@ class Path
float xd = node.x - prev.x;
float yd = node.y - prev.y;
float zd = node.z - prev.z;
- len += sqrtf(xd*xd + yd*yd + zd*zd);
+ len += std::sqrt(xd*xd + yd*yd + zd*zd);
}
return len;
}
@@ -80,7 +80,7 @@ class Path
float xd = x - node.x;
float yd = y - node.y;
float zd = z - node.z;
- len += sqrtf(xd*xd + yd*yd + zd*zd);
+ len += std::sqrt(xd*xd + yd*yd + zd*zd);
}
return len;
diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h
index d1fcadd40de..dd24cceae07 100644
--- a/src/server/game/Pools/PoolMgr.h
+++ b/src/server/game/Pools/PoolMgr.h
@@ -33,7 +33,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
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 5080733bb66..4d8ac65e55d 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -821,13 +821,13 @@ void Spell::SelectSpellTargets()
{
float speed = m_targets.GetSpeedXY();
if (speed > 0.0f)
- m_delayMoment = (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f);
+ m_delayMoment = uint64(std::floor(m_targets.GetDist2d() / speed * 1000.0f));
}
else if (m_spellInfo->Speed > 0.0f)
{
float dist = m_caster->GetDistance(*m_targets.GetDstPos());
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
- m_delayMoment = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
+ m_delayMoment = uint64(std::floor(dist / m_spellInfo->Speed * 1000.0f));
else
m_delayMoment = uint64(m_spellInfo->Speed * 1000.0f);
}
@@ -1104,7 +1104,7 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
- float coneAngle = M_PI/2;
+ float coneAngle = float(M_PI) / 2;
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster) * m_spellValue->RadiusMod;
if (uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList))
@@ -1465,7 +1465,7 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
float tangent(float x)
{
- x = tan(x);
+ x = std::tan(x);
//if (x < std::numeric_limits<float>::max() && x > -std::numeric_limits<float>::max()) return x;
//if (x >= std::numeric_limits<float>::max()) return std::numeric_limits<float>::max();
//if (x <= -std::numeric_limits<float>::max()) return -std::numeric_limits<float>::max();
@@ -1570,7 +1570,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex)
float sqrt1 = b * b + 4 * a * height;
if (sqrt1 > 0)
{
- sqrt1 = sqrt(sqrt1);
+ sqrt1 = std::sqrt(sqrt1);
dist = (sqrt1 - b) / (2 * a);
CHECK_DIST;
}
@@ -1579,7 +1579,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex)
float sqrt2 = b * b + 4 * a * height;
if (sqrt2 > 0)
{
- sqrt2 = sqrt(sqrt2);
+ sqrt2 = std::sqrt(sqrt2);
dist = (sqrt2 - b) / (2 * a);
CHECK_DIST;
@@ -1608,7 +1608,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex)
DEBUG_TRAJ(TC_LOG_ERROR("spells", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
if (distSq > sizeSq)
{
- float factor = 1 - sqrt(sizeSq / distSq);
+ float factor = 1 - std::sqrt(sizeSq / distSq);
x += factor * ((*itr)->GetPositionX() - x);
y += factor * ((*itr)->GetPositionY() - y);
z += factor * ((*itr)->GetPositionZ() - z);
@@ -2075,7 +2075,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
dist = 5.0f;
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
- targetInfo.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
+ targetInfo.timeDelay = uint64(std::floor(dist / m_spellInfo->Speed * 1000.0f));
else
targetInfo.timeDelay = uint64(m_spellInfo->Speed * 1000.0f);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 84716ad9590..9ee0411c302 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -1405,7 +1405,7 @@ public:
// place pet before player
float x, y, z;
player->GetClosePoint (x, y, z, creatureTarget->GetObjectSize(), CONTACT_DISTANCE);
- pet->Relocate(x, y, z, M_PI-player->GetOrientation());
+ pet->Relocate(x, y, z, float(M_PI) - player->GetOrientation());
// set pet to defensive mode by default (some classes can't control controlled pets in fact).
pet->SetReactState(REACT_DEFENSIVE);
@@ -1460,8 +1460,8 @@ public:
FormationInfo* group_member;
group_member = new FormationInfo;
- group_member->follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI;
- group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - creature->GetPositionX(), int(2))+pow(chr->GetPositionY() - creature->GetPositionY(), int(2)));
+ group_member->follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / float(M_PI);
+ group_member->follow_dist = std::sqrt(std::pow(chr->GetPositionX() - creature->GetPositionX(), 2.f) + std::pow(chr->GetPositionY() - creature->GetPositionY(), 2.f));
group_member->leaderGUID = leaderGUID;
group_member->groupAI = 0;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index e495cae71fc..ac24f868670 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -124,7 +124,7 @@ public:
float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance
{
- return sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
+ return std::sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
}
void Reset() override
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
index c8df08937b9..af9f8b72abf 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -328,7 +328,7 @@ public:
if (TailSweepTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- if (!me->HasInArc(M_PI, target))
+ if (!me->HasInArc(float(M_PI), target))
DoCast(target, SPELL_TAIL_SWEEP);
TailSweepTimer = 15000;
} else TailSweepTimer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index f86f267b6b9..19ec8da7fc9 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -1290,7 +1290,7 @@ public:
if (BackwardLungeTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
- if (target && !me->HasInArc(M_PI, target))
+ if (target && !me->HasInArc(float(M_PI), target))
{
DoCast(target, SPELL_BACKWARD_LUNGE);
BackwardLungeTimer = urand(15000, 30000);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index e6029acc61f..1f66f834b28 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -1191,8 +1191,8 @@ public:
bPointReached = false;
uiCheckTimer = 1000;
me->GetMotionMaster()->MovePoint(1, x, y, SHIELD_ORB_Z);
- c += M_PI/32;
- if (c >= 2*M_PI) c = 0;
+ c += float(M_PI)/32;
+ if (c >= 2 * float(M_PI)) c = 0;
}
else
{
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
index c9798338b36..25257848192 100644
--- a/src/server/scripts/Events/childrens_week.cpp
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -193,7 +193,7 @@ class npc_winterfin_playmate : public CreatureScript
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_1);
timer = 3000;
break;
@@ -292,7 +292,7 @@ class npc_snowfall_glade_playmate : public CreatureScript
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_1);
timer = 5000;
break;
@@ -393,7 +393,7 @@ class npc_the_biggest_tree : public CreatureScript
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
timer = 2000;
break;
case 2:
@@ -480,7 +480,7 @@ class npc_high_oracle_soo_roo : public CreatureScript
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_5);
timer = 3000;
break;
@@ -569,7 +569,7 @@ class npc_elder_kekek : public CreatureScript
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_4);
timer = 3000;
break;
@@ -658,7 +658,7 @@ class npc_the_etymidian : public CreatureScript
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_7);
timer = 5000;
break;
@@ -780,7 +780,7 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_11);
timer = 5000;
break;
@@ -811,7 +811,7 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
Reset();
return;
case 7:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_11);
timer = 5000;
break;
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index ef6d7da5116..ce9ed4f36c8 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -280,8 +280,8 @@ public:
me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
if (data > 0 && me->GetOrientation() < 4.0f)
me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
- me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (cos(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation());
- me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (cos(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation());
+ me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (std::cos(me->GetOrientation() - (float(M_PI) / 2)) * 2), me->GetPositionY() + (std::sin(me->GetOrientation() - (float(M_PI) / 2)) * 2), me->GetPositionZ(), me->GetOrientation());
+ me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (std::cos(me->GetOrientation() + (float(M_PI) / 2)) * 2), me->GetPositionY() + (std::sin(me->GetOrientation() + (float(M_PI) / 2)) * 2), me->GetPositionZ(), me->GetOrientation());
}
else if (data == 7)
me->SummonCreature(NPC_PLAGUEMAW_THE_ROTTING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index dd0c93e8a28..2cfd977fe99 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -334,9 +334,9 @@ public:
{
//Set angle and cast
if (ClockWise)
- me->SetOrientation(DarkGlareAngle + DarkGlareTick * M_PI / 35);
+ me->SetOrientation(DarkGlareAngle + DarkGlareTick * float(M_PI) / 35);
else
- me->SetOrientation(DarkGlareAngle - DarkGlareTick * M_PI / 35);
+ me->SetOrientation(DarkGlareAngle - DarkGlareTick * float(M_PI) / 35);
me->StopMoving();
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index d49a6a312da..a9ec3007e5d 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -120,7 +120,7 @@ class boss_viscidus : public CreatureScript
uint8 NumGlobes = me->GetHealthPct() / 5.0f;
for (uint8 i = 0; i < NumGlobes; ++i)
{
- float Angle = i * 2 * M_PI / NumGlobes;
+ float Angle = i * 2 * float(M_PI) / NumGlobes;
float X = ViscidusCoord.GetPositionX() + std::cos(Angle) * RoomRadius;
float Y = ViscidusCoord.GetPositionY() + std::sin(Angle) * RoomRadius;
float Z = -35.0f;
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index c024c1a567a..98256006fd3 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -1258,7 +1258,7 @@ class go_wind_stone : public GameObjectScript
void SummonNPC(GameObject* go, Player* player, uint32 npc, uint32 spell)
{
go->CastSpell(player, spell);
- TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000);
+ TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - float(M_PI), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000);
summons->CastSpell(summons, SPELL_SPAWN_IN, false);
switch (summons->GetEntry())
{
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
index c5b87eb48e8..9cc8540342f 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -50,7 +50,7 @@ enum Misc
};
#define DATA_SPHERE_DISTANCE 25.0f
-#define DATA_SPHERE_ANGLE_OFFSET M_PI / 2
+#define DATA_SPHERE_ANGLE_OFFSET float(M_PI) / 2
#define DATA_GROUND_POSITION_Z 11.30809f
enum Yells
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
index 4015467501e..e0930a1ae2e 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
@@ -289,13 +289,13 @@ public:
switch (i)
{
case 0:
- pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, M_PI);
+ pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, float(M_PI));
break;
case 1:
- pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, M_PI / 2);
+ pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, float(M_PI) / 2);
break;
case 2:
- pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, M_PI / 2 + M_PI);
+ pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, float(M_PI) / 2 + float(M_PI));
break;
}
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
index a0c42492a1b..68de65f9f7b 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -531,8 +531,8 @@ struct npc_unleashed_ballAI : public ScriptedAI
float x0 = ToCCommonLoc[1].GetPositionX(), y0 = ToCCommonLoc[1].GetPositionY(), r = 47.0f;
float y = y0;
float x = frand(x0 - r, x0 + r);
- float sq = pow(r, 2) - pow(x - x0, 2);
- float rt = sqrtf(fabs(sq));
+ float sq = std::pow(r, 2.f) - std::pow(x - x0, 2.f);
+ float rt = std::sqrt(std::fabs(sq));
if (urand(0, 1))
y = y0 + rt;
else
@@ -756,7 +756,7 @@ class spell_valkyr_essences : public SpellScriptLoader
// Twin Vortex part
uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner);
uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner);
- int32 stacksCount = int32(dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue()) * 0.001 - 1;
+ int32 stacksCount = dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue() / 1000 - 1;
if (lightVortex && darkVortex && stacksCount)
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
index e64067fb995..a048abd6554 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
@@ -292,7 +292,7 @@ class boss_devourer_of_souls : public CreatureScript
beamAngle = me->GetOrientation();
- beamAngleDiff = M_PI/30.0f; // PI/2 in 15 sec = PI/30 per tick
+ beamAngleDiff = float(M_PI)/30.0f; // PI/2 in 15 sec = PI/30 per tick
if (RAND(true, false))
beamAngleDiff = -beamAngleDiff;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
index a0f6039d703..535ace3259c 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -205,8 +205,8 @@ enum EncounterActions
ACTION_SHIP_VISITS = 5
};
-Position const SkybreakerAddsSpawnPos = { 15.91131f, 0.0f, 20.4628f, M_PI };
-Position const OrgrimsHammerAddsSpawnPos = { 60.728395f, 0.0f, 38.93467f, M_PI };
+Position const SkybreakerAddsSpawnPos = { 15.91131f, 0.0f, 20.4628f, float(M_PI) };
+Position const OrgrimsHammerAddsSpawnPos = { 60.728395f, 0.0f, 38.93467f, float(M_PI) };
// Horde encounter
Position const SkybreakerTeleportPortal = { 6.666975f, 0.013001f, 20.87888f, 0.0f };
@@ -439,7 +439,7 @@ private:
Position SelectSpawnPoint() const
{
Position newPos;
- float angle = frand(-M_PI * 0.5f, M_PI * 0.5f);
+ float angle = frand(float(-M_PI) * 0.5f, float(M_PI) * 0.5f);
newPos.m_positionX = _spawnPoint->GetPositionX() + 2.0f * std::cos(angle);
newPos.m_positionY = _spawnPoint->GetPositionY() + 2.0f * std::sin(angle);
newPos.m_positionZ = _spawnPoint->GetPositionZ();
@@ -1455,7 +1455,7 @@ struct npc_gunship_boarding_addAI : public gunship_npc_AI
if (Transport* destTransport = go->ToTransport())
destTransport->CalculatePassengerPosition(x, y, z, &o);
- float angle = frand(0, M_PI * 2.0f);
+ float angle = frand(0, float(M_PI) * 2.0f);
x += 2.0f * std::cos(angle);
y += 2.0f * std::sin(angle);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 5022cd4f645..1ff7e1b1352 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -674,7 +674,7 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader
void RecalculateDamage()
{
- SetHitDamage(int32(GetHitDamage() / std::max(sqrtf(GetHitUnit()->GetExactDist2d(GetCaster())), 1.0f)));
+ SetHitDamage(int32(GetHitDamage() / std::max(std::sqrt(GetHitUnit()->GetExactDist2d(GetCaster())), 1.0f)));
}
void Register() override
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index 53efc628aa2..648da29ca66 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -126,7 +126,7 @@ public:
{
float x, y, z, o;
me->GetHomePosition(x, y, z, o);
- me->NearTeleportTo(x, y, z, o - G3D::halfPi());
+ me->NearTeleportTo(x, y, z, o - (float(M_PI) / 2));
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->SetTarget(0);
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 5291e4baed3..fc1f88c083d 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -1014,7 +1014,7 @@ public:
// Used to generate perfect cyclic movements (Enter Circle).
void FillCirclePath(Position const& centerPos, float radius, float z, Movement::PointsArray& path, bool clockwise)
{
- float step = clockwise ? -M_PI / 8.0f : M_PI / 8.0f;
+ float step = clockwise ? float(-M_PI) / 8.0f : float(M_PI) / 8.0f;
float angle = centerPos.GetAngle(me->GetPositionX(), me->GetPositionY());
for (uint8 i = 0; i < 16; angle += step, ++i)
@@ -1326,7 +1326,7 @@ public:
private:
void FillCirclePath(Position const& centerPos, float radius, float z, Movement::PointsArray& path, bool clockwise)
{
- float step = clockwise ? -M_PI / 9.0f : M_PI / 9.0f;
+ float step = clockwise ? float(-M_PI) / 9.0f : float(M_PI) / 9.0f;
float angle = centerPos.GetAngle(me->GetPositionX(), me->GetPositionY());
for (uint8 i = 0; i < 18; angle += step, ++i)
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index f398dd99b5c..d07d68f28c9 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -315,7 +315,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
- float diff = fabs(orientation - angle);
+ float diff = std::fabs(orientation - angle);
if (diff > 1.0f)
itr = targets.erase(itr);
@@ -359,7 +359,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
- float diff = fabs(orientation - angle);
+ float diff = std::fabs(orientation - angle);
if (diff > 1.0f)
itr = targets.erase(itr);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
index 011d1844adf..196e410f239 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -526,7 +526,7 @@ class spell_general_vezax_saronite_vapors : public SpellScriptLoader
{
if (Unit* caster = GetCaster())
{
- int32 mana = int32(aurEff->GetAmount() * pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount
+ int32 mana = int32(aurEff->GetAmount() * std::pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount
int32 damage = mana * 2;
caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true);
caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, NULL, NULL, true);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index 4d904b04618..7f4d585b0a4 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -985,7 +985,7 @@ public:
if (!caster)
return;
- int32 damage = int32(200 * pow(2.0f, GetStackAmount()));
+ int32 damage = int32(200 * std::pow(2.0f, GetStackAmount()));
caster->CastCustomSpell(caster, SPELL_BITING_COLD_DAMAGE, &damage, NULL, NULL, true);
if (caster->isMoving())
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index 58969fd63c8..71a89c0e508 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -498,7 +498,7 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader
pos.m_positionX = 1756.25f + irand(-3, 3);
pos.m_positionY = -8.3f + irand(-3, 3);
pos.m_positionZ = 448.8f;
- pos.SetOrientation(M_PI);
+ pos.SetOrientation(float(M_PI));
GetHitPlayer()->DestroyForNearbyPlayers();
GetHitPlayer()->ExitVehicle(&pos);
GetHitPlayer()->UpdateObjectVisibility(false);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
index 4abf46be448..2471b705b90 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
@@ -839,7 +839,7 @@ class boss_sara : public CreatureScript
{
Position pos;
float radius = frand(25.0f, 50.0f);
- float angle = frand(0.0f, 2.0f * M_PI);
+ float angle = frand(0.0f, 2.0f * float(M_PI));
pos.m_positionX = YoggSaronSpawnPos.GetPositionX() + radius * cosf(angle);
pos.m_positionY = YoggSaronSpawnPos.GetPositionY() + radius * sinf(angle);
pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), YoggSaronSpawnPos.GetPositionZ() + 5.0f);
@@ -1119,7 +1119,7 @@ class npc_ominous_cloud : public CreatureScript
void FillCirclePath(Position const& centerPos, float radius, float z, Movement::PointsArray& path, bool clockwise)
{
- float step = clockwise ? -M_PI / 8.0f : M_PI / 8.0f;
+ float step = clockwise ? float(-M_PI) / 8.0f : float(M_PI) / 8.0f;
float angle = centerPos.GetAngle(me->GetPositionX(), me->GetPositionY());
for (uint8 i = 0; i < 16; angle += step, ++i)
@@ -2502,7 +2502,7 @@ class spell_yogg_saron_empowered : public SpellScriptLoader // 64161
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
- float stack = ceil((target->GetHealthPct() / 10) - 1);
+ float stack = std::ceil((target->GetHealthPct() / 10) - 1);
target->RemoveAurasDueToSpell(SPELL_EMPOWERED_BUFF);
if (stack)
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index d0fd948ce6a..6d41a2e9b21 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -718,7 +718,7 @@ public:
if (me->GetEntry() == NPC_LAKE_FROG)
{
me->AddAura(SPELL_FROG_LOVE, me);
- me->GetMotionMaster()->MoveFollow(player, 0.3f, frand(M_PI/2, M_PI + (M_PI/2)));
+ me->GetMotionMaster()->MoveFollow(player, 0.3f, frand(float(M_PI) / 2, float(M_PI) + (float(M_PI) / 2)));
_following = true;
}
else if (me->GetEntry() == NPC_LAKE_FROG_QUEST)
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
index c56739c783f..a4d6ab31846 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -410,7 +410,7 @@ public:
switch (phase)
{
case 1:
- orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ());
orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_6);
timer = 5000;
break;
diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp
index cf8c4cd9b36..2e75b10c0e8 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -247,7 +247,7 @@ public:
break;
case EVENT_RECRUIT_2:
me->SetWalk(true);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (cos(_heading) * 10), me->GetPositionY() + (sin(_heading) * 10), me->GetPositionZ());
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (std::cos(_heading) * 10), me->GetPositionY() + (std::sin(_heading) * 10), me->GetPositionZ());
me->DespawnOrUnsummon(5000);
break;
default:
diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
index 6b478bc9dfc..f1e170c0705 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -244,8 +244,8 @@ public:
if (me->GetAuraCount(SPELL_SHADE_SOUL_CHANNEL_2) <= 3)
{
- moveSpeed = (2.0 - (0.6 * me->GetAuraCount(SPELL_SHADE_SOUL_CHANNEL_2)));
- me->SetSpeed(MOVE_WALK, moveSpeed / 2.5);
+ moveSpeed = (2.0f - (0.6f * me->GetAuraCount(SPELL_SHADE_SOUL_CHANNEL_2)));
+ me->SetSpeed(MOVE_WALK, moveSpeed / 2.5f);
me->SetSpeed(MOVE_RUN, (moveSpeed * 2) / 7);
me->ClearUnitState(UNIT_STATE_ROOT);
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
index 8e478aadeca..fb5b4579942 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
@@ -278,7 +278,7 @@ public:
if (me->IsWithinDistInMap(who, attackRadius))
{
// Check first that object is in an angle in front of this one before LoS check
- if (me->HasInArc(M_PI/2.0f, who) && me->IsWithinLOSInMap(who))
+ if (me->HasInArc(float(M_PI) / 2.0f, who) && me->IsWithinLOSInMap(who))
{
AttackStart(who);
}
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index be437a154b3..63c01540af2 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -202,7 +202,7 @@ class boss_high_astromancer_solarian : public CreatureScript
{
float z = RAND(1.0f, -1.0f);
- return (z*sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y);
+ return (z*std::sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y);
}
void UpdateAI(uint32 diff) override
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
index 0981fc527f3..bbb384ed0f8 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -179,7 +179,7 @@ class boss_warp_splinter : public CreatureScript
{
for (uint8 i = 0; i < 6; ++i)
{
- float angle = (M_PI / 3) * i;
+ float angle = (float(M_PI) / 3) * i;
float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle);
float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle);
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 22a186b523b..fd4c972edbe 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1601,7 +1601,7 @@ class spell_gen_gift_of_naaru : public SpellScriptLoader
break;
}
- int32 healTick = floor(heal / aurEff->GetTotalTicks());
+ int32 healTick = std::floor(heal / aurEff->GetTotalTicks());
amount += int32(std::max(healTick, 0));
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 70451888c07..a8f8dc1f31c 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -2456,7 +2456,7 @@ class spell_item_unusual_compass : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
- caster->SetFacingTo(frand(0.0f, 2.0f * M_PI));
+ caster->SetFacingTo(frand(0.0f, 2.0f * float(M_PI)));
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 87661710f53..173e03fef7c 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -2008,7 +2008,7 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoa
void ModDest(SpellDestination& dest)
{
float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
- float angle = frand(0.75f, 1.25f) * M_PI;
+ float angle = frand(0.75f, 1.25f) * float(M_PI);
Position pos = GetCaster()->GetNearPosition(dist, angle);
dest.Relocate(pos);
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index c65970aed3d..ecbc6ca1bdc 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -621,7 +621,7 @@ class spell_warr_retaliation : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
// check attack comes not from behind and warrior is not stunned
- return GetTarget()->isInFront(eventInfo.GetProcTarget(), M_PI) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED);
+ return GetTarget()->isInFront(eventInfo.GetActor(), float(M_PI)) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED);
}
void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index e39cf9096f4..ba17dba602a 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -2231,7 +2231,7 @@ public:
if (GameObject* launcher = FindNearestLauncher())
{
launcher->SendCustomAnim(ANIM_GO_LAUNCH_FIREWORK);
- me->SetOrientation(launcher->GetOrientation() + M_PI/2);
+ me->SetOrientation(launcher->GetOrientation() + float(M_PI) / 2);
}
else
return;
diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h
index e9e9d4d58c0..4e23b4a4770 100644
--- a/src/server/shared/Common.h
+++ b/src/server/shared/Common.h
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <math.h>
+#include <cmath>
#include <errno.h>
#include <signal.h>
#include <assert.h>
@@ -153,7 +153,7 @@ struct LocalizedString
#endif
#ifndef M_PI
-#define M_PI 3.14159265358979323846f
+#define M_PI 3.14159265358979323846
#endif
#define MAX_QUERY_LEN 32*1024
diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h
index 8350815243c..d1501b0c149 100644
--- a/src/server/shared/Define.h
+++ b/src/server/shared/Define.h
@@ -50,6 +50,7 @@
#if PLATFORM == PLATFORM_WINDOWS
# define TRINITY_PATH_MAX MAX_PATH
+# define _USE_MATH_DEFINES
# ifndef DECLSPEC_NORETURN
# define DECLSPEC_NORETURN __declspec(noreturn)
# endif //DECLSPEC_NORETURN
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 35b23610143..fea5ad81328 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -31,7 +31,7 @@
#include <vector>
#include <cstring>
#include <time.h>
-#include <math.h>
+#include <cmath>
#include <boost/asio/buffer.hpp>
class MessageBuffer;
diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h
index 7c62de5f5ed..0e2d6ddbff5 100644
--- a/src/server/shared/Utilities/Timer.h
+++ b/src/server/shared/Utilities/Timer.h
@@ -27,7 +27,7 @@ inline uint32 getMSTime()
{
static const system_clock::time_point ApplicationStartTime = system_clock::now();
- return duration_cast<milliseconds>(system_clock::now() - ApplicationStartTime).count();
+ return uint32(duration_cast<milliseconds>(system_clock::now() - ApplicationStartTime).count());
}
inline uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index c8883773eed..d674acae09f 100644
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -620,7 +620,7 @@ class EventMap
if (!phase)
_phase = 0;
else if (phase <= 8)
- _phase = (1 << (phase - 1));
+ _phase = uint8(1 << (phase - 1));
}
/**
@@ -631,7 +631,7 @@ class EventMap
void AddPhase(uint8 phase)
{
if (phase && phase <= 8)
- _phase |= (1 << (phase - 1));
+ _phase |= uint8(1 << (phase - 1));
}
/**
@@ -642,7 +642,7 @@ class EventMap
void RemovePhase(uint8 phase)
{
if (phase && phase <= 8)
- _phase &= ~(1 << (phase - 1));
+ _phase &= uint8(~(1 << (phase - 1)));
}
/**
diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h
index 999a03a9009..3536d1160bc 100644
--- a/src/server/worldserver/TCSoap/TCSoap.h
+++ b/src/server/worldserver/TCSoap/TCSoap.h
@@ -21,6 +21,7 @@
#include "Define.h"
#include <mutex>
#include <future>
+#include <string>
void process_message(struct soap* soap_message);
void TCSoapThread(const std::string& host, uint16 port);