aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-01-01 00:26:53 +0100
committerShauren <shauren.trinity@gmail.com>2023-01-01 00:26:53 +0100
commitba9bbbc9d0c3b80d8954ad6390d23ae3d0f804b2 (patch)
treecfd3ebf24d78a26856a738d1a97c564bcae1acb6 /src/server/game
parentfa361a40c81c5b1623fe2ff8f9a206868a6604f0 (diff)
Core/Misc: Fixed deprecation warnings for c++20
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp4
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp4
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp22
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp10
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp8
-rw-r--r--src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp12
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp6
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp6
-rw-r--r--src/server/game/Movement/MotionMaster.cpp6
-rw-r--r--src/server/game/Scripting/ScriptReloadMgr.cpp6
-rw-r--r--src/server/game/Server/Packets/MailPackets.cpp2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp10
15 files changed, 54 insertions, 54 deletions
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 36d318a0ed4..79f06de7d84 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -461,13 +461,13 @@ Item* AuctionHouseMgr::GetAItem(ObjectGuid itemGuid)
uint64 AuctionHouseMgr::GetCommodityAuctionDeposit(ItemTemplate const* item, Minutes time, uint32 quantity)
{
uint32 sellPrice = item->GetSellPrice();
- return uint64(std::ceil(std::floor(fmax(0.15 * quantity * sellPrice, 100.0)) / SILVER) * SILVER) * (time.count() / (MIN_AUCTION_TIME / MINUTE));
+ return uint64(std::ceil(std::floor(fmax(0.15 * quantity * sellPrice, 100.0)) / int64(SILVER)) * int64(SILVER)) * (time.count() / (MIN_AUCTION_TIME / MINUTE));
}
uint64 AuctionHouseMgr::GetItemAuctionDeposit(Player* player, Item* item, Minutes time)
{
uint32 sellPrice = item->GetSellPrice(player);
- return uint64(std::ceil(std::floor(fmax(sellPrice * 0.15, 100.0)) / SILVER) * SILVER) * (time.count() / (MIN_AUCTION_TIME / MINUTE));
+ return uint64(std::ceil(std::floor(fmax(sellPrice * 0.15, 100.0)) / int64(SILVER)) * int64(SILVER)) * (time.count() / (MIN_AUCTION_TIME / MINUTE));
}
std::string AuctionHouseMgr::BuildItemAuctionMailSubject(AuctionMailType type, AuctionPosting const* auction)
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
index 684e9d452df..4270fd21a9d 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
@@ -398,7 +398,7 @@ uint32 AuctionBotBuyer::GetChanceMultiplier(uint32 quality)
// Buys the auction and does necessary actions to complete the buyout
void AuctionBotBuyer::BuyEntry(AuctionPosting* auction, AuctionHouseObject* auctionHouse)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->BuyoutOrUnitPrice) / GOLD);
+ TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->BuyoutOrUnitPrice) / float(GOLD));
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
@@ -426,7 +426,7 @@ void AuctionBotBuyer::BuyEntry(AuctionPosting* auction, AuctionHouseObject* auct
// Bids on the auction and does the necessary actions for bidding
void AuctionBotBuyer::PlaceBidToEntry(AuctionPosting* auction, AuctionHouseObject* auctionHouse, uint32 bidPrice)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / GOLD);
+ TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / float(GOLD));
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 9fc08c82604..60e3cac8de7 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -991,7 +991,7 @@ bool BfCapturePoint::Update(uint32 diff)
}
// get the difference of numbers
- float fact_diff = ((float) m_activePlayers[TEAM_ALLIANCE].size() - (float) m_activePlayers[TEAM_HORDE].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
+ float fact_diff = ((float) m_activePlayers[TEAM_ALLIANCE].size() - (float) m_activePlayers[TEAM_HORDE].size()) * diff / float(BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL);
if (G3D::fuzzyEq(fact_diff, 0.0f))
return false;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 7e34b5a30d4..4fcbb0bc1d2 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -362,7 +362,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
uint8 capturedNodes = 0;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
- if (m_Nodes[i] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
+ if (m_Nodes[i] == uint8(GetTeamIndexByTeamId(team)) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
++capturedNodes;
if (capturedNodes >= 5)
@@ -456,7 +456,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
- m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
+ m_Nodes[node] = uint8(teamIndex) + BG_AB_NODE_TYPE_CONTESTED;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
// create new contested banner
@@ -474,7 +474,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
{
UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1);
m_prevNodes[node] = m_Nodes[node];
- m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED;
+ m_Nodes[node] = uint8(teamIndex) + BG_AB_NODE_TYPE_OCCUPIED;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
// create new occupied banner
@@ -495,7 +495,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
- m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
+ m_Nodes[node] = uint8(teamIndex) + BG_AB_NODE_TYPE_CONTESTED;
// burn current occupied banner
_DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex);
// create new contested banner
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index c942c82493a..f295cb93cb2 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -28,7 +28,7 @@
BattlegroundAV::BattlegroundAV(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
{
BgObjects.resize(BG_AV_OBJECT_MAX);
- BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX);
+ BgCreatures.resize(AV_CPLACE_MAX + AsUnderlyingType(AV_STATICCPLACE_MAX));
for (uint8 i = 0; i < 2; i++)
{
@@ -281,7 +281,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
{
bool isStatic = false;
Creature* creature = nullptr;
- ASSERT(type < AV_CPLACE_MAX + AV_STATICCPLACE_MAX);
+ ASSERT(type < AV_CPLACE_MAX + AsUnderlyingType(AV_STATICCPLACE_MAX));
if (type >= AV_CPLACE_MAX) //static
{
type -= AV_CPLACE_MAX;
@@ -577,8 +577,8 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
RewardReputationToTeam(owner == ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, owner);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), owner);
- SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
- SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + uint32(GetTeamIndexByTeamId(owner)) + (2 * tmp), RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + uint32(GetTeamIndexByTeamId(owner)) + (2 * tmp), RESPAWN_ONE_DAY);
}
else
{
@@ -586,8 +586,8 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
- SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
- SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_IMMEDIATELY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + uint32(GetTeamIndexByTeamId(owner)) + 3 * node, RESPAWN_IMMEDIATELY);
PopulateNode(node);
if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
@@ -892,8 +892,8 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
if (!IsTower(node))
{
- SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
- SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(team)+3*node, RESPAWN_IMMEDIATELY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + uint32(GetTeamIndexByTeamId(team)) + 3 * node, RESPAWN_IMMEDIATELY);
}
// despawn old go
SpawnBGObject(object, RESPAWN_ONE_DAY);
@@ -998,8 +998,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
else
{
//spawning/despawning of aura
- SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn
- SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_ONE_DAY); //teeamaura despawn
+ SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_IMMEDIATELY); //neutral aura spawn
+ SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + uint32(GetTeamIndexByTeamId(owner)) + 3 * node, RESPAWN_ONE_DAY); //teeamaura despawn
RelocateDeadPlayers(BgCreatures[node]);
}
@@ -1463,7 +1463,7 @@ void BattlegroundAV::Reset()
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, AV_NEUTRAL_TEAM, false); //give snowfall neutral owner
m_Mine_Timer = AV_MINE_TICK_TIMER;
- for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
+ for (uint16 i = 0; i < AV_CPLACE_MAX + AsUnderlyingType(AV_STATICCPLACE_MAX); i++)
if (!BgCreatures[i].IsEmpty())
DelCreature(i);
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index ac0e24b2ddc..804b35da7e2 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -427,13 +427,13 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
nodePoint[i].needChange = true;
- RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]);
+ RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2]);
// if we are here means that the point has been lost, or it is the first capture
if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY)
- if (!BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + (nodePoint[i].nodeType) - 2].IsEmpty())
- DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1 + (nodePoint[i].nodeType) - 2);
+ if (!BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2].IsEmpty())
+ DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2);
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
@@ -577,7 +577,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* node, bool recapture)
{
if (node->nodeType != NODE_TYPE_REFINERY && node->nodeType != NODE_TYPE_QUARRY)
{
- if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+node->nodeType-2, BG_IC_SpiritGuidePos[node->nodeType], node->faction))
+ if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(node->nodeType) - 2, BG_IC_SpiritGuidePos[node->nodeType], node->faction))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", node->nodeType, node->faction);
}
@@ -878,7 +878,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
}
// If not, place ghost on starting location
if (!good_entry)
- good_entry = sObjectMgr->GetWorldSafeLoc(BG_IC_GraveyardIds[teamIndex+MAX_NODE_TYPES]);
+ good_entry = sObjectMgr->GetWorldSafeLoc(BG_IC_GraveyardIds[uint32(teamIndex) + MAX_NODE_TYPES]);
return good_entry;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 6fd8d4ad30e..2cd86262ef1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -35,7 +35,7 @@ BattlegroundSA::BattlegroundSA(BattlegroundTemplate const* battlegroundTemplate)
StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0; // handle by Kanrethad
BgObjects.resize(BG_SA_MAXOBJ);
- BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY);
+ BgCreatures.resize(AsUnderlyingType(BG_SA_MAXNPC) + AsUnderlyingType(BG_SA_MAX_GY));
TimerEnabled = false;
UpdateWaitTimer = 0;
SignaledRoundTwo = false;
@@ -94,7 +94,7 @@ bool BattlegroundSA::ResetObjs()
for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
DelCreature(i);
- for (uint8 i = BG_SA_MAXNPC; i < BG_SA_MAXNPC + BG_SA_MAX_GY; i++)
+ for (uint8 i = BG_SA_MAXNPC; i < AsUnderlyingType(BG_SA_MAXNPC) + AsUnderlyingType(BG_SA_MAX_GY); i++)
DelCreature(i);
for (uint8 i = 0; i < MAX_GATES; ++i)
@@ -750,7 +750,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
if (GraveyardStatus[i] == Attackers)
return;
- DelCreature(BG_SA_MAXNPC + i);
+ DelCreature(AsUnderlyingType(BG_SA_MAXNPC) + i);
TeamId teamId = GetTeamIndexByTeamId(GetPlayerTeam(Source->GetGUID()));
GraveyardStatus[i] = teamId;
WorldSafeLocsEntry const* sg = sObjectMgr->GetWorldSafeLoc(BG_SA_GYEntries[i]);
@@ -760,7 +760,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
return;
}
- AddSpiritGuide(i + BG_SA_MAXNPC, sg->Loc.GetPositionX(), sg->Loc.GetPositionY(), sg->Loc.GetPositionZ(), BG_SA_GYOrientation[i], GraveyardStatus[i]);
+ AddSpiritGuide(i + AsUnderlyingType(BG_SA_MAXNPC), sg->Loc.GetPositionX(), sg->Loc.GetPositionY(), sg->Loc.GetPositionZ(), BG_SA_GYOrientation[i], GraveyardStatus[i]);
uint32 npc = 0;
uint32 flag = 0;
diff --git a/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp b/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp
index 36a01947955..c755a372a1d 100644
--- a/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp
+++ b/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp
@@ -149,7 +149,7 @@ void AzeriteEmpoweredItem::ClearSelectedAzeritePowers()
int64 AzeriteEmpoweredItem::GetRespecCost() const
{
if (Player const* owner = GetOwner())
- return int64(GOLD * sDB2Manager.GetCurveValueAt(CURVE_ID_AZERITE_EMPOWERED_ITEM_RESPEC_COST, float(owner->GetNumRespecs())));
+ return int64(float(GOLD) * sDB2Manager.GetCurveValueAt(CURVE_ID_AZERITE_EMPOWERED_ITEM_RESPEC_COST, float(owner->GetNumRespecs())));
return MAX_MONEY_AMOUNT + 1;
}
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 7f148e6b6bc..c6fb2db9acf 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -8240,7 +8240,7 @@ void Player::ApplyArtifactPowerRank(Item* artifact, ArtifactPowerRankEntry const
args.SetCastItem(artifact);
if (artifactPowerRank->AuraPointsOverride)
for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
- args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + spellEffectInfo.EffectIndex), artifactPowerRank->AuraPointsOverride);
+ args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + AsUnderlyingType(spellEffectInfo.EffectIndex)), artifactPowerRank->AuraPointsOverride);
CastSpell(this, artifactPowerRank->SpellID, args);
}
@@ -8541,7 +8541,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
if (spellEffectInfo.IsEffect())
- args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + spellEffectInfo.EffectIndex), CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
+ args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + AsUnderlyingType(spellEffectInfo.EffectIndex)), CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
}
CastSpell(target, spellInfo->Id, args);
}
@@ -27190,10 +27190,12 @@ void Player::StartLoadingActionButtons(std::function<void()>&& callback /*= null
// safe callback, we can't pass this pointer directly
// in case player logs out before db response (player would be deleted in that case)
if (Player* thisPlayer = mySess->GetPlayer(); thisPlayer && thisPlayer->GetGUID() == myGuid)
+ {
thisPlayer->LoadActions(result);
- if (callback)
- callback();
+ if (callback)
+ callback();
+ }
}));
}
@@ -27292,7 +27294,7 @@ void Player::UpdateTraitConfig(WorldPackets::Traits::TraitConfig&& newConfig, in
break;
}
- std::function<void()> finalizeTraitConfigUpdate = [=, newConfig = std::move(newConfig)]()
+ std::function<void()> finalizeTraitConfigUpdate = [=, this, newConfig = std::move(newConfig)]()
{
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData)
.ModifyValue(&UF::ActivePlayerData::TraitConfigs, index)
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index bb35bf3db24..2fe2924702b 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -319,7 +319,7 @@ void Player::UpdateMaxPower(Powers power)
if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS)
return;
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreatePowerValue(power);
value *= GetPctModifierValue(unitMod, BASE_PCT);
@@ -922,7 +922,7 @@ void Creature::UpdateMaxPower(Powers power)
if (GetPowerIndex(power) == MAX_POWERS)
return;
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreatePowerValue(power);
value *= GetPctModifierValue(unitMod, BASE_PCT);
@@ -1173,7 +1173,7 @@ void Guardian::UpdateMaxPower(Powers power)
if (GetPowerIndex(power) == MAX_POWERS)
return;
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreatePowerValue(power);
value *= GetPctModifierValue(unitMod, BASE_PCT);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 3c249b44a39..67cd13bdd2d 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4924,7 +4924,7 @@ void Unit::UpdateStatBuffMod(Stats stat)
float modNeg = 0.0f;
float factor = 0.0f;
- UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + stat);
+ UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
// includes value from items and enchantments
float modValue = GetFlatModifierValue(unitMod, BASE_VALUE);
@@ -8903,7 +8903,7 @@ void Unit::UpdateAllDamagePctDoneMods()
float Unit::GetTotalStatValue(Stats stat) const
{
- UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + stat);
+ UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
// value = ((base_value * base_pct) + total_value) * total_pct
float value = CalculatePct(GetFlatModifierValue(unitMod, BASE_VALUE), std::max(GetFlatModifierValue(unitMod, BASE_PCT_EXCLUDE_CREATE), -100.0f));
@@ -12190,7 +12190,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
}
}
- std::function<void(Movement::MoveSplineInit&)> initializer = [=, vehicleCollisionHeight = vehicle->GetBase()->GetCollisionHeight()](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this, vehicleCollisionHeight = vehicle->GetBase()->GetCollisionHeight()](Movement::MoveSplineInit& init)
{
float height = pos.GetPositionZ() + vehicleCollisionHeight;
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index fd6acc752af..ca92ce4fb5b 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -688,7 +688,7 @@ void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance)
else
{
// We are already close enough. We just need to turn toward the target without changing position.
- std::function<void(Movement::MoveSplineInit&)> initializer = [=, target = target->GetGUID()](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this, target = target->GetGUID()](Movement::MoveSplineInit& init)
{
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
if (Unit const* refreshedTarget = ObjectAccessor::GetUnit(*_owner, target))
@@ -897,7 +897,7 @@ void MotionMaster::MoveJumpWithGravity(Position const& pos, float speedXY, float
void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount)
{
- std::function<void(Movement::MoveSplineInit&)> initializer = [=](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this](Movement::MoveSplineInit& init)
{
float step = 2 * float(M_PI) / stepCount * (clockwise ? -1.0f : 1.0f);
Position const& pos = { x, y, z, 0.0f };
@@ -1022,7 +1022,7 @@ void MotionMaster::MoveFall(uint32 id/* = 0*/)
return;
}
- std::function<void(Movement::MoveSplineInit&)> initializer = [=](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this](Movement::MoveSplineInit& init)
{
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz + _owner->GetHoverOffset(), false);
init.SetFall();
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp
index 3c607418649..ba5918a41ab 100644
--- a/src/server/game/Scripting/ScriptReloadMgr.cpp
+++ b/src/server/game/Scripting/ScriptReloadMgr.cpp
@@ -981,7 +981,7 @@ private:
// the module which prevents it from unloading.
// The module will be unloaded once all scripts provided from the module
// are destroyed.
- if (!ref->second.first.unique())
+ if (ref->second.first.use_count() != 1)
{
TC_LOG_INFO("scripts.hotswap",
"Script module %s is still used by %lu spell, aura or instance scripts. "
@@ -1564,7 +1564,7 @@ void SourceUpdateListener::handleFileAction(efsw::WatchID watchid, std::string c
return;
}
- auto const path = fs::absolute(
+ fs::path path = fs::absolute(
filename,
dir);
@@ -1573,7 +1573,7 @@ void SourceUpdateListener::handleFileAction(efsw::WatchID watchid, std::string c
return;
/// Thread safe part
- sScriptReloadMgr->QueueMessage([=](HotSwapScriptReloadMgr* reloader)
+ sScriptReloadMgr->QueueMessage([=, this, path = std::move(path)](HotSwapScriptReloadMgr* reloader)
{
TC_LOG_TRACE("scripts.hotswap", "Detected source change on module \"%s\", "
"queued for recompilation...", script_module_name_.c_str());
diff --git a/src/server/game/Server/Packets/MailPackets.cpp b/src/server/game/Server/Packets/MailPackets.cpp
index 712f174bd39..5bfb0f0ff8f 100644
--- a/src/server/game/Server/Packets/MailPackets.cpp
+++ b/src/server/game/Server/Packets/MailPackets.cpp
@@ -100,7 +100,7 @@ WorldPackets::Mail::MailListEntry::MailListEntry(::Mail const* mail, ::Player* p
StationeryID = mail->stationery;
SentMoney = mail->money;
Flags = mail->checked;
- DaysLeft = float(mail->expire_time - GameTime::GetGameTime()) / DAY;
+ DaysLeft = float(mail->expire_time - GameTime::GetGameTime()) / float(DAY);
MailTemplateID = mail->mailTemplateId;
Subject = mail->subject;
Body = mail->body;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 1cf1e97a846..1a392ef9f2c 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3757,8 +3757,7 @@ void AuraEffect::HandleAuraModMaxPower(AuraApplication const* aurApp, uint8 mode
Unit* target = aurApp->GetTarget();
- Powers power = Powers(GetMiscValue());
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + GetMiscValue());
target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
}
@@ -3844,8 +3843,7 @@ void AuraEffect::HandleAuraModIncreaseEnergy(AuraApplication const* aurApp, uint
return;
Unit* target = aurApp->GetTarget();
- Powers powerType = Powers(GetMiscValue());
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + GetMiscValue());
target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
}
@@ -3858,7 +3856,7 @@ void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const* aurAp
Unit* target = aurApp->GetTarget();
Powers powerType = Powers(GetMiscValue());
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + GetMiscValue());
// Save old powers for further calculation
int32 oldPower = target->GetPower(powerType);
@@ -4003,7 +4001,7 @@ void AuraEffect::HandleAuraModMaxPowerPct(AuraApplication const* aurApp, uint8 m
return;
Powers powerType = Powers(GetMiscValue());
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + GetMiscValue());
// Save old powers for further calculation
int32 oldPower = target->GetPower(powerType);