diff --git a/dep/boost/CMakeLists.txt b/dep/boost/CMakeLists.txt index 0b1f06ef24..4df101c295 100644 --- a/dep/boost/CMakeLists.txt +++ b/dep/boost/CMakeLists.txt @@ -77,9 +77,6 @@ target_compile_definitions(boost -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB -DBOOST_CHRONO_NO_LIB - # Due to MSVC linking error boost::none" already defined in scripts_... - # May be removed when the requirement is raised to boost 1.61 on windows. - -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE -DBOOST_SERIALIZATION_NO_LIB -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE -DBOOST_ASIO_NO_DEPRECATED diff --git a/src/common/Collision/Management/VMapManager2.cpp b/src/common/Collision/Management/VMapManager2.cpp index dda4923155..23958b1cfc 100644 --- a/src/common/Collision/Management/VMapManager2.cpp +++ b/src/common/Collision/Management/VMapManager2.cpp @@ -314,7 +314,7 @@ namespace VMAP int32 adtId, rootId, groupId; uint32 flags; if (getAreaInfo(mapId, x, y, data.floorZ, flags, adtId, rootId, groupId)) - data.areaInfo = boost::in_place(adtId, rootId, groupId, flags); + data.areaInfo.emplace(adtId, rootId, groupId, flags); return; } auto instanceTree = GetMapTree(mapId); @@ -331,10 +331,10 @@ namespace VMAP float liquidLevel; if (!reqLiquidType || (GetLiquidFlagsPtr(liquidType) & reqLiquidType)) if (info.hitInstance->GetLiquidLevel(pos, info, liquidLevel)) - data.liquidInfo = boost::in_place(liquidType, liquidLevel); + data.liquidInfo.emplace(liquidType, liquidLevel); if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG)) - data.areaInfo = boost::in_place(info.hitInstance->adtId, info.rootId, info.hitModel->GetWmoID(), info.hitModel->GetMogpFlags()); + data.areaInfo.emplace(info.hitInstance->adtId, info.rootId, info.hitModel->GetWmoID(), info.hitModel->GetMogpFlags()); } } } diff --git a/src/common/Utilities/Optional.h b/src/common/Utilities/Optional.h index dc5cd97097..6b9a07d303 100644 --- a/src/common/Utilities/Optional.h +++ b/src/common/Utilities/Optional.h @@ -18,8 +18,10 @@ #ifndef TrinityCore_Optional_h__ #define TrinityCore_Optional_h__ -#include "OptionalFwd.h" -#include -#include +#include + + //! Optional helper class to wrap optional values within. +template +using Optional = std::optional; #endif // TrinityCore_Optional_h__ diff --git a/src/common/Utilities/OptionalFwd.h b/src/common/Utilities/OptionalFwd.h deleted file mode 100644 index 516ebeb772..0000000000 --- a/src/common/Utilities/OptionalFwd.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef OptionalFwd_h__ -#define OptionalFwd_h__ - -namespace boost -{ - template - class optional; -} - -//! Optional helper class to wrap optional values within. -template -using Optional = boost::optional; - -#endif // OptionalFwd_h__ diff --git a/src/common/Utilities/TaskScheduler.cpp b/src/common/Utilities/TaskScheduler.cpp index 8b04a060cf..4874885eed 100644 --- a/src/common/Utilities/TaskScheduler.cpp +++ b/src/common/Utilities/TaskScheduler.cpp @@ -188,7 +188,7 @@ TaskContext& TaskContext::SetGroup(TaskScheduler::group_t const group) TaskContext& TaskContext::ClearGroup() { - _task->_group = boost::none; + _task->_group = std::nullopt; return *this; } diff --git a/src/common/Utilities/TaskScheduler.h b/src/common/Utilities/TaskScheduler.h index 9d5eabd94e..da80d02be8 100644 --- a/src/common/Utilities/TaskScheduler.h +++ b/src/common/Utilities/TaskScheduler.h @@ -23,6 +23,7 @@ #include "Random.h" #include #include +#include #include #include #include @@ -83,7 +84,7 @@ class TC_COMMON_API TaskScheduler // Minimal Argument construct Task(timepoint_t const& end, duration_t const& duration, task_handler_t const& task) - : _end(end), _duration(duration), _group(boost::none), _repeated(0), _task(task) { } + : _end(end), _duration(duration), _group(std::nullopt), _repeated(0), _task(task) { } // Copy construct Task(Task const&) = delete; diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index 0c4be9f69a..71dc70829d 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -51,7 +51,7 @@ class TC_GAME_API GameObjectAI static int32 Permissible(GameObject const* go); // Called when the dialog status between a player and the gameobject is requested. - virtual Optional GetDialogStatus(Player* /*player*/) { return boost::none; } + virtual Optional GetDialogStatus(Player* /*player*/) { return std::nullopt; } // Called when a player opens a gossip dialog with the gameobject. virtual bool GossipHello(Player* /*player*/) { return false; } diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index aa951c1c4a..b0d825768b 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -196,7 +196,7 @@ class TC_GAME_API CreatureAI : public UnitAI /// == Gossip system ================================ // Called when the dialog status between a player and the creature is requested. - virtual Optional GetDialogStatus(Player* /*player*/) { return boost::none; } + virtual Optional GetDialogStatus(Player* /*player*/) { return std::nullopt; } // Called when a player opens a gossip dialog with the creature. virtual bool GossipHello(Player* /*player*/) { return false; } diff --git a/src/server/game/Chat/ChatCommands/ChatCommand.h b/src/server/game/Chat/ChatCommands/ChatCommand.h index 0af9e0ba0a..c1d6547921 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommand.h +++ b/src/server/game/Chat/ChatCommands/ChatCommand.h @@ -132,11 +132,11 @@ struct CommandArgsConsumerMulti, offset> // try with the argument auto& myArg = std::get(tuple); myArg.emplace(); - if (char const* next = CommandArgsConsumerSingle::TryConsumeTo(*(myArg.get_ptr()), args)) + if (char const* next = CommandArgsConsumerSingle::TryConsumeTo(myArg.value(), args)) if ((next = CommandArgsConsumerNext::GoNext(tuple, next))) return next; // try again omitting the argument - myArg = boost::none; + myArg = std::nullopt; if (char const* next = CommandArgsConsumerNext::GoNext(tuple, args)) return next; return nullptr; @@ -171,8 +171,8 @@ class TC_GAME_API CommandArgs { Optional, advstd::remove_cvref_t, advstd::remove_cvref_t...>> rv; rv.emplace(); - if (!TryConsumeToTuple<0>(*(rv.get_ptr()))) - rv = boost::none; + if (!TryConsumeToTuple<0>(rv.value())) + rv = std::nullopt; return rv; } @@ -182,10 +182,10 @@ class TC_GAME_API CommandArgs using T = advstd::remove_cvref_t; Optional rv; rv.emplace(); - if (char const* next = CommandArgsConsumerSingle::TryConsumeTo(*(rv.get_ptr()), _args)) + if (char const* next = CommandArgsConsumerSingle::TryConsumeTo(rv.value(), _args)) _args = next; else - rv = boost::none; + rv = std::nullopt; return rv; } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6c30ce7040..7069b6542d 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2174,7 +2174,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Option if (!spellInfo->Effects[i].IsEffect()) continue; - if (effectMask && !(effectMask.get() & (1 << i))) + if (effectMask && !(effectMask.value() & (1 << i))) continue; if (!IsImmunedToSpellEffect(spellInfo, i, caster)) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 788070e8b5..2cca23d4fc 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -128,7 +128,7 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma bool IsClassTrainerOf(Player const* player) const; bool CanCreatureAttack(Unit const* victim, bool force = true) const; void LoadTemplateImmunities(); - bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Optional effectMask = nullptr) const override; + bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Optional effectMask = {}) const override; bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const override; bool isElite() const; bool isWorldBoss() const; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 01670eb8b7..7e10543980 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1261,7 +1261,7 @@ void WorldObject::ProcessPositionDataChanged(PositionFullTerrainStatus const& da m_outdoors = data.outdoors; m_staticFloorZ = data.floorZ; m_liquidStatus = data.liquidStatus; - m_wmoGroupID = data.areaInfo.is_initialized() ? data.areaInfo->groupId : 0; + m_wmoGroupID = data.areaInfo.has_value() ? data.areaInfo->groupId : 0; } void WorldObject::AddToWorld() diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 51b638f2a1..251342d5d3 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -444,7 +444,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation void setActive(bool isActiveObject); bool IsFarVisible() const { return m_isFarVisible; } void SetFarVisible(bool on); - bool IsVisibilityOverriden() const { return m_visibilityDistanceOverride.is_initialized(); } + bool IsVisibilityOverriden() const { return m_visibilityDistanceOverride.has_value(); } void SetVisibilityDistanceOverride(VisibilityDistanceType type); void SetWorldObject(bool apply); bool IsPermanentWorldObject() const { return m_isWorldObject; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 96d88f0a22..51bd568dde 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1618,7 +1618,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati transferPending.MapID = mapid; if (Transport* transport = GetTransport()) { - transferPending.Ship = boost::in_place(); + transferPending.Ship.emplace(); transferPending.Ship->ID = transport->GetEntry(); transferPending.Ship->OriginMapID = GetMapId(); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b7228de0c8..0b173df606 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5173,7 +5173,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) int32 overkill = damageInfo->damage - damageInfo->target->GetHealth(); packet.OverDamage = (overkill < 0 ? -1 : overkill); - packet.SubDmg = boost::in_place(); + packet.SubDmg.emplace(); packet.SubDmg->SchoolMask = damageInfo->damageSchoolMask; // School of sub damage packet.SubDmg->FDamage = damageInfo->damage; // sub damage packet.SubDmg->Damage = damageInfo->damage; // Sub Damage @@ -7688,7 +7688,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, OptionalEffects[i].IsEffect()) continue; - if (effectMask && !(effectMask.get() & (1 << i))) + if (effectMask && !(effectMask.value() & (1 << i))) continue; if (!IsImmunedToSpellEffect(spellInfo, i, caster)) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 1fa91c675e..0b1b8f48b8 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -21,7 +21,6 @@ #include "Object.h" #include "EventProcessor.h" #include "CombatManager.h" -#include "OptionalFwd.h" #include "SpellAuraDefines.h" #include "SpellDefines.h" #include "ThreatManager.h" @@ -994,7 +993,7 @@ class TC_GAME_API Unit : public WorldObject float MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, uint32 spellId) const; SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo); SpellMissInfo MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo); - SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spellInfo, bool canReflect = false, Optional effectMask = nullptr); + SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spellInfo, bool canReflect = false, Optional effectMask = {}); float GetUnitDodgeChance(WeaponAttackType attType, Unit const* victim) const; float GetUnitParryChance(WeaponAttackType attType, Unit const* victim) const; @@ -1548,7 +1547,7 @@ class TC_GAME_API Unit : public WorldObject uint32 GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); - virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Optional effectMask = nullptr) const; // redefined in Creature + virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Optional effectMask = {}) const; // redefined in Creature uint32 GetSchoolImmunityMask() const; uint32 GetMechanicImmunityMask() const; diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp index 47bb10b455..137ca2578f 100644 --- a/src/server/game/Handlers/AuthHandler.cpp +++ b/src/server/game/Handlers/AuthHandler.cpp @@ -25,7 +25,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos) if (code == AUTH_OK) { - response.SuccessInfo = boost::in_place(); + response.SuccessInfo.emplace(); response.SuccessInfo->AccountExpansionLevel = GetAccountExpansion(); response.SuccessInfo->ActiveExpansionLevel = GetExpansion(); @@ -33,7 +33,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos) if (queued) { - response.WaitInfo = boost::in_place(); + response.WaitInfo.emplace(); response.WaitInfo->WaitCount = queuePos; } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 1fdb7ae5db..75322336d0 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -881,7 +881,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder) bool europaTicketSystemEnabled = sWorld->getBoolConfig(CONFIG_ALLOW_BUG_REPORTS_AND_SUGGESTIONS); if (europaTicketSystemEnabled) { - features.EuropaTicketSystemStatus = boost::in_place(); + features.EuropaTicketSystemStatus.emplace(); features.EuropaTicketSystemStatus->TryCount = 1; features.EuropaTicketSystemStatus->LastResetTimeBeforeNow = 264134872; // Pulled from sniff data features.EuropaTicketSystemStatus->PerMilliseconds = 10; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 6247757679..7c155731ef 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2806,7 +2806,7 @@ void Map::GetFullTerrainStatusForPosition(PhaseShift const& phaseShift, float x, { if (vmapData.areaInfo) { - data.areaInfo = boost::in_place(vmapData.areaInfo->adtId, vmapData.areaInfo->rootId, vmapData.areaInfo->groupId, vmapData.areaInfo->mogpFlags); + data.areaInfo.emplace(vmapData.areaInfo->adtId, vmapData.areaInfo->rootId, vmapData.areaInfo->groupId, vmapData.areaInfo->mogpFlags); // wmo found WMOAreaTableEntry const* wmoEntry = sDBCManager.GetWMOAreaTableEntryByTripple(vmapData.areaInfo->rootId, vmapData.areaInfo->adtId, vmapData.areaInfo->groupId); data.outdoors = (vmapData.areaInfo->mogpFlags & 0x8) != 0; @@ -2867,7 +2867,7 @@ void Map::GetFullTerrainStatusForPosition(PhaseShift const& phaseShift, float x, } } - data.liquidInfo = boost::in_place(); + data.liquidInfo.emplace(); data.liquidInfo->level = vmapData.liquidInfo->level; data.liquidInfo->depth_level = vmapData.floorZ; data.liquidInfo->entry = liquidType; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index fd95d3a67c..7ffdb56652 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -353,7 +353,7 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, Optional velo init.SetFly(); init.SetAnimation(AnimationTier::Ground); if (velocity) - init.SetVelocity(velocity.get()); + init.SetVelocity(velocity.value()); Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_ACTIVE); } @@ -367,7 +367,7 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, Optional v init.SetFly(); init.SetAnimation(AnimationTier::Hover); if (velocity) - init.SetVelocity(velocity.get()); + init.SetVelocity(velocity.value()); Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_ACTIVE); } diff --git a/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp index d92789a5d6..515885fca5 100644 --- a/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp @@ -169,7 +169,7 @@ bool ChaseMovementGenerator::Update(Unit* owner, uint32 diff) _nextMovementTimer.Reset(CHASE_MOVEMENT_INTERVAL); // Target has moved since we last checked its position. Handle new cases - if (!_lastTargetPosition || target->GetPosition() != _lastTargetPosition.get()) + if (!_lastTargetPosition || target->GetPosition() != _lastTargetPosition.value()) { // Create new snapshot of our target's position _lastTargetPosition = target->GetPosition(); diff --git a/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.cpp index 49877a12f5..e8e69b5abf 100644 --- a/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.cpp @@ -34,13 +34,13 @@ inline bool CanMove(Creature const* creature) CyclicMovementGenerator::CyclicMovementGenerator(WaypointPath const* path, Optional enforceFlight, Optional enforceWalk, Optional velocity) : _path(path), _stalled(false), _moveTimer(0) { - if (enforceFlight.is_initialized()) + if (enforceFlight.has_value()) _enforceFlight = *enforceFlight; - if (enforceWalk.is_initialized()) + if (enforceWalk.has_value()) _enforceWalk = *enforceWalk; - if (velocity.is_initialized()) + if (velocity.has_value()) _velocity = *velocity; } @@ -122,13 +122,13 @@ void CyclicMovementGenerator::StartMovement(Creature* creature) return G3D::Vector3(node.X, node.Y, node.Z); }); - if (flying || (_enforceFlight.is_initialized() && *_enforceFlight)) + if (flying || (_enforceFlight.has_value() && *_enforceFlight)) { init.SetFly(); init.SetUncompressed(); } - if (_velocity.is_initialized()) + if (_velocity.has_value()) init.SetVelocity(*_velocity); else { @@ -137,7 +137,7 @@ void CyclicMovementGenerator::StartMovement(Creature* creature) init.SetVelocity(velocity); } - if (_enforceWalk.is_initialized()) + if (_enforceWalk.has_value()) init.SetWalk(*_enforceWalk); init.MovebyPath(path); diff --git a/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.h b/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.h index 2fe62fd561..87845d0dab 100644 --- a/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/CyclicMovementGenerator.h @@ -20,7 +20,7 @@ #include "MovementGenerator.h" #include "Timer.h" -#include "OptionalFwd.h" +#include "Optional.h" enum MovementGeneratorType : uint8; diff --git a/src/server/game/Movement/MovementGenerators/FollowMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FollowMovementGenerator.cpp index 2b0d6492bf..2930d82831 100644 --- a/src/server/game/Movement/MovementGenerators/FollowMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FollowMovementGenerator.cpp @@ -158,8 +158,8 @@ static void GetFollowOffsets(uint8 followerIndex, float& distance, float& relati FollowMovementGenerator::FollowMovementGenerator(Unit* target, Optional distance, Optional angle, bool joinFormation /*= true*/, bool catchUpToTarget /*= false*/, bool faceTarget /*= false*/) : AbstractPursuer(PursuingType::Follow, ASSERT_NOTNULL(target)), _joinFormation(joinFormation), _catchUpToTarget(catchUpToTarget), _faceTarget(faceTarget) { - _distance = distance ? distance.get() : 0.f; - _angle = angle ? angle.get() : 0.f; + _distance = distance ? distance.value() : 0.f; + _angle = angle ? angle.value() : 0.f; } FollowMovementGenerator::~FollowMovementGenerator() { } diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 8f964c16bd..e0eaf47131 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -215,7 +215,7 @@ void WaypointMovementGenerator::StartMove(Creature* creature, bool rel init.MoveTo(waypoint.X, waypoint.Y, waypoint.Z); } - if (waypoint.Orientation.is_initialized() && waypoint.Delay > 0) + if (waypoint.Orientation.has_value() && waypoint.Delay > 0) init.SetFacing(*waypoint.Orientation); switch (waypoint.MoveType) diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 848b9df49c..c235ff99eb 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -57,7 +57,7 @@ void WaypointMgr::Load() waypoint.X = x; waypoint.Y = y; waypoint.Z = z; - if (o.is_initialized()) + if (o.has_value()) waypoint.Orientation = o; waypoint.Velocity = velocity; waypoint.MoveType = fields[7].GetUInt32(); @@ -181,7 +181,7 @@ void WaypointMgr::ReloadPath(uint32 id) waypoint.X = x; waypoint.Y = y; waypoint.Z = z; - if (o.is_initialized()) + if (o.has_value()) waypoint.Orientation = o; waypoint.Velocity = velocity; waypoint.MoveType = fields[6].GetUInt32(); diff --git a/src/server/game/Server/Packets/AuthenticationPackets.cpp b/src/server/game/Server/Packets/AuthenticationPackets.cpp index 844eb5d6e5..43fa22f646 100644 --- a/src/server/game/Server/Packets/AuthenticationPackets.cpp +++ b/src/server/game/Server/Packets/AuthenticationPackets.cpp @@ -111,12 +111,12 @@ void WorldPackets::Auth::AuthSession::Read() WorldPacket const* WorldPackets::Auth::AuthResponse::Write() { - _worldPacket.WriteBit(WaitInfo.is_initialized()); + _worldPacket.WriteBit(WaitInfo.has_value()); if (WaitInfo) _worldPacket.WriteBit(WaitInfo->HasFCM); - _worldPacket.WriteBit(SuccessInfo.is_initialized()); + _worldPacket.WriteBit(SuccessInfo.has_value()); _worldPacket.FlushBits(); if (SuccessInfo) diff --git a/src/server/game/Server/Packets/CombatLogPackets.cpp b/src/server/game/Server/Packets/CombatLogPackets.cpp index b3133b2e13..51a67e127b 100644 --- a/src/server/game/Server/Packets/CombatLogPackets.cpp +++ b/src/server/game/Server/Packets/CombatLogPackets.cpp @@ -25,7 +25,7 @@ WorldPacket const* WorldPackets::CombatLog::AttackerStateUpdate::Write() _worldPacket << VictimGUID.WriteAsPacked(); _worldPacket << int32(Damage); _worldPacket << int32(OverDamage); - _worldPacket << uint8(SubDmg.is_initialized()); + _worldPacket << uint8(SubDmg.has_value()); if (SubDmg) { diff --git a/src/server/game/Server/Packets/MiscPackets.cpp b/src/server/game/Server/Packets/MiscPackets.cpp index 09a57fc599..1d6868d9bc 100644 --- a/src/server/game/Server/Packets/MiscPackets.cpp +++ b/src/server/game/Server/Packets/MiscPackets.cpp @@ -24,10 +24,10 @@ WorldPacket const* WorldPackets::Misc::SetupCurrency::Write() for (Record const& data : Data) { - _worldPacket.WriteBit(data.WeeklyQuantity.is_initialized()); + _worldPacket.WriteBit(data.WeeklyQuantity.has_value()); _worldPacket.WriteBits(data.Flags, 4); - _worldPacket.WriteBit(data.MaxWeeklyQuantity.is_initialized()); - _worldPacket.WriteBit(data.TrackedQuantity.is_initialized()); + _worldPacket.WriteBit(data.MaxWeeklyQuantity.has_value()); + _worldPacket.WriteBit(data.TrackedQuantity.has_value()); } _worldPacket.FlushBits(); @@ -36,14 +36,14 @@ WorldPacket const* WorldPackets::Misc::SetupCurrency::Write() { _worldPacket << uint32(data.Quantity); - if (data.MaxWeeklyQuantity.is_initialized()) + if (data.MaxWeeklyQuantity.has_value()) _worldPacket << uint32(*data.MaxWeeklyQuantity); - if (data.TrackedQuantity.is_initialized()) + if (data.TrackedQuantity.has_value()) _worldPacket << uint32(*data.TrackedQuantity); _worldPacket << uint32(data.Type); - if (data.WeeklyQuantity.is_initialized()) + if (data.WeeklyQuantity.has_value()) _worldPacket << uint32(*data.WeeklyQuantity); } @@ -351,9 +351,9 @@ WorldPacket const* WorldPackets::Misc::BindPointUpdate::Write() WorldPacket const* WorldPackets::Misc::WorldServerInfo::Write() { - _worldPacket.WriteBit(RestrictedAccountMaxLevel.is_initialized()); - _worldPacket.WriteBit(RestrictedAccountMaxMoney.is_initialized()); - _worldPacket.WriteBit(IneligibleForLootMask.is_initialized()); + _worldPacket.WriteBit(RestrictedAccountMaxLevel.has_value()); + _worldPacket.WriteBit(RestrictedAccountMaxMoney.has_value()); + _worldPacket.WriteBit(IneligibleForLootMask.has_value()); _worldPacket.FlushBits(); if (IneligibleForLootMask) diff --git a/src/server/game/Server/Packets/MovementPackets.cpp b/src/server/game/Server/Packets/MovementPackets.cpp index d54e322af6..6be82e97b0 100644 --- a/src/server/game/Server/Packets/MovementPackets.cpp +++ b/src/server/game/Server/Packets/MovementPackets.cpp @@ -24,8 +24,8 @@ WorldPacket const* WorldPackets::Movement::TransferPending::Write() { - _worldPacket.WriteBit(TransferSpellID.is_initialized()); - _worldPacket.WriteBit(Ship.is_initialized()); + _worldPacket.WriteBit(TransferSpellID.has_value()); + _worldPacket.WriteBit(Ship.has_value()); if (Ship) { _worldPacket << int32(Ship->OriginMapID); @@ -137,19 +137,19 @@ WorldPacket const* WorldPackets::Movement::MoveTeleport::Write() _worldPacket.WriteBit(MoverGUID[3]); _worldPacket.WriteBit(MoverGUID[2]); - _worldPacket.WriteBit(Vehicle.is_initialized()); + _worldPacket.WriteBit(Vehicle.has_value()); if (Vehicle) { _worldPacket.WriteBit(Vehicle->VehicleExitVoluntary); _worldPacket.WriteBit(Vehicle->VehicleExitTeleport); } - _worldPacket.WriteBit(TransportGUID.is_initialized()); + _worldPacket.WriteBit(TransportGUID.has_value()); _worldPacket.WriteBit(MoverGUID[1]); - if (TransportGUID.is_initialized()) + if (TransportGUID.has_value()) { - ObjectGuid transGUID = TransportGUID.get(); + ObjectGuid transGUID = TransportGUID.value(); _worldPacket.WriteBit(transGUID[1]); _worldPacket.WriteBit(transGUID[3]); _worldPacket.WriteBit(transGUID[2]); @@ -166,9 +166,9 @@ WorldPacket const* WorldPackets::Movement::MoveTeleport::Write() _worldPacket.FlushBits(); - if (TransportGUID.is_initialized()) + if (TransportGUID.has_value()) { - ObjectGuid transGUID = TransportGUID.get(); + ObjectGuid transGUID = TransportGUID.value(); _worldPacket.WriteByteSeq(transGUID[5]); _worldPacket.WriteByteSeq(transGUID[6]); _worldPacket.WriteByteSeq(transGUID[1]); @@ -399,7 +399,7 @@ void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveS if (splineFlags.animation) { - movementSpline.Animation = boost::in_place(); + movementSpline.Animation.emplace(); movementSpline.Animation->AnimTier = splineFlags.animTier; movementSpline.Animation->TierTransStartTime = moveSpline.effect_start_time; } @@ -408,7 +408,7 @@ void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveS if (splineFlags.parabolic) { - movementSpline.JumpExtraData = boost::in_place(); + movementSpline.JumpExtraData.emplace(); movementSpline.JumpExtraData->JumpGravity = moveSpline.vertical_acceleration; movementSpline.JumpExtraData->StartTime = moveSpline.effect_start_time; } diff --git a/src/server/game/Server/Packets/NPCPackets.cpp b/src/server/game/Server/Packets/NPCPackets.cpp index ecba3b0ed6..2a56cabff6 100644 --- a/src/server/game/Server/Packets/NPCPackets.cpp +++ b/src/server/game/Server/Packets/NPCPackets.cpp @@ -85,7 +85,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::NPC::VendorItem const& it data << uint32(item.Price); data << uint32(item.ItemDisplayInfoID); - if (item.PlayerConditionFailed.is_initialized()) + if (item.PlayerConditionFailed.has_value()) data << int32(*item.PlayerConditionFailed); data << int32(item.Quantity); @@ -107,8 +107,8 @@ WorldPacket const* WorldPackets::NPC::VendorInventory::Write() for (VendorItem const& item : Items) { - _worldPacket.WriteBit(!item.ExtendedCostID.is_initialized()); - _worldPacket.WriteBit(!item.PlayerConditionFailed.is_initialized()); + _worldPacket.WriteBit(!item.ExtendedCostID.has_value()); + _worldPacket.WriteBit(!item.PlayerConditionFailed.has_value()); } _worldPacket.WriteBit(Vendor[4]); diff --git a/src/server/game/Server/Packets/PartyPackets.cpp b/src/server/game/Server/Packets/PartyPackets.cpp index 8c1fac4131..632e084004 100644 --- a/src/server/game/Server/Packets/PartyPackets.cpp +++ b/src/server/game/Server/Packets/PartyPackets.cpp @@ -145,7 +145,7 @@ void WorldPackets::Party::PartyMemberState::Initialize(Player const* player) { ::Pet* pet = player->GetPet(); - MemberStats.PetStats = boost::in_place(); + MemberStats.PetStats.emplace(); MemberStats.PetStats->GUID = pet->GetGUID(); MemberStats.PetStats->Name = pet->GetName(); @@ -259,7 +259,7 @@ WorldPacket const* WorldPackets::Party::PartyMemberState::Write() _worldPacket << aura; } - if (MemberStats.PetStats.is_initialized()) + if (MemberStats.PetStats.has_value()) { if (ChangeMask & GROUP_UPDATE_FLAG_PET_GUID) _worldPacket << MemberStats.PetStats->GUID; @@ -290,10 +290,10 @@ WorldPacket const* WorldPackets::Party::PartyMemberState::Write() if (ChangeMask & GROUP_UPDATE_FLAG_PET_AURAS) { _worldPacket << uint8(_worldPacket.GetOpcode() == SMSG_PARTY_MEMBER_FULL_STATE); - _worldPacket << uint64(MemberStats.PetStats.is_initialized() ? MemberStats.PetStats->AuraMask : 0); - _worldPacket << uint32(MemberStats.PetStats.is_initialized() ? MemberStats.PetStats->Auras.size() : 0); + _worldPacket << uint64(MemberStats.PetStats.has_value() ? MemberStats.PetStats->AuraMask : 0); + _worldPacket << uint32(MemberStats.PetStats.has_value() ? MemberStats.PetStats->Auras.size() : 0); - if (MemberStats.PetStats.is_initialized()) + if (MemberStats.PetStats.has_value()) for (WorldPackets::Party::PartyMemberAuraStates const& aura : MemberStats.PetStats->Auras) _worldPacket << aura; } diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp index 1f08d9f896..c457056566 100644 --- a/src/server/game/Server/Packets/SpellPackets.cpp +++ b/src/server/game/Server/Packets/SpellPackets.cpp @@ -21,7 +21,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellHealPredicti { data << int32(predict.Points); data << uint8(predict.Type); - if (predict.BeaconGUID.is_initialized()) + if (predict.BeaconGUID.has_value()) data << predict.BeaconGUID->WriteAsPacked(); return data; } @@ -75,10 +75,10 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData c { data << uint32(spellTargetData.Flags); - if (spellTargetData.Unit.is_initialized()) + if (spellTargetData.Unit.has_value()) data << spellTargetData.Unit->WriteAsPacked(); - if (spellTargetData.Item.is_initialized()) + if (spellTargetData.Item.has_value()) data << spellTargetData.Item->WriteAsPacked(); if (spellTargetData.SrcLocation) @@ -87,7 +87,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData c if (spellTargetData.DstLocation) data << *spellTargetData.DstLocation; - if (spellTargetData.Name.is_initialized()) + if (spellTargetData.Name.has_value()) data << *spellTargetData.Name; return data; @@ -125,7 +125,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con data << spellCastData.Target; - if (spellCastData.RemainingPower.is_initialized()) + if (spellCastData.RemainingPower.has_value()) data << uint32(*spellCastData.RemainingPower); if (spellCastData.RemainingRunes) @@ -140,7 +140,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con if (spellCastData.ProjectileVisuals) data << *spellCastData.ProjectileVisuals; - if (spellCastData.DestLocSpellCastIndex.is_initialized()) + if (spellCastData.DestLocSpellCastIndex.has_value()) data << uint8(*spellCastData.DestLocSpellCastIndex); // Todo: TARGET_FLAG_EXTRA_TARGETS (unused as it seems though) @@ -188,11 +188,11 @@ WorldPacket const* WorldPackets::Spells::ChannelStart::Write() _worldPacket << uint32(SpellID); _worldPacket << int32(ChannelDuration); - _worldPacket << uint8(InterruptImmunities.is_initialized()); + _worldPacket << uint8(InterruptImmunities.has_value()); if (InterruptImmunities) _worldPacket << *InterruptImmunities; - _worldPacket << uint8(HealPrediction.is_initialized()); + _worldPacket << uint8(HealPrediction.has_value()); if (HealPrediction) _worldPacket << *HealPrediction; @@ -217,7 +217,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo cons data << uint8(auraData.Applications); if (auraData.CastUnit) - data << auraData.CastUnit.get().WriteAsPacked(); + data << auraData.CastUnit.value().WriteAsPacked(); if (auraData.Duration) data << int32(*auraData.Duration); @@ -226,7 +226,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo cons data << int32(*auraData.Remaining); for (uint8 i = 0; i < 3 /*MAX_SPELL_EFFECTS*/; ++i) - if (auraData.Points[i].is_initialized()) + if (auraData.Points[i].has_value()) data << int32(*auraData.Points[i]); return data; diff --git a/src/server/game/Server/Packets/SystemPackets.cpp b/src/server/game/Server/Packets/SystemPackets.cpp index 6be0140622..06bcf5303b 100644 --- a/src/server/game/Server/Packets/SystemPackets.cpp +++ b/src/server/game/Server/Packets/SystemPackets.cpp @@ -28,8 +28,8 @@ WorldPacket const* WorldPackets::System::FeatureSystemStatus::Write() _worldPacket.WriteBit(ItemRestorationButtonEnabled); _worldPacket.WriteBit(TravelPassEnabled); _worldPacket.WriteBit(ScrollOfResurrectionEnabled); - _worldPacket.WriteBit(EuropaTicketSystemStatus.is_initialized()); - _worldPacket.WriteBit(SessionAlert.is_initialized()); + _worldPacket.WriteBit(EuropaTicketSystemStatus.has_value()); + _worldPacket.WriteBit(SessionAlert.has_value()); _worldPacket.WriteBit(VoiceEnabled); _worldPacket.FlushBits(); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 2a815c29c7..3071014817 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -189,7 +189,7 @@ void SpellCastTargets::Write(WorldPackets::Spells::SpellTargetData& data) if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { - data.SrcLocation = boost::in_place(); + data.SrcLocation.emplace(); data.SrcLocation->Transport = m_src._transportGUID; // relative position guid here - transport for example if (!m_src._transportGUID.IsEmpty()) data.SrcLocation->Location = m_src._transportOffset; @@ -199,7 +199,7 @@ void SpellCastTargets::Write(WorldPackets::Spells::SpellTargetData& data) if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { - data.DstLocation = boost::in_place(); + data.DstLocation.emplace(); data.DstLocation->Transport = m_dst._transportGUID; // relative position guid here - transport for example if (!m_dst._transportGUID.IsEmpty()) data.DstLocation->Location = m_dst._transportOffset; @@ -4325,7 +4325,7 @@ void Spell::SendSpellStart() if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list { - castData.RemainingRunes = boost::in_place(); + castData.RemainingRunes.emplace(); //TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature //The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster @@ -4352,13 +4352,13 @@ void Spell::SendSpellStart() if (castFlags & CAST_FLAG_PROJECTILE) { - castData.Ammo = boost::in_place(); + castData.Ammo.emplace(); UpdateSpellCastDataAmmo(*castData.Ammo); } if (castFlags & CAST_FLAG_IMMUNITY) { - castData.Immunities = boost::in_place(); + castData.Immunities.emplace(); castData.Immunities->School = schoolImmunityMask; castData.Immunities->Value = mechanicImmunityMask; } @@ -4378,7 +4378,7 @@ void Spell::SendSpellStart() } } - castData.Predict = boost::in_place(); + castData.Predict.emplace(); castData.Predict->Points = amount; castData.Predict->Type = predictionType; castData.Predict->BeaconGUID = m_caster->GetGUID(); @@ -4443,13 +4443,13 @@ void Spell::SendSpellGo() castData.CastFlagsEx = m_castFlagsEx; castData.CastTime = GameTime::GetGameTimeMS(); - castData.HitInfo = boost::in_place(); + castData.HitInfo.emplace(); UpdateSpellCastDataTargets(*castData.HitInfo); m_targets.Write(castData.Target); if (castFlags & CAST_FLAG_PROJECTILE) { - castData.Ammo = boost::in_place(); + castData.Ammo.emplace(); UpdateSpellCastDataAmmo(*castData.Ammo); } @@ -4458,7 +4458,7 @@ void Spell::SendSpellGo() if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list { - castData.RemainingRunes = boost::in_place(); + castData.RemainingRunes.emplace(); /// @todo There is a crash caused by a spell with CAST_FLAG_RUNE_LIST cast by a creature //The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster @@ -4484,14 +4484,14 @@ void Spell::SendSpellGo() if (castFlags & CAST_FLAG_ADJUST_MISSILE) { - castData.MissileTrajectory = boost::in_place(); + castData.MissileTrajectory.emplace(); castData.MissileTrajectory->TravelTime = m_delayMoment; castData.MissileTrajectory->Pitch = m_targets.GetElevation(); } if (castFlags & CAST_FLAG_VISUAL_CHAIN) { - castData.ProjectileVisuals = boost::in_place(); + castData.ProjectileVisuals.emplace(); /* castData.ProjectileVisuals->Id[0] = 0; castData.ProjectileVisuals->Id[1] = 0; @@ -4845,7 +4845,7 @@ void Spell::SendChannelStart(uint32 duration) if (castFlags & CAST_FLAG_IMMUNITY) { - packet.InterruptImmunities = boost::in_place(); + packet.InterruptImmunities.emplace(); packet.InterruptImmunities->SchoolImmunities = schoolImmunityMask; // CastSchoolImmunities packet.InterruptImmunities->SchoolImmunities = mechanicImmunityMask; // CastImmunities } diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 7a87f82f06..d6fffc5866 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -109,7 +109,7 @@ public: return false; } - switch (sAccountMgr->CreateAccount(accountName, password, email.get_value_or(""))) + switch (sAccountMgr->CreateAccount(accountName, password, email.value_or(""))) { case AccountOpResult::AOR_OK: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); @@ -118,7 +118,7 @@ public: TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (GUID: %u) created Account %s (Email: '%s')", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), - accountName.c_str(), email.get_value_or("").c_str()); + accountName.c_str(), email.value_or("").c_str()); } break; case AccountOpResult::AOR_NAME_TOO_LONG: @@ -385,7 +385,7 @@ public: // This compares the old, current email to the entered email - however, only... if ((pwConfig == PW_EMAIL || (pwConfig == PW_RBAC && handler->HasPermission(rbac::RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE))) // ...if either PW_EMAIL or PW_RBAC with the Permission is active... - && !AccountMgr::CheckEmail(handler->GetSession()->GetAccountId(), confirmEmail.get_value_or(""))) // ... and returns false if the comparison fails. + && !AccountMgr::CheckEmail(handler->GetSession()->GetAccountId(), confirmEmail.value_or(""))) // ... and returns false if the comparison fails. { handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL); sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId()); @@ -393,7 +393,7 @@ public: TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the entered email [%s] is wrong.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), - confirmEmail.get_value_or("").c_str()); + confirmEmail.value_or("").c_str()); return false; } diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 5f90486938..5feed7b8bd 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -221,7 +221,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - uint32 mapId = oMapId.get_value_or(player->GetMapId()); + uint32 mapId = oMapId.value_or(player->GetMapId()); // center of grid float x = (gridX - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS; @@ -355,7 +355,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - uint32 mapId = id.get_value_or(player->GetMapId()); + uint32 mapId = id.value_or(player->GetMapId()); if (z) { if (!MapManager::IsValidMapCoord(mapId, x, y, *z)) @@ -377,7 +377,7 @@ public: z = std::max(map->GetHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y)); } - return DoTeleport(handler, { x, y, *z, o.get_value_or(0.0f) }, mapId); + return DoTeleport(handler, { x, y, *z, o.value_or(0.0f) }, mapId); } static bool HandleGoTicketCommand(ChatHandler* handler, uint32 ticketId) @@ -405,7 +405,7 @@ public: static bool HandleGoOffsetCommand(ChatHandler* handler, float dX, Optional dY, Optional dZ, Optional dO) { Position loc = handler->GetSession()->GetPlayer()->GetPosition(); - loc.RelocateOffset({ dX, dY.get_value_or(0.0f), dZ.get_value_or(0.0f), dO.get_value_or(0.0f) }); + loc.RelocateOffset({ dX, dY.value_or(0.0f), dZ.value_or(0.0f), dO.value_or(0.0f) }); return DoTeleport(handler, loc); } diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 935801c1a0..89a085f15a 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -123,7 +123,7 @@ public: void OnPlayerEnter(Player* player) override { - if (!_teamInInstance.is_initialized()) + if (!_teamInInstance.has_value()) { _teamInInstance = player->GetTeam();