diff --git a/src/server/game/BattlePets/BattlePetMgr.cpp b/src/server/game/BattlePets/BattlePetMgr.cpp index a8e730e0b6..57d8d4ea0d 100644 --- a/src/server/game/BattlePets/BattlePetMgr.cpp +++ b/src/server/game/BattlePets/BattlePetMgr.cpp @@ -492,7 +492,7 @@ void BattlePetMgr::ClearFanfare(ObjectGuid guid) pet->SaveInfo = BATTLE_PET_CHANGED; } -void BattlePetMgr::ModifyName(ObjectGuid guid, std::string const& name, DeclinedName* declinedName) +void BattlePetMgr::ModifyName(ObjectGuid guid, std::string const& name, std::unique_ptr declinedName) { if (!HasJournalLock()) return; @@ -504,9 +504,7 @@ void BattlePetMgr::ModifyName(ObjectGuid guid, std::string const& name, Declined pet->PacketInfo.Name = name; pet->NameTimestamp = GameTime::GetGameTime(); - pet->DeclinedName.reset(); - if (declinedName) - pet->DeclinedName = std::make_unique(*declinedName); + pet->DeclinedName = std::move(declinedName); if (pet->SaveInfo != BATTLE_PET_NEW) pet->SaveInfo = BATTLE_PET_CHANGED; diff --git a/src/server/game/BattlePets/BattlePetMgr.h b/src/server/game/BattlePets/BattlePetMgr.h index 771b016d81..d6c0ca40e0 100644 --- a/src/server/game/BattlePets/BattlePetMgr.h +++ b/src/server/game/BattlePets/BattlePetMgr.h @@ -162,7 +162,7 @@ public: void AddPet(uint32 species, uint32 display, uint16 breed, BattlePetBreedQuality quality, uint16 level = 1); void RemovePet(ObjectGuid guid); void ClearFanfare(ObjectGuid guid); - void ModifyName(ObjectGuid guid, std::string const& name, DeclinedName* declinedName); + void ModifyName(ObjectGuid guid, std::string const& name, std::unique_ptr declinedName); bool IsPetInSlot(ObjectGuid guid); uint8 GetPetCount(BattlePetSpeciesEntry const* battlePetSpecies, ObjectGuid ownerGuid) const; diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index 5190b4372d..ec3370a67a 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -101,7 +101,7 @@ void Arena::BuildPvPLogDataPacket(WorldPackets::Battleground::PVPMatchStatistics if (isRated()) { - pvpLogData.Ratings = boost::in_place(); + pvpLogData.Ratings.emplace(); for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i) { diff --git a/src/server/game/Battlegrounds/BattlegroundScore.cpp b/src/server/game/Battlegrounds/BattlegroundScore.cpp index d030e2f6e9..ce8ad1015d 100644 --- a/src/server/game/Battlegrounds/BattlegroundScore.cpp +++ b/src/server/game/Battlegrounds/BattlegroundScore.cpp @@ -63,7 +63,7 @@ void BattlegroundScore::BuildPvPLogPlayerDataPacket(WorldPackets::Battleground:: playerData.Faction = TeamId; if (HonorableKills || Deaths || BonusHonor) { - playerData.Honor = boost::in_place(); + playerData.Honor.emplace(); playerData.Honor->HonorKills = HonorableKills; playerData.Honor->Deaths = Deaths; playerData.Honor->ContributionPoints = BonusHonor; diff --git a/src/server/game/BlackMarket/BlackMarketMgr.cpp b/src/server/game/BlackMarket/BlackMarketMgr.cpp index ab092f2ae7..a0a595c361 100644 --- a/src/server/game/BlackMarket/BlackMarketMgr.cpp +++ b/src/server/game/BlackMarket/BlackMarketMgr.cpp @@ -375,7 +375,7 @@ bool BlackMarketTemplate::LoadFromDB(Field* fields) if (!bonusListIDs.empty()) { - Item.ItemBonus = boost::in_place(); + Item.ItemBonus.emplace(); Item.ItemBonus->BonusListIDs = bonusListIDs; } diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 6fe0243d66..ffc1e16751 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -777,7 +777,7 @@ void AreaTrigger::InitSplines(std::vector splinePoints, uint32 tim WorldPackets::AreaTrigger::AreaTriggerRePath reshape; reshape.TriggerGUID = GetGUID(); - reshape.AreaTriggerSpline = boost::in_place(); + reshape.AreaTriggerSpline.emplace(); reshape.AreaTriggerSpline->ElapsedTimeForMovement = GetElapsedTimeForMovement(); reshape.AreaTriggerSpline->TimeToTarget = timeToTarget; for (G3D::Vector3 const& vec : splinePoints) @@ -797,7 +797,7 @@ bool AreaTrigger::HasSplines() const void AreaTrigger::InitOrbit(AreaTriggerOrbitInfo const& orbit, uint32 timeToTarget) { // Circular movement requires either a center position or an attached unit - ASSERT(orbit.Center.is_initialized() || orbit.PathTarget.is_initialized()); + ASSERT(orbit.Center.has_value() || orbit.PathTarget.has_value()); // should be sent in object create packets only DoWithSuppressingObjectUpdates([&]() @@ -823,19 +823,19 @@ void AreaTrigger::InitOrbit(AreaTriggerOrbitInfo const& orbit, uint32 timeToTarg bool AreaTrigger::HasOrbit() const { - return _orbitInfo.is_initialized(); + return _orbitInfo.has_value(); } Position const* AreaTrigger::GetOrbitCenterPosition() const { - if (!_orbitInfo.is_initialized()) + if (!_orbitInfo) return nullptr; - if (_orbitInfo->PathTarget.is_initialized()) + if (_orbitInfo->PathTarget) if (WorldObject* center = ObjectAccessor::GetWorldObject(*this, *_orbitInfo->PathTarget)) return center; - if (_orbitInfo->Center.is_initialized()) + if (_orbitInfo->Center) return &_orbitInfo->Center->Pos; return nullptr; diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 683114e3f8..83725a16a7 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -316,7 +316,7 @@ void ItemAdditionalLoadInfo::Init(std::unordered_mapFetch(); ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()]; if (!info.Artifact) - info.Artifact = boost::in_place(); + info.Artifact.emplace(); info.Artifact->Xp = fields[1].GetUInt64(); info.Artifact->ArtifactAppearanceId = fields[2].GetUInt32(); info.Artifact->ArtifactTierId = fields[3].GetUInt32(); @@ -359,7 +359,7 @@ void ItemAdditionalLoadInfo::Init(std::unordered_mapFetch(); ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()]; if (!info.AzeriteItem) - info.AzeriteItem = boost::in_place(); + info.AzeriteItem.emplace(); info.AzeriteItem->Xp = fields[1].GetUInt64(); info.AzeriteItem->Level = fields[2].GetUInt32(); info.AzeriteItem->KnowledgeLevel = fields[3].GetUInt32(); @@ -392,7 +392,7 @@ void ItemAdditionalLoadInfo::Init(std::unordered_mapFetch(); ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()]; if (!info.AzeriteItem) - info.AzeriteItem = boost::in_place(); + info.AzeriteItem.emplace(); info.AzeriteItem->AzeriteItemMilestonePowers.push_back(fields[1].GetUInt32()); } while (azeriteItemMilestonePowersResult->NextRow()); @@ -409,7 +409,7 @@ void ItemAdditionalLoadInfo::Init(std::unordered_mapUnlockedAzeriteEssences.push_back(azeriteEssencePower); } @@ -426,7 +426,7 @@ void ItemAdditionalLoadInfo::Init(std::unordered_mapFetch(); ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()]; if (!info.AzeriteEmpoweredItem) - info.AzeriteEmpoweredItem = boost::in_place(); + info.AzeriteEmpoweredItem.emplace(); for (uint32 i = 0; i < MAX_AZERITE_EMPOWERED_TIER; ++i) if (sAzeritePowerStore.LookupEntry(fields[1 + i].GetInt32())) diff --git a/src/server/game/Entities/Object/Updates/UpdateField.h b/src/server/game/Entities/Object/Updates/UpdateField.h index e012955648..edb07858d3 100644 --- a/src/server/game/Entities/Object/Updates/UpdateField.h +++ b/src/server/game/Entities/Object/Updates/UpdateField.h @@ -238,7 +238,7 @@ namespace UF private: void RemoveValue() { - if (_field.is_initialized()) + if (_field.has_value()) _field.DestroyValue(); } @@ -329,7 +329,7 @@ namespace UF std::conditional_t, UpdateFieldSetter>>>> ModifyValue(OptionalUpdateField(T::* field), uint32 /*dummy*/) { - if (!(_value.*field).is_initialized()) + if (!(_value.*field).has_value()) (_value.*field).ConstructValue(); _value._changesMask.Set(BlockBit); @@ -433,7 +433,7 @@ namespace UF std::conditional_t, UpdateFieldSetter>>>> ModifyValue(uint32 /*dummy*/) { - if (!_value.is_initialized()) + if (!_value.has_value()) _value.ConstructValue(); return { *(_value._value) }; @@ -639,7 +639,7 @@ namespace UF template void ClearChangesMask(OptionalUpdateField& field, std::true_type) { - if (field.is_initialized()) + if (field.has_value()) field._value->ClearChangesMask(); } @@ -905,7 +905,7 @@ namespace UF DestroyValue(); } - bool is_initialized() const + bool has_value() const { return !!_value; } diff --git a/src/server/game/Entities/Object/Updates/UpdateFields.cpp b/src/server/game/Entities/Object/Updates/UpdateFields.cpp index bbff91bd71..230216889a 100644 --- a/src/server/game/Entities/Object/Updates/UpdateFields.cpp +++ b/src/server/game/Entities/Object/Updates/UpdateFields.cpp @@ -3181,9 +3181,9 @@ void ActivePlayerData::WriteCreate(ByteBuffer& data, EnumFlag f data.WriteBit(BankAutoSortDisabled); data.WriteBit(SortBagsRightToLeft); data.WriteBit(InsertItemsLeftToRight); - data.WriteBits(QuestSession.is_initialized(), 1); + data.WriteBits(QuestSession.has_value(), 1); Field_1410->WriteCreate(data, owner, receiver); - if (QuestSession.is_initialized()) + if (QuestSession.has_value()) { QuestSession->WriteCreate(data, owner, receiver); } @@ -3949,14 +3949,14 @@ void ActivePlayerData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bo } if (changesMask[98]) { - data.WriteBits(QuestSession.is_initialized(), 1); + data.WriteBits(QuestSession.has_value(), 1); if (changesMask[106]) { Field_1410->WriteUpdate(data, ignoreNestedChangesMask, owner, receiver); } if (changesMask[105]) { - if (QuestSession.is_initialized()) + if (QuestSession.has_value()) { QuestSession->WriteUpdate(data, ignoreNestedChangesMask, owner, receiver); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 37fa5a0109..c187baebbb 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -438,7 +438,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac return false; } - PlayerInfo::CreatePosition const& position = createInfo->UseNPE && info->createPositionNPE ? info->createPositionNPE.get() : info->createPosition; + PlayerInfo::CreatePosition const& position = createInfo->UseNPE && info->createPositionNPE ? *info->createPositionNPE : info->createPosition; m_createTime = GameTime::GetGameTime(); m_createMode = createInfo->UseNPE && info->createPositionNPE ? PlayerCreateMode::NPE : PlayerCreateMode::Normal; @@ -1513,7 +1513,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati transferPending.OldMapPosition = GetPosition(); if (Transport* transport = GetTransport()) { - transferPending.Ship = boost::in_place(); + transferPending.Ship.emplace(); transferPending.Ship->ID = transport->GetEntry(); transferPending.Ship->OriginMapID = GetMapId(); } @@ -20382,7 +20382,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) if (!ok && HasAtLoginFlag(AT_LOGIN_FIRST)) { - PlayerInfo::CreatePosition const& createPosition = m_createMode == PlayerCreateMode::NPE && info->createPositionNPE ? info->createPositionNPE.get() : info->createPosition; + PlayerInfo::CreatePosition const& createPosition = m_createMode == PlayerCreateMode::NPE && info->createPositionNPE ? *info->createPositionNPE : info->createPosition; m_homebind.WorldRelocate(createPosition.Loc); if (createPosition.TransportGuid) @@ -28007,7 +28007,7 @@ void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, itemPurchaseRefundResult.Result = error; if (!error) { - itemPurchaseRefundResult.Contents = boost::in_place(); + itemPurchaseRefundResult.Contents.emplace(); itemPurchaseRefundResult.Contents->Money = item->GetPaidMoney(); for (uint8 i = 0; i < MAX_ITEM_EXT_COST_ITEMS; ++i) // item cost data { @@ -28404,7 +28404,7 @@ void Player::SendPlayerChoice(ObjectGuid sender, int32 choiceId) if (playerChoiceResponseTemplate.Reward) { - playerChoiceResponse.Reward = boost::in_place(); + playerChoiceResponse.Reward.emplace(); playerChoiceResponse.Reward->TitleID = playerChoiceResponseTemplate.Reward->TitleId; playerChoiceResponse.Reward->PackageID = playerChoiceResponseTemplate.Reward->PackageId; playerChoiceResponse.Reward->SkillLineID = playerChoiceResponseTemplate.Reward->SkillLineId; @@ -28421,7 +28421,7 @@ void Player::SendPlayerChoice(ObjectGuid sender, int32 choiceId) rewardEntry.Quantity = item.Quantity; if (!item.BonusListIDs.empty()) { - rewardEntry.Item.ItemBonus = boost::in_place(); + rewardEntry.Item.ItemBonus.emplace(); rewardEntry.Item.ItemBonus->BonusListIDs = item.BonusListIDs; } } @@ -28447,7 +28447,7 @@ void Player::SendPlayerChoice(ObjectGuid sender, int32 choiceId) rewardEntry.Quantity = item.Quantity; if (!item.BonusListIDs.empty()) { - rewardEntry.Item.ItemBonus = boost::in_place(); + rewardEntry.Item.ItemBonus.emplace(); rewardEntry.Item.ItemBonus->BonusListIDs = item.BonusListIDs; } } @@ -28457,8 +28457,7 @@ void Player::SendPlayerChoice(ObjectGuid sender, int32 choiceId) if (playerChoiceResponseTemplate.MawPower) { - playerChoiceResponse.MawPower.emplace(); - WorldPackets::Quest::PlayerChoiceResponseMawPower& mawPower = playerChoiceResponse.MawPower.get(); + WorldPackets::Quest::PlayerChoiceResponseMawPower& mawPower = playerChoiceResponse.MawPower.emplace(); mawPower.TypeArtFileID = playerChoiceResponse.MawPower->TypeArtFileID; mawPower.Rarity = playerChoiceResponse.MawPower->Rarity; mawPower.RarityColor = playerChoiceResponse.MawPower->RarityColor; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a88ee60ea8..583edc5801 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5249,7 +5249,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 @@ -12271,7 +12271,7 @@ void Unit::SendClearTarget() int32 Unit::GetResistance(SpellSchoolMask mask) const { - Optional resist = boost::make_optional(false, 0); + Optional resist; for (int32 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) { int32 schoolResistance = GetResistance(SpellSchools(i)); @@ -12279,7 +12279,7 @@ int32 Unit::GetResistance(SpellSchoolMask mask) const resist = schoolResistance; } - return resist ? *resist : 0; + return resist.value_or(0); } void CharmInfo::SetIsCommandAttack(bool val) diff --git a/src/server/game/Garrison/Garrison.cpp b/src/server/game/Garrison/Garrison.cpp index 96b41bbb9a..6f0ee01d92 100644 --- a/src/server/game/Garrison/Garrison.cpp +++ b/src/server/game/Garrison/Garrison.cpp @@ -77,7 +77,7 @@ bool Garrison::LoadFromDB(PreparedQueryResult garrison, PreparedQueryResult blue if (!sGarrBuildingStore.LookupEntry(buildingId)) continue; - plot->BuildingInfo.PacketInfo = boost::in_place(); + plot->BuildingInfo.PacketInfo.emplace(); plot->BuildingInfo.PacketInfo->GarrPlotInstanceID = plotInstanceId; plot->BuildingInfo.PacketInfo->GarrBuildingID = buildingId; plot->BuildingInfo.PacketInfo->TimeBuilt = timeBuilt; @@ -558,7 +558,7 @@ void Garrison::SendInfo() Plot& plot = p.second; garrison.Plots.push_back(&plot.PacketInfo); if (plot.BuildingInfo.PacketInfo) - garrison.Buildings.push_back(plot.BuildingInfo.PacketInfo.get_ptr()); + garrison.Buildings.push_back(&*plot.BuildingInfo.PacketInfo); } for (auto const& p : _followers) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 51be3ecef7..6c0684f5c7 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -10922,9 +10922,7 @@ void ObjectMgr::LoadPlayerChoices() continue; } - responseItr->Reward = boost::in_place(); - - PlayerChoiceResponseReward* reward = responseItr->Reward.get_ptr(); + PlayerChoiceResponseReward* reward = &responseItr->Reward.emplace(); reward->TitleId = fields[2].GetInt32(); reward->PackageId = fields[3].GetInt32(); reward->SkillLineId = fields[4].GetInt32(); @@ -11178,8 +11176,7 @@ void ObjectMgr::LoadPlayerChoices() continue; } - responseItr->MawPower.emplace(); - PlayerChoiceResponseMawPower& mawPower = responseItr->MawPower.get(); + PlayerChoiceResponseMawPower& mawPower = responseItr->MawPower.emplace(); mawPower.TypeArtFileID = fields[2].GetInt32(); mawPower.Rarity = fields[3].GetInt32(); mawPower.RarityColor = fields[4].GetUInt32(); diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index 9d2f16e13b..666dd0037f 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -132,7 +132,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord& cell, GridRefManager& T* obj = new T; //TC_LOG_INFO("misc", "DEBUG: LoadHelper from table: %s for (guid: " UI64FMTD ") Loading", table, guid); - if (!obj->LoadFromDB(guid, map, false, phaseOwner.is_initialized() /*allowDuplicate*/)) + if (!obj->LoadFromDB(guid, map, false, phaseOwner.has_value() /*allowDuplicate*/)) { delete obj; continue; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 037a5b546c..2d36030222 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -1564,13 +1564,13 @@ void Group::SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot) if (GetMembersCount() > 1) { // LootSettings - partyUpdate.LootSettings = boost::in_place(); + partyUpdate.LootSettings.emplace(); partyUpdate.LootSettings->Method = m_lootMethod; partyUpdate.LootSettings->Threshold = m_lootThreshold; partyUpdate.LootSettings->LootMaster = m_lootMethod == MASTER_LOOT ? m_masterLooterGuid : ObjectGuid::Empty; // Difficulty Settings - partyUpdate.DifficultySettings = boost::in_place(); + partyUpdate.DifficultySettings.emplace(); partyUpdate.DifficultySettings->DungeonDifficultyID = m_dungeonDifficulty; partyUpdate.DifficultySettings->RaidDifficultyID = m_raidDifficulty; partyUpdate.DifficultySettings->LegacyRaidDifficultyID = m_legacyRaidDifficulty; @@ -1579,7 +1579,7 @@ void Group::SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot) // LfgInfos if (isLFGGroup()) { - partyUpdate.LfgInfos = boost::in_place(); + partyUpdate.LfgInfos.emplace(); partyUpdate.LfgInfos->Slot = sLFGMgr->GetLFGDungeonEntry(sLFGMgr->GetDungeon(m_guid)); partyUpdate.LfgInfos->BootCount = 0; diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 0ee48109d8..dcd5ef7f2c 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -1374,7 +1374,7 @@ void Guild::SendQueryResponse(WorldSession* session, ObjectGuid const& playerGui WorldPackets::Guild::QueryGuildInfoResponse response; response.GuildGuid = GetGUID(); response.PlayerGuid = playerGuid; - response.Info = boost::in_place(); + response.Info.emplace(); response.Info->GuildGUID = GetGUID(); response.Info->VirtualRealmAddress = GetVirtualRealmAddress(); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index ce7995540d..e5d0c4b51a 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -36,7 +36,7 @@ void WorldSession::HandleAuctionBrowseQuery(WorldPackets::AuctionHouse::AuctionBrowseQuery& browseQuery) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, browseQuery.TaintedBy.is_initialized()); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, browseQuery.TaintedBy.has_value()); if (throttle.Throttled) return; @@ -65,7 +65,7 @@ void WorldSession::HandleAuctionBrowseQuery(WorldPackets::AuctionHouse::AuctionB WorldPackets::AuctionHouse::AuctionListBucketsResult listBucketsResult; if (!browseQuery.ItemClassFilters.empty()) { - classFilters = boost::in_place(); + classFilters.emplace(); for (auto const& classFilter : browseQuery.ItemClassFilters) { @@ -98,7 +98,7 @@ void WorldSession::HandleAuctionBrowseQuery(WorldPackets::AuctionHouse::AuctionB void WorldSession::HandleAuctionCancelCommoditiesPurchase(WorldPackets::AuctionHouse::AuctionCancelCommoditiesPurchase& cancelCommoditiesPurchase) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, cancelCommoditiesPurchase.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, cancelCommoditiesPurchase.TaintedBy.has_value(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; @@ -120,7 +120,7 @@ void WorldSession::HandleAuctionCancelCommoditiesPurchase(WorldPackets::AuctionH void WorldSession::HandleAuctionConfirmCommoditiesPurchase(WorldPackets::AuctionHouse::AuctionConfirmCommoditiesPurchase& confirmCommoditiesPurchase) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, confirmCommoditiesPurchase.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, confirmCommoditiesPurchase.TaintedBy.has_value(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; @@ -158,7 +158,7 @@ void WorldSession::HandleAuctionConfirmCommoditiesPurchase(WorldPackets::Auction void WorldSession::HandleAuctionGetCommodityQuote(WorldPackets::AuctionHouse::AuctionGetCommodityQuote& getCommodityQuote) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, getCommodityQuote.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, getCommodityQuote.TaintedBy.has_value(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; @@ -209,7 +209,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPackets::AuctionHouse::AuctionH void WorldSession::HandleAuctionListBiddedItems(WorldPackets::AuctionHouse::AuctionListBiddedItems& listBiddedItems) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listBiddedItems.TaintedBy.is_initialized()); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listBiddedItems.TaintedBy.has_value()); if (throttle.Throttled) return; @@ -236,7 +236,7 @@ void WorldSession::HandleAuctionListBiddedItems(WorldPackets::AuctionHouse::Auct void WorldSession::HandleAuctionListBucketsByBucketKeys(WorldPackets::AuctionHouse::AuctionListBucketsByBucketKeys& listBucketsByBucketKeys) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listBucketsByBucketKeys.TaintedBy.is_initialized()); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listBucketsByBucketKeys.TaintedBy.has_value()); if (throttle.Throttled) return; @@ -267,7 +267,7 @@ void WorldSession::HandleAuctionListBucketsByBucketKeys(WorldPackets::AuctionHou void WorldSession::HandleAuctionListItemsByBucketKey(WorldPackets::AuctionHouse::AuctionListItemsByBucketKey& listItemsByBucketKey) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listItemsByBucketKey.TaintedBy.is_initialized()); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listItemsByBucketKey.TaintedBy.has_value()); if (throttle.Throttled) return; @@ -298,7 +298,7 @@ void WorldSession::HandleAuctionListItemsByBucketKey(WorldPackets::AuctionHouse: void WorldSession::HandleAuctionListItemsByItemID(WorldPackets::AuctionHouse::AuctionListItemsByItemID& listItemsByItemID) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listItemsByItemID.TaintedBy.is_initialized()); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listItemsByItemID.TaintedBy.has_value()); if (throttle.Throttled) return; @@ -330,7 +330,7 @@ void WorldSession::HandleAuctionListItemsByItemID(WorldPackets::AuctionHouse::Au //this void sends player info about his auctions void WorldSession::HandleAuctionListOwnedItems(WorldPackets::AuctionHouse::AuctionListOwnedItems& listOwnedItems) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listOwnedItems.TaintedBy.is_initialized()); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listOwnedItems.TaintedBy.has_value()); if (throttle.Throttled) return; @@ -357,7 +357,7 @@ void WorldSession::HandleAuctionListOwnedItems(WorldPackets::AuctionHouse::Aucti // this function is called when client bids or buys out auction void WorldSession::HandleAuctionPlaceBid(WorldPackets::AuctionHouse::AuctionPlaceBid& placeBid) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, placeBid.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, placeBid.TaintedBy.has_value(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; @@ -486,7 +486,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPackets::AuctionHouse::AuctionPlac void WorldSession::HandleAuctionRemoveItem(WorldPackets::AuctionHouse::AuctionRemoveItem& removeItem) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, removeItem.TaintedBy.is_initialized(), AuctionCommand::Cancel); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, removeItem.TaintedBy.has_value(), AuctionCommand::Cancel); if (throttle.Throttled) return; @@ -577,7 +577,7 @@ void WorldSession::HandleAuctionReplicateItems(WorldPackets::AuctionHouse::Aucti void WorldSession::HandleAuctionSellCommodity(WorldPackets::AuctionHouse::AuctionSellCommodity& sellCommodity) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, sellCommodity.TaintedBy.is_initialized(), AuctionCommand::SellItem); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, sellCommodity.TaintedBy.has_value(), AuctionCommand::SellItem); if (throttle.Throttled) return; @@ -789,7 +789,7 @@ void WorldSession::HandleAuctionSellCommodity(WorldPackets::AuctionHouse::Auctio void WorldSession::HandleAuctionSellItem(WorldPackets::AuctionHouse::AuctionSellItem& sellItem) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, sellItem.TaintedBy.is_initialized(), AuctionCommand::SellItem); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, sellItem.TaintedBy.has_value(), AuctionCommand::SellItem); if (throttle.Throttled) return; diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp index 0166ae3201..1d0bd5b404 100644 --- a/src/server/game/Handlers/AuthHandler.cpp +++ b/src/server/game/Handlers/AuthHandler.cpp @@ -35,7 +35,7 @@ void WorldSession::SendAuthResponse(uint32 code, bool queued, uint32 queuePos) if (code == ERROR_OK) { - response.SuccessInfo = boost::in_place(); + response.SuccessInfo.emplace(); response.SuccessInfo->ActiveExpansionLevel = GetExpansion(); response.SuccessInfo->AccountExpansionLevel = GetAccountExpansion(); @@ -58,7 +58,7 @@ void WorldSession::SendAuthResponse(uint32 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/BattlePetHandler.cpp b/src/server/game/Handlers/BattlePetHandler.cpp index 144612bfeb..b4faa5912d 100644 --- a/src/server/game/Handlers/BattlePetHandler.cpp +++ b/src/server/game/Handlers/BattlePetHandler.cpp @@ -44,7 +44,7 @@ void WorldSession::HandleBattlePetSetBattleSlot(WorldPackets::BattlePet::BattleP void WorldSession::HandleBattlePetModifyName(WorldPackets::BattlePet::BattlePetModifyName& battlePetModifyName) { - GetBattlePetMgr()->ModifyName(battlePetModifyName.PetGuid, battlePetModifyName.Name, battlePetModifyName.DeclinedNames.get_ptr()); + GetBattlePetMgr()->ModifyName(battlePetModifyName.PetGuid, battlePetModifyName.Name, std::move(battlePetModifyName.DeclinedNames)); } void WorldSession::HandleQueryBattlePetName(WorldPackets::BattlePet::QueryBattlePetName& queryBattlePetName) diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index fb612057e9..b1359f1f06 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1130,7 +1130,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) { case PlayerCreateMode::Normal: if (playerInfo->introMovieId) - pCurrChar->SendMovieStart(playerInfo->introMovieId.get()); + pCurrChar->SendMovieStart(*playerInfo->introMovieId); else if (playerInfo->introSceneId) pCurrChar->GetSceneMgr().PlayScene(*playerInfo->introSceneId); else if (sChrClassesStore.AssertEntry(pCurrChar->GetClass())->CinematicSequenceID) @@ -1418,7 +1418,7 @@ void WorldSession::SendFeatureSystemStatus() features.VoiceEnabled = false; features.BrowserEnabled = false; // Has to be false, otherwise client will crash if "Customer Support" is opened - features.EuropaTicketSystemStatus = boost::in_place(); + features.EuropaTicketSystemStatus.emplace(); features.EuropaTicketSystemStatus->ThrottleState.MaxTries = 10; features.EuropaTicketSystemStatus->ThrottleState.PerMilliseconds = 60000; features.EuropaTicketSystemStatus->ThrottleState.TryCount = 1; @@ -2768,7 +2768,7 @@ void WorldSession::SendCharFactionChange(ResponseCodes result, WorldPackets::Cha if (result == RESPONSE_SUCCESS) { - packet.Display = boost::in_place(); + packet.Display.emplace(); packet.Display->Name = factionChangeInfo->Name; packet.Display->SexID = factionChangeInfo->SexID; packet.Display->Customizations = &factionChangeInfo->Customizations; diff --git a/src/server/game/Handlers/InspectHandler.cpp b/src/server/game/Handlers/InspectHandler.cpp index 90f4681bf2..f57d5128f1 100644 --- a/src/server/game/Handlers/InspectHandler.cpp +++ b/src/server/game/Handlers/InspectHandler.cpp @@ -59,7 +59,7 @@ void WorldSession::HandleInspectOpcode(WorldPackets::Inspect::Inspect& inspect) if (Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId())) { - inspectResult.GuildData = boost::in_place(); + inspectResult.GuildData.emplace(); inspectResult.GuildData->GuildGUID = guild->GetGUID(); inspectResult.GuildData->NumGuildMembers = guild->GetMembersCount(); inspectResult.GuildData->AchievementPoints = guild->GetAchievementMgr().GetAchievementPoints(); diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 7f6fcdb73e..e5bfee4e11 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -679,7 +679,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid) item.Item.ItemID = vendorItem->item; if (!vendorItem->BonusListIDs.empty()) { - item.Item.ItemBonus = boost::in_place(); + item.Item.ItemBonus.emplace(); item.Item.ItemBonus->BonusListIDs = vendorItem->BonusListIDs; } } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index df0765e506..95cde9901d 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -530,7 +530,7 @@ void WorldSession::HandlePetRename(WorldPackets::Pet::PetRename& packet) ObjectGuid petguid = packet.RenameData.PetGUID; std::string name = packet.RenameData.NewName; - DeclinedName* declinedname = packet.RenameData.DeclinedNames.get_ptr(); + Optional const& declinedname = packet.RenameData.DeclinedNames; Pet* pet = ObjectAccessor::GetPet(*_player, petguid); // check it! @@ -542,13 +542,13 @@ void WorldSession::HandlePetRename(WorldPackets::Pet::PetRename& packet) PetNameInvalidReason res = ObjectMgr::CheckPetName(name); if (res != PET_NAME_SUCCESS) { - SendPetNameInvalid(res, name, nullptr); + SendPetNameInvalid(res, name, {}); return; } if (sObjectMgr->IsReservedName(name)) { - SendPetNameInvalid(PET_NAME_RESERVED, name, nullptr); + SendPetNameInvalid(PET_NAME_RESERVED, name, {}); return; } @@ -751,13 +751,12 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPackets::Spells::PetCastSpell& } } -void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName) +void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Optional const& declinedName) { WorldPackets::Pet::PetNameInvalid petNameInvalid; petNameInvalid.Result = error; petNameInvalid.RenameData.NewName = name; - if (declinedName) - petNameInvalid.RenameData.DeclinedNames = *declinedName; + petNameInvalid.RenameData.DeclinedNames = declinedName; SendPacket(petNameInvalid.Write()); } diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index ca4efad8e7..45569e8ad2 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -103,7 +103,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) TC_LOG_DEBUG("network", "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ", curloc); WorldPackets::Taxi::ShowTaxiNodes data; - data.WindowInfo = boost::in_place(); + data.WindowInfo.emplace(); data.WindowInfo->UnitGUID = unit->GetGUID(); data.WindowInfo->CurrentNode = curloc; diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index e06d465e23..ca4272b6ad 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -63,14 +63,14 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/) { if (Item* item = view_trade->GetItem(TradeSlots(i))) { - WorldPackets::Trade::TradeUpdated::TradeItem tradeItem; + WorldPackets::Trade::TradeItem tradeItem; tradeItem.Slot = i; tradeItem.Item.Initialize(item); tradeItem.StackCount = item->GetCount(); tradeItem.GiftCreator = item->GetGiftCreator(); if (!item->IsWrapped()) { - tradeItem.Unwrapped = boost::in_place(); + tradeItem.Unwrapped.emplace(); tradeItem.Unwrapped->EnchantID = item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT); tradeItem.Unwrapped->OnUseEnchantmentID = item->GetEnchantmentId(USE_ENCHANTMENT_SLOT); diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index 494e1aaa8e..3f93bf084f 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -31,12 +31,15 @@ template PointMovementGenerator::PointMovementGenerator(uint32 id, float x, float y, float z, bool generatePath, float speed /*= 0.0f*/, Optional finalOrient /*= {}*/, Unit const* faceTarget /*= nullptr*/, Movement::SpellEffectExtraData const* spellEffectExtraData /*= nullptr*/) : _movementId(id), _destination(x, y, z), _speed(speed), _generatePath(generatePath), _finalOrient(finalOrient), - i_faceTarget(faceTarget), i_spellEffectExtra(spellEffectExtraData) + i_faceTarget(faceTarget) { this->Mode = MOTION_MODE_DEFAULT; this->Priority = MOTION_PRIORITY_NORMAL; this->Flags = MOVEMENTGENERATOR_FLAG_INITIALIZATION_PENDING; this->BaseUnitState = UNIT_STATE_ROAMING; + + if (spellEffectExtraData) + this->i_spellEffectExtra = std::make_unique(*spellEffectExtraData); } template diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index 4a2f1a2631..925e0ee592 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h @@ -57,7 +57,7 @@ class PointMovementGenerator : public MovementGeneratorMedium _finalOrient; Unit const* i_faceTarget; - Movement::SpellEffectExtraData const* i_spellEffectExtra; + std::unique_ptr i_spellEffectExtra; }; class AssistanceMovementGenerator : public PointMovementGenerator diff --git a/src/server/game/Server/Packets/AchievementPackets.cpp b/src/server/game/Server/Packets/AchievementPackets.cpp index 0ff94bd5bc..cd973e958d 100644 --- a/src/server/game/Server/Packets/AchievementPackets.cpp +++ b/src/server/game/Server/Packets/AchievementPackets.cpp @@ -36,7 +36,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Achievement::CriteriaProg data << criteria.TimeFromStart; data << criteria.TimeFromCreate; data.WriteBits(criteria.Flags, 4); - data.WriteBit(criteria.RafAcceptanceID.is_initialized()); + data.WriteBit(criteria.RafAcceptanceID.has_value()); data.FlushBits(); if (criteria.RafAcceptanceID) @@ -92,7 +92,7 @@ WorldPacket const* WorldPackets::Achievement::CriteriaUpdate::Write() _worldPacket.AppendPackedTime(CurrentTime); _worldPacket << ElapsedTime; _worldPacket << CreationTime; - _worldPacket.WriteBit(RafAcceptanceID.is_initialized()); + _worldPacket.WriteBit(RafAcceptanceID.has_value()); _worldPacket.FlushBits(); if (RafAcceptanceID) diff --git a/src/server/game/Server/Packets/AreaTriggerPackets.cpp b/src/server/game/Server/Packets/AreaTriggerPackets.cpp index d293c2beab..69db66ce94 100644 --- a/src/server/game/Server/Packets/AreaTriggerPackets.cpp +++ b/src/server/game/Server/Packets/AreaTriggerPackets.cpp @@ -33,8 +33,8 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::AreaTrigger::AreaTriggerS ByteBuffer& operator<<(ByteBuffer& data, AreaTriggerOrbitInfo const& areaTriggerCircularMovement) { - data.WriteBit(areaTriggerCircularMovement.PathTarget.is_initialized()); - data.WriteBit(areaTriggerCircularMovement.Center.is_initialized()); + data.WriteBit(areaTriggerCircularMovement.PathTarget.has_value()); + data.WriteBit(areaTriggerCircularMovement.Center.has_value()); data.WriteBit(areaTriggerCircularMovement.CounterClockwise); data.WriteBit(areaTriggerCircularMovement.CanLoop); @@ -83,9 +83,9 @@ WorldPacket const* WorldPackets::AreaTrigger::AreaTriggerRePath::Write() { _worldPacket << TriggerGUID; - _worldPacket.WriteBit(AreaTriggerSpline.is_initialized()); - _worldPacket.WriteBit(AreaTriggerOrbit.is_initialized()); - _worldPacket.WriteBit(AreaTriggerMovementScript.is_initialized()); + _worldPacket.WriteBit(AreaTriggerSpline.has_value()); + _worldPacket.WriteBit(AreaTriggerOrbit.has_value()); + _worldPacket.WriteBit(AreaTriggerMovementScript.has_value()); _worldPacket.FlushBits(); if (AreaTriggerSpline) diff --git a/src/server/game/Server/Packets/AuctionHousePackets.cpp b/src/server/game/Server/Packets/AuctionHousePackets.cpp index a9d9ad0daf..2ac97d8dd5 100644 --- a/src/server/game/Server/Packets/AuctionHousePackets.cpp +++ b/src/server/game/Server/Packets/AuctionHousePackets.cpp @@ -63,9 +63,9 @@ ByteBuffer& operator>>(ByteBuffer& data, AuctionBucketKey& itemKey) ByteBuffer& operator<<(ByteBuffer& data, AuctionBucketKey const& itemKey) { data.WriteBits(itemKey.ItemID, 20); - data.WriteBit(itemKey.BattlePetSpeciesID.is_initialized()); + data.WriteBit(itemKey.BattlePetSpeciesID.has_value()); data.WriteBits(itemKey.ItemLevel, 11); - data.WriteBit(itemKey.SuffixItemNameDescriptionID.is_initialized()); + data.WriteBit(itemKey.SuffixItemNameDescriptionID.has_value()); data.FlushBits(); if (itemKey.BattlePetSpeciesID) @@ -160,10 +160,10 @@ ByteBuffer& operator<<(ByteBuffer& data, BucketInfo const& bucketInfo) if (!bucketInfo.ItemModifiedAppearanceIDs.empty()) data.append(bucketInfo.ItemModifiedAppearanceIDs.data(), bucketInfo.ItemModifiedAppearanceIDs.size()); - data.WriteBit(bucketInfo.MaxBattlePetQuality.is_initialized()); - data.WriteBit(bucketInfo.MaxBattlePetLevel.is_initialized()); - data.WriteBit(bucketInfo.BattlePetBreedID.is_initialized()); - data.WriteBit(bucketInfo.Unk901_1.is_initialized()); + data.WriteBit(bucketInfo.MaxBattlePetQuality.has_value()); + data.WriteBit(bucketInfo.MaxBattlePetLevel.has_value()); + data.WriteBit(bucketInfo.BattlePetBreedID.has_value()); + data.WriteBit(bucketInfo.Unk901_1.has_value()); data.WriteBit(bucketInfo.ContainsOwnerItem); data.WriteBit(bucketInfo.ContainsOnlyCollectedAppearances); data.FlushBits(); @@ -185,21 +185,21 @@ ByteBuffer& operator<<(ByteBuffer& data, BucketInfo const& bucketInfo) ByteBuffer& operator<<(ByteBuffer& data, AuctionItem const& auctionItem) { - data.WriteBit(auctionItem.Item.is_initialized()); + data.WriteBit(auctionItem.Item.has_value()); data.WriteBits(auctionItem.Enchantments.size(), 4); data.WriteBits(auctionItem.Gems.size(), 2); - data.WriteBit(auctionItem.MinBid.is_initialized()); - data.WriteBit(auctionItem.MinIncrement.is_initialized()); - data.WriteBit(auctionItem.BuyoutPrice.is_initialized()); - data.WriteBit(auctionItem.UnitPrice.is_initialized()); + data.WriteBit(auctionItem.MinBid.has_value()); + data.WriteBit(auctionItem.MinIncrement.has_value()); + data.WriteBit(auctionItem.BuyoutPrice.has_value()); + data.WriteBit(auctionItem.UnitPrice.has_value()); data.WriteBit(auctionItem.CensorServerSideInfo); data.WriteBit(auctionItem.CensorBidInfo); - data.WriteBit(auctionItem.AuctionBucketKey.is_initialized()); - data.WriteBit(auctionItem.Creator.is_initialized()); + data.WriteBit(auctionItem.AuctionBucketKey.has_value()); + data.WriteBit(auctionItem.Creator.has_value()); if (!auctionItem.CensorBidInfo) { - data.WriteBit(auctionItem.Bidder.is_initialized()); - data.WriteBit(auctionItem.BidAmount.is_initialized()); + data.WriteBit(auctionItem.Bidder.has_value()); + data.WriteBit(auctionItem.BidAmount.has_value()); } data.FlushBits(); @@ -545,9 +545,9 @@ WorldPacket const* AuctionCommandResult::Write() WorldPacket const* AuctionGetCommodityQuoteResult::Write() { - _worldPacket.WriteBit(TotalPrice.is_initialized()); - _worldPacket.WriteBit(Quantity.is_initialized()); - _worldPacket.WriteBit(QuoteDuration.is_initialized()); + _worldPacket.WriteBit(TotalPrice.has_value()); + _worldPacket.WriteBit(Quantity.has_value()); + _worldPacket.WriteBit(QuoteDuration.has_value()); _worldPacket << int32(ItemID); _worldPacket << uint32(DesiredDelay); diff --git a/src/server/game/Server/Packets/AuthenticationPackets.cpp b/src/server/game/Server/Packets/AuthenticationPackets.cpp index e5755b0539..d4fc5a6e86 100644 --- a/src/server/game/Server/Packets/AuthenticationPackets.cpp +++ b/src/server/game/Server/Packets/AuthenticationPackets.cpp @@ -112,8 +112,8 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Auth::AuthWaitInfo const& WorldPacket const* WorldPackets::Auth::AuthResponse::Write() { _worldPacket << uint32(Result); - _worldPacket.WriteBit(SuccessInfo.is_initialized()); - _worldPacket.WriteBit(WaitInfo.is_initialized()); + _worldPacket.WriteBit(SuccessInfo.has_value()); + _worldPacket.WriteBit(WaitInfo.has_value()); _worldPacket.FlushBits(); if (SuccessInfo) @@ -144,9 +144,9 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write() _worldPacket.WriteBit(SuccessInfo->IsExpansionTrial); _worldPacket.WriteBit(SuccessInfo->ForceCharacterTemplate); - _worldPacket.WriteBit(SuccessInfo->NumPlayersHorde.is_initialized()); - _worldPacket.WriteBit(SuccessInfo->NumPlayersAlliance.is_initialized()); - _worldPacket.WriteBit(SuccessInfo->ExpansionTrialExpiration.is_initialized()); + _worldPacket.WriteBit(SuccessInfo->NumPlayersHorde.has_value()); + _worldPacket.WriteBit(SuccessInfo->NumPlayersAlliance.has_value()); + _worldPacket.WriteBit(SuccessInfo->ExpansionTrialExpiration.has_value()); _worldPacket.FlushBits(); { diff --git a/src/server/game/Server/Packets/AuthenticationPackets.h b/src/server/game/Server/Packets/AuthenticationPackets.h index aa63c60877..017afed87f 100644 --- a/src/server/game/Server/Packets/AuthenticationPackets.h +++ b/src/server/game/Server/Packets/AuthenticationPackets.h @@ -140,6 +140,8 @@ namespace WorldPackets bool InGameRoom = false; }; + AuthSuccessInfo() { } // work around clang bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101227 + uint8 ActiveExpansionLevel = 0; ///< the current server expansion, the possible values are in @ref Expansions uint8 AccountExpansionLevel = 0; ///< the current expansion of this account, the possible values are in @ref Expansions uint32 TimeRested = 0; ///< affects the return value of the GetBillingTimeRested() client API call, it is the number of seconds you have left until the experience points and loot you receive from creatures and quests is reduced. It is only used in the Asia region in retail, it's not implemented in TC and will probably never be. diff --git a/src/server/game/Server/Packets/AzeritePackets.cpp b/src/server/game/Server/Packets/AzeritePackets.cpp index 3abb123463..13222e3175 100644 --- a/src/server/game/Server/Packets/AzeritePackets.cpp +++ b/src/server/game/Server/Packets/AzeritePackets.cpp @@ -47,7 +47,7 @@ void WorldPackets::Azerite::AzeriteEssenceActivateEssence::Read() WorldPacket const* WorldPackets::Azerite::ActivateEssenceFailed::Write() { _worldPacket.WriteBits(AsUnderlyingType(Reason), 4); - _worldPacket.WriteBit(Slot.is_initialized()); + _worldPacket.WriteBit(Slot.has_value()); _worldPacket << int32(Arg); _worldPacket << int32(AzeriteEssenceID); if (Slot) diff --git a/src/server/game/Server/Packets/BattlePetPackets.cpp b/src/server/game/Server/Packets/BattlePetPackets.cpp index a9de1e154a..e76b39f2f7 100644 --- a/src/server/game/Server/Packets/BattlePetPackets.cpp +++ b/src/server/game/Server/Packets/BattlePetPackets.cpp @@ -44,7 +44,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::BattlePet::BattlePet cons data << uint32(pet.Speed); data << uint8(pet.Quality); data.WriteBits(pet.Name.size(), 7); - data.WriteBit(pet.OwnerInfo.is_initialized()); + data.WriteBit(pet.OwnerInfo.has_value()); data.WriteBit(false); // NoRename data.FlushBits(); @@ -116,7 +116,7 @@ void WorldPackets::BattlePet::BattlePetModifyName::Read() if (hasDeclinedNames) { - DeclinedNames.emplace(); + DeclinedNames = std::make_unique(); uint8 declinedNameLengths[MAX_DECLINED_NAME_CASES]; for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) diff --git a/src/server/game/Server/Packets/BattlePetPackets.h b/src/server/game/Server/Packets/BattlePetPackets.h index 240b62750e..9cc3e8f9a5 100644 --- a/src/server/game/Server/Packets/BattlePetPackets.h +++ b/src/server/game/Server/Packets/BattlePetPackets.h @@ -23,6 +23,7 @@ #include "ObjectGuid.h" #include "Optional.h" #include "UnitDefines.h" +#include namespace WorldPackets { @@ -150,7 +151,7 @@ namespace WorldPackets ObjectGuid PetGuid; std::string Name; - Optional DeclinedNames; + std::unique_ptr DeclinedNames; }; class QueryBattlePetName final : public ClientPacket diff --git a/src/server/game/Server/Packets/BattlegroundPackets.cpp b/src/server/game/Server/Packets/BattlegroundPackets.cpp index e516c3272f..c8c46eaf2a 100644 --- a/src/server/game/Server/Packets/BattlegroundPackets.cpp +++ b/src/server/game/Server/Packets/BattlegroundPackets.cpp @@ -92,11 +92,11 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPMatchSta data.WriteBit(playerData.Faction != 0); data.WriteBit(playerData.IsInWorld); - data.WriteBit(playerData.Honor.is_initialized()); - data.WriteBit(playerData.PreMatchRating.is_initialized()); - data.WriteBit(playerData.RatingChange.is_initialized()); - data.WriteBit(playerData.PreMatchMMR.is_initialized()); - data.WriteBit(playerData.MmrChange.is_initialized()); + data.WriteBit(playerData.Honor.has_value()); + data.WriteBit(playerData.PreMatchRating.has_value()); + data.WriteBit(playerData.RatingChange.has_value()); + data.WriteBit(playerData.PreMatchMMR.has_value()); + data.WriteBit(playerData.MmrChange.has_value()); data.FlushBits(); if (playerData.Honor) @@ -119,11 +119,11 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPMatchSta ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPMatchStatistics const& pvpLogData) { - data.WriteBit(pvpLogData.Ratings.is_initialized()); + data.WriteBit(pvpLogData.Ratings.has_value()); data << uint32(pvpLogData.Statistics.size()); data.append(pvpLogData.PlayerCount.data(), pvpLogData.PlayerCount.size()); - if (pvpLogData.Ratings.is_initialized()) + if (pvpLogData.Ratings.has_value()) data << *pvpLogData.Ratings; for (WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics const& player : pvpLogData.Statistics) @@ -361,7 +361,7 @@ WorldPacket const* WorldPackets::Battleground::PVPMatchComplete::Write() { _worldPacket << uint8(Winner); _worldPacket << Duration; - _worldPacket.WriteBit(LogData.is_initialized()); + _worldPacket.WriteBit(LogData.has_value()); _worldPacket.FlushBits(); if (LogData) diff --git a/src/server/game/Server/Packets/BattlegroundPackets.h b/src/server/game/Server/Packets/BattlegroundPackets.h index e1d5041cca..8fb18dd241 100644 --- a/src/server/game/Server/Packets/BattlegroundPackets.h +++ b/src/server/game/Server/Packets/BattlegroundPackets.h @@ -96,6 +96,8 @@ namespace WorldPackets { struct RatingData { + RatingData() { } // work around clang bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101227 + int32 Prematch[2] = { }; int32 Postmatch[2] = { }; int32 PrematchMMR[2] = { }; @@ -103,6 +105,8 @@ namespace WorldPackets struct HonorData { + HonorData() { } // work around clang bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101227 + uint32 HonorKills = 0; uint32 Deaths = 0; uint32 ContributionPoints = 0; diff --git a/src/server/game/Server/Packets/CalendarPackets.cpp b/src/server/game/Server/Packets/CalendarPackets.cpp index d12d73831e..66a87f4be5 100644 --- a/src/server/game/Server/Packets/CalendarPackets.cpp +++ b/src/server/game/Server/Packets/CalendarPackets.cpp @@ -94,13 +94,13 @@ ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Calendar::CalendarAddEv buffer >> invite.Status; buffer >> invite.Moderator; if (buffer.ReadBit()) - invite.Unused_801_1 = boost::in_place(); + invite.Unused_801_1.emplace(); if (buffer.ReadBit()) - invite.Unused_801_2 = boost::in_place(); + invite.Unused_801_2.emplace(); if (buffer.ReadBit()) - invite.Unused_801_3 = boost::in_place(); + invite.Unused_801_3.emplace(); if (invite.Unused_801_1) buffer >> *invite.Unused_801_1; diff --git a/src/server/game/Server/Packets/CharacterPackets.cpp b/src/server/game/Server/Packets/CharacterPackets.cpp index 98a8199e10..bde4aadf90 100644 --- a/src/server/game/Server/Packets/CharacterPackets.cpp +++ b/src/server/game/Server/Packets/CharacterPackets.cpp @@ -253,7 +253,7 @@ WorldPacket const* EnumCharactersResult::Write() _worldPacket.WriteBit(IsNewPlayerRestrictionSkipped); _worldPacket.WriteBit(IsNewPlayerRestricted); _worldPacket.WriteBit(IsNewPlayer); - _worldPacket.WriteBit(DisabledClassesMask.is_initialized()); + _worldPacket.WriteBit(DisabledClassesMask.has_value()); _worldPacket.WriteBit(IsAlliedRacesCreationAllowed); _worldPacket << uint32(Characters.size()); _worldPacket << int32(MaxCharacterLevel); @@ -339,7 +339,7 @@ void CharacterRenameRequest::Read() WorldPacket const* CharacterRenameResult::Write() { _worldPacket << uint8(Result); - _worldPacket.WriteBit(Guid.is_initialized()); + _worldPacket.WriteBit(Guid.has_value()); _worldPacket.WriteBits(Name.length(), 6); _worldPacket.FlushBits(); @@ -388,7 +388,7 @@ WorldPacket const* CharFactionChangeResult::Write() { _worldPacket << uint8(Result); _worldPacket << Guid; - _worldPacket.WriteBit(Display.is_initialized()); + _worldPacket.WriteBit(Display.has_value()); _worldPacket.FlushBits(); if (Display) diff --git a/src/server/game/Server/Packets/CharacterPackets.h b/src/server/game/Server/Packets/CharacterPackets.h index 6b1f069524..d4eff75626 100644 --- a/src/server/game/Server/Packets/CharacterPackets.h +++ b/src/server/game/Server/Packets/CharacterPackets.h @@ -346,17 +346,17 @@ namespace WorldPackets std::shared_ptr RaceOrFactionChangeInfo; }; + struct CharFactionChangeDisplayInfo + { + std::string Name; + uint8 SexID = 0; + uint8 RaceID = RACE_NONE; + Array const* Customizations = nullptr; + }; + class CharFactionChangeResult final : public ServerPacket { public: - struct CharFactionChangeDisplayInfo - { - std::string Name; - uint8 SexID = 0; - uint8 RaceID = RACE_NONE; - Array const* Customizations = nullptr; - }; - CharFactionChangeResult() : ServerPacket(SMSG_CHAR_FACTION_CHANGE_RESULT, 20 + sizeof(CharFactionChangeDisplayInfo)) { } WorldPacket const* Write() override; diff --git a/src/server/game/Server/Packets/ChatPackets.cpp b/src/server/game/Server/Packets/ChatPackets.cpp index ed8953d7ef..6ac809ecc9 100644 --- a/src/server/game/Server/Packets/ChatPackets.cpp +++ b/src/server/game/Server/Packets/ChatPackets.cpp @@ -181,8 +181,8 @@ WorldPacket const* WorldPackets::Chat::Chat::Write() _worldPacket.WriteBits(_ChatFlags, 14); _worldPacket.WriteBit(HideChatLog); _worldPacket.WriteBit(FakeSenderName); - _worldPacket.WriteBit(Unused_801.is_initialized()); - _worldPacket.WriteBit(ChannelGUID.is_initialized()); + _worldPacket.WriteBit(Unused_801.has_value()); + _worldPacket.WriteBit(ChannelGUID.has_value()); _worldPacket.FlushBits(); _worldPacket.WriteString(SenderName); diff --git a/src/server/game/Server/Packets/CombatLogPackets.cpp b/src/server/game/Server/Packets/CombatLogPackets.cpp index ce7254c230..839581a6bf 100644 --- a/src/server/game/Server/Packets/CombatLogPackets.cpp +++ b/src/server/game/Server/Packets/CombatLogPackets.cpp @@ -36,7 +36,7 @@ WorldPacket const* WorldPackets::CombatLog::SpellNonMeleeDamageLog::Write() WriteBits(Flags, 7); WriteBit(false); // Debug info WriteLogDataBit(); - WriteBit(ContentTuning.is_initialized()); + WriteBit(ContentTuning.has_value()); FlushBits(); WriteLogData(); if (ContentTuning) @@ -136,10 +136,10 @@ WorldPacket const* WorldPackets::CombatLog::SpellHealLog::Write() *this << int32(OverHeal); *this << int32(Absorbed); WriteBit(Crit); - WriteBit(CritRollMade.is_initialized()); - WriteBit(CritRollNeeded.is_initialized()); + WriteBit(CritRollMade.has_value()); + WriteBit(CritRollNeeded.has_value()); WriteLogDataBit(); - WriteBit(ContentTuning.is_initialized()); + WriteBit(ContentTuning.has_value()); FlushBits(); WriteLogData(); @@ -175,8 +175,8 @@ WorldPacket const* WorldPackets::CombatLog::SpellPeriodicAuraLog::Write() *this << int32(effect.AbsorbedOrAmplitude); *this << int32(effect.Resisted); WriteBit(effect.Crit); - WriteBit(effect.DebugInfo.is_initialized()); - WriteBit(effect.ContentTuning.is_initialized()); + WriteBit(effect.DebugInfo.has_value()); + WriteBit(effect.ContentTuning.has_value()); FlushBits(); if (effect.ContentTuning) @@ -241,7 +241,7 @@ ByteBuffer& operator<<(ByteBuffer& buffer, WorldPackets::CombatLog::SpellLogMiss { buffer << missEntry.Victim; buffer << uint8(missEntry.MissReason); - if (buffer.WriteBit(missEntry.Debug.is_initialized())) + if (buffer.WriteBit(missEntry.Debug.has_value())) buffer << *missEntry.Debug; buffer.FlushBits(); @@ -264,8 +264,8 @@ WorldPacket const* WorldPackets::CombatLog::ProcResist::Write() _worldPacket << Caster; _worldPacket << Target; _worldPacket << int32(SpellID); - _worldPacket.WriteBit(Rolled.is_initialized()); - _worldPacket.WriteBit(Needed.is_initialized()); + _worldPacket.WriteBit(Rolled.has_value()); + _worldPacket.WriteBit(Needed.has_value()); _worldPacket.FlushBits(); if (Rolled) @@ -314,7 +314,7 @@ WorldPacket const* WorldPackets::CombatLog::AttackerStateUpdate::Write() attackRoundInfo << int32(Damage); attackRoundInfo << int32(OriginalDamage); attackRoundInfo << int32(OverDamage); - attackRoundInfo << uint8(SubDmg.is_initialized()); + attackRoundInfo << uint8(SubDmg.has_value()); if (SubDmg) { attackRoundInfo << int32(SubDmg->SchoolMask); @@ -381,11 +381,11 @@ ByteBuffer& operator<<(ByteBuffer& buffer, WorldPackets::CombatLog::SpellDispell { buffer << int32(dispellData.SpellID); buffer.WriteBit(dispellData.Harmful); - buffer.WriteBit(dispellData.Rolled.is_initialized()); - buffer.WriteBit(dispellData.Needed.is_initialized()); - if (dispellData.Rolled.is_initialized()) + buffer.WriteBit(dispellData.Rolled.has_value()); + buffer.WriteBit(dispellData.Needed.has_value()); + if (dispellData.Rolled.has_value()) buffer << int32(*dispellData.Rolled); - if (dispellData.Needed.is_initialized()) + if (dispellData.Needed.has_value()) buffer << int32(*dispellData.Needed); buffer.FlushBits(); diff --git a/src/server/game/Server/Packets/GarrisonPackets.cpp b/src/server/game/Server/Packets/GarrisonPackets.cpp index d226b521a4..a488cd3b3c 100644 --- a/src/server/game/Server/Packets/GarrisonPackets.cpp +++ b/src/server/game/Server/Packets/GarrisonPackets.cpp @@ -114,7 +114,7 @@ ByteBuffer& operator<<(ByteBuffer& data, GarrisonMissionReward const& missionRew data << uint32(missionRewardItem.FollowerXP); data << uint32(missionRewardItem.GarrMssnBonusAbilityID); data << int32(missionRewardItem.ItemFileDataID); - data.WriteBit(missionRewardItem.ItemInstance.is_initialized()); + data.WriteBit(missionRewardItem.ItemInstance.has_value()); data.FlushBits(); if (missionRewardItem.ItemInstance) @@ -145,7 +145,7 @@ ByteBuffer& operator<<(ByteBuffer& data, GarrisonTalent const& talent) data << int32(talent.Rank); data << talent.ResearchStartTime; data << int32(talent.Flags); - data.WriteBit(talent.Socket.is_initialized()); + data.WriteBit(talent.Socket.has_value()); data.FlushBits(); if (talent.Socket) diff --git a/src/server/game/Server/Packets/GuildPackets.cpp b/src/server/game/Server/Packets/GuildPackets.cpp index e2c43125bc..86cba61325 100644 --- a/src/server/game/Server/Packets/GuildPackets.cpp +++ b/src/server/game/Server/Packets/GuildPackets.cpp @@ -30,7 +30,7 @@ WorldPacket const* WorldPackets::Guild::QueryGuildInfoResponse::Write() { _worldPacket << GuildGuid; _worldPacket << PlayerGuid; - _worldPacket.WriteBit(Info.is_initialized()); + _worldPacket.WriteBit(Info.has_value()); _worldPacket.FlushBits(); if (Info) @@ -657,7 +657,7 @@ void WorldPackets::Guild::AutoGuildBankItem::Read() _worldPacket >> ContainerItemSlot; if (_worldPacket.ReadBit()) - ContainerSlot = boost::in_place(); + ContainerSlot.emplace(); if (ContainerSlot) _worldPacket >> *ContainerSlot; @@ -671,7 +671,7 @@ void WorldPackets::Guild::StoreGuildBankItem::Read() _worldPacket >> ContainerItemSlot; if (_worldPacket.ReadBit()) - ContainerSlot = boost::in_place(); + ContainerSlot.emplace(); if (ContainerSlot) _worldPacket >> *ContainerSlot; @@ -685,7 +685,7 @@ void WorldPackets::Guild::SwapItemWithGuildBankItem::Read() _worldPacket >> ContainerItemSlot; if (_worldPacket.ReadBit()) - ContainerSlot = boost::in_place(); + ContainerSlot.emplace(); if (ContainerSlot) _worldPacket >> *ContainerSlot; @@ -718,7 +718,7 @@ void WorldPackets::Guild::MergeItemWithGuildBankItem::Read() _worldPacket >> StackCount; if (_worldPacket.ReadBit()) - ContainerSlot = boost::in_place(); + ContainerSlot.emplace(); if (ContainerSlot) _worldPacket >> *ContainerSlot; @@ -733,7 +733,7 @@ void WorldPackets::Guild::SplitItemToGuildBank::Read() _worldPacket >> StackCount; if (_worldPacket.ReadBit()) - ContainerSlot = boost::in_place(); + ContainerSlot.emplace(); if (ContainerSlot) _worldPacket >> *ContainerSlot; @@ -748,7 +748,7 @@ void WorldPackets::Guild::MergeGuildBankItemWithItem::Read() _worldPacket >> StackCount; if (_worldPacket.ReadBit()) - ContainerSlot = boost::in_place(); + ContainerSlot.emplace(); if (ContainerSlot) _worldPacket >> *ContainerSlot; @@ -763,7 +763,7 @@ void WorldPackets::Guild::SplitGuildBankItemToInventory::Read() _worldPacket >> StackCount; if (_worldPacket.ReadBit()) - ContainerSlot = boost::in_place(); + ContainerSlot.emplace(); if (ContainerSlot) _worldPacket >> *ContainerSlot; @@ -805,7 +805,7 @@ WorldPacket const* WorldPackets::Guild::GuildBankLogQueryResults::Write() { _worldPacket << int32(Tab); _worldPacket << uint32(Entry.size()); - _worldPacket.WriteBit(WeeklyBonusMoney.is_initialized()); + _worldPacket.WriteBit(WeeklyBonusMoney.has_value()); _worldPacket.FlushBits(); for (GuildBankLogEntry const& logEntry : Entry) @@ -814,22 +814,22 @@ WorldPacket const* WorldPackets::Guild::GuildBankLogQueryResults::Write() _worldPacket << uint32(logEntry.TimeOffset); _worldPacket << int8(logEntry.EntryType); - _worldPacket.WriteBit(logEntry.Money.is_initialized()); - _worldPacket.WriteBit(logEntry.ItemID.is_initialized()); - _worldPacket.WriteBit(logEntry.Count.is_initialized()); - _worldPacket.WriteBit(logEntry.OtherTab.is_initialized()); + _worldPacket.WriteBit(logEntry.Money.has_value()); + _worldPacket.WriteBit(logEntry.ItemID.has_value()); + _worldPacket.WriteBit(logEntry.Count.has_value()); + _worldPacket.WriteBit(logEntry.OtherTab.has_value()); _worldPacket.FlushBits(); - if (logEntry.Money.is_initialized()) + if (logEntry.Money.has_value()) _worldPacket << uint64(*logEntry.Money); - if (logEntry.ItemID.is_initialized()) + if (logEntry.ItemID.has_value()) _worldPacket << int32(*logEntry.ItemID); - if (logEntry.Count.is_initialized()) + if (logEntry.Count.has_value()) _worldPacket << int32(*logEntry.Count); - if (logEntry.OtherTab.is_initialized()) + if (logEntry.OtherTab.has_value()) _worldPacket << int8(*logEntry.OtherTab); } @@ -883,7 +883,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Guild::GuildNewsEvent con for (ObjectGuid memberGuid : newsEvent.MemberList) data << memberGuid; - data.WriteBit(newsEvent.Item.is_initialized()); + data.WriteBit(newsEvent.Item.has_value()); data.FlushBits(); if (newsEvent.Item) diff --git a/src/server/game/Server/Packets/GuildPackets.h b/src/server/game/Server/Packets/GuildPackets.h index 646d29f7b6..e195e18590 100644 --- a/src/server/game/Server/Packets/GuildPackets.h +++ b/src/server/game/Server/Packets/GuildPackets.h @@ -40,36 +40,36 @@ namespace WorldPackets ObjectGuid GuildGuid; }; + struct GuildInfo + { + ObjectGuid GuildGUID; + + uint32 VirtualRealmAddress = 0; ///< a special identifier made from the Index, BattleGroup and Region. + + std::string GuildName; + + struct GuildInfoRank + { + GuildInfoRank(uint32 id, uint32 order, std::string const& name) + : RankID(id), RankOrder(order), RankName(name) { } + + uint32 RankID; + uint32 RankOrder; + std::string RankName; + }; + + std::vector Ranks; + + uint32 EmblemStyle = 0; + uint32 EmblemColor = 0; + uint32 BorderStyle = 0; + uint32 BorderColor = 0; + uint32 BackgroundColor = 0; + }; + class QueryGuildInfoResponse final : public ServerPacket { public: - struct GuildInfo - { - ObjectGuid GuildGUID; - - uint32 VirtualRealmAddress = 0; ///< a special identifier made from the Index, BattleGroup and Region. - - std::string GuildName; - - struct GuildInfoRank - { - GuildInfoRank(uint32 id, uint32 order, std::string const& name) - : RankID(id), RankOrder(order), RankName(name) { } - - uint32 RankID; - uint32 RankOrder; - std::string RankName; - }; - - std::vector Ranks; - - uint32 EmblemStyle = 0; - uint32 EmblemColor = 0; - uint32 BorderStyle = 0; - uint32 BorderColor = 0; - uint32 BackgroundColor = 0; - }; - QueryGuildInfoResponse(); WorldPacket const* Write() override; diff --git a/src/server/game/Server/Packets/InspectPackets.cpp b/src/server/game/Server/Packets/InspectPackets.cpp index 570728134e..9cd83f4ac6 100644 --- a/src/server/game/Server/Packets/InspectPackets.cpp +++ b/src/server/game/Server/Packets/InspectPackets.cpp @@ -208,8 +208,8 @@ WorldPacket const* WorldPackets::Inspect::InspectResult::Write() if (!PvpTalents.empty()) _worldPacket.append(PvpTalents.data(), PvpTalents.size()); - _worldPacket.WriteBit(GuildData.is_initialized()); - _worldPacket.WriteBit(AzeriteLevel.is_initialized()); + _worldPacket.WriteBit(GuildData.has_value()); + _worldPacket.WriteBit(AzeriteLevel.has_value()); _worldPacket.FlushBits(); for (PVPBracketData const& bracket : Bracket) diff --git a/src/server/game/Server/Packets/ItemPackets.cpp b/src/server/game/Server/Packets/ItemPackets.cpp index 12284f1e48..98e2699785 100644 --- a/src/server/game/Server/Packets/ItemPackets.cpp +++ b/src/server/game/Server/Packets/ItemPackets.cpp @@ -106,7 +106,7 @@ WorldPacket const* WorldPackets::Item::ItemPurchaseRefundResult::Write() { _worldPacket << ItemGUID; _worldPacket << uint8(Result); - _worldPacket.WriteBit(Contents.is_initialized()); + _worldPacket.WriteBit(Contents.has_value()); _worldPacket.FlushBits(); if (Contents) _worldPacket << *Contents; diff --git a/src/server/game/Server/Packets/ItemPacketsCommon.cpp b/src/server/game/Server/Packets/ItemPacketsCommon.cpp index 0481119c8c..75e75cec60 100644 --- a/src/server/game/Server/Packets/ItemPacketsCommon.cpp +++ b/src/server/game/Server/Packets/ItemPacketsCommon.cpp @@ -53,7 +53,7 @@ void ItemInstance::Initialize(::Item const* item) std::vector const& bonusListIds = item->m_itemData->BonusListIDs; if (!bonusListIds.empty()) { - ItemBonus = boost::in_place(); + ItemBonus.emplace(); ItemBonus->BonusListIDs.insert(ItemBonus->BonusListIDs.end(), bonusListIds.begin(), bonusListIds.end()); ItemBonus->Context = item->GetContext(); } @@ -82,7 +82,7 @@ void ItemInstance::Initialize(::LootItem const& lootItem) if (!lootItem.BonusListIDs.empty() || lootItem.randomBonusListId) { - ItemBonus = boost::in_place(); + ItemBonus.emplace(); ItemBonus->BonusListIDs = lootItem.BonusListIDs; ItemBonus->Context = lootItem.context; if (lootItem.randomBonusListId) @@ -102,7 +102,7 @@ void ItemInstance::Initialize(::VoidStorageItem const* voidItem) if (!voidItem->BonusListIDs.empty()) { - ItemBonus = boost::in_place(); + ItemBonus.emplace(); ItemBonus->Context = voidItem->Context; ItemBonus->BonusListIDs = voidItem->BonusListIDs; } @@ -113,13 +113,13 @@ bool ItemInstance::operator==(ItemInstance const& r) const if (ItemID != r.ItemID) return false; - if (ItemBonus.is_initialized() != r.ItemBonus.is_initialized()) + if (ItemBonus.has_value() != r.ItemBonus.has_value()) return false; if (Modifications != r.Modifications) return false; - if (ItemBonus.is_initialized() && *ItemBonus != *r.ItemBonus) + if (ItemBonus.has_value() && *ItemBonus != *r.ItemBonus) return false; return true; @@ -194,7 +194,7 @@ ByteBuffer& operator<<(ByteBuffer& data, ItemInstance const& itemInstance) { data << int32(itemInstance.ItemID); - data.WriteBit(itemInstance.ItemBonus.is_initialized()); + data.WriteBit(itemInstance.ItemBonus.has_value()); data.FlushBits(); data << itemInstance.Modifications; @@ -216,7 +216,7 @@ ByteBuffer& operator>>(ByteBuffer& data, ItemInstance& itemInstance) if (hasItemBonus) { - itemInstance.ItemBonus = boost::in_place(); + itemInstance.ItemBonus.emplace(); data >> *itemInstance.ItemBonus; } diff --git a/src/server/game/Server/Packets/LFGPackets.cpp b/src/server/game/Server/Packets/LFGPackets.cpp index 7452384c7d..8e966cd4c9 100644 --- a/src/server/game/Server/Packets/LFGPackets.cpp +++ b/src/server/game/Server/Packets/LFGPackets.cpp @@ -76,7 +76,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGBlackListSlot con ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGBlackList const& blackList) { - data.WriteBit(blackList.PlayerGuid.is_initialized()); + data.WriteBit(blackList.PlayerGuid.has_value()); data << uint32(blackList.Slot.size()); if (blackList.PlayerGuid) data << *blackList.PlayerGuid; @@ -121,10 +121,10 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LfgPlayerQuestReward for (WorldPackets::LFG::LfgPlayerQuestRewardCurrency const& bonusCurrency : playerQuestReward.BonusCurrency) data << bonusCurrency; - data.WriteBit(playerQuestReward.RewardSpellID.is_initialized()); - data.WriteBit(playerQuestReward.Unused1.is_initialized()); - data.WriteBit(playerQuestReward.Unused2.is_initialized()); - data.WriteBit(playerQuestReward.Honor.is_initialized()); + data.WriteBit(playerQuestReward.RewardSpellID.has_value()); + data.WriteBit(playerQuestReward.Unused1.has_value()); + data.WriteBit(playerQuestReward.Unused2.has_value()); + data.WriteBit(playerQuestReward.Honor.has_value()); data.FlushBits(); if (playerQuestReward.RewardSpellID) @@ -303,8 +303,8 @@ WorldPacket const* WorldPackets::LFG::LFGQueueStatus::Write() ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGPlayerRewards const& lfgPlayerRewards) { - data.WriteBit(lfgPlayerRewards.RewardItem.is_initialized()); - data.WriteBit(lfgPlayerRewards.RewardCurrency.is_initialized()); + data.WriteBit(lfgPlayerRewards.RewardItem.has_value()); + data.WriteBit(lfgPlayerRewards.RewardCurrency.has_value()); if (lfgPlayerRewards.RewardItem) data << *lfgPlayerRewards.RewardItem; diff --git a/src/server/game/Server/Packets/LFGPackets.h b/src/server/game/Server/Packets/LFGPackets.h index 7dd0fbccc2..133daa6a2b 100644 --- a/src/server/game/Server/Packets/LFGPackets.h +++ b/src/server/game/Server/Packets/LFGPackets.h @@ -316,7 +316,7 @@ namespace WorldPackets { if (!isCurrency) { - RewardItem = boost::in_place(); + RewardItem.emplace(); RewardItem->ItemID = id; } else diff --git a/src/server/game/Server/Packets/LootPackets.cpp b/src/server/game/Server/Packets/LootPackets.cpp index 9a3b7e7bb3..94f8cee783 100644 --- a/src/server/game/Server/Packets/LootPackets.cpp +++ b/src/server/game/Server/Packets/LootPackets.cpp @@ -143,8 +143,8 @@ WorldPacket const* WorldPackets::Loot::LootList::Write() _worldPacket << Owner; _worldPacket << LootObj; - _worldPacket.WriteBit(Master.is_initialized()); - _worldPacket.WriteBit(RoundRobinWinner.is_initialized()); + _worldPacket.WriteBit(Master.has_value()); + _worldPacket.WriteBit(RoundRobinWinner.has_value()); _worldPacket.FlushBits(); diff --git a/src/server/game/Server/Packets/MailPackets.cpp b/src/server/game/Server/Packets/MailPackets.cpp index bb8e6ac87d..eb05a665eb 100644 --- a/src/server/game/Server/Packets/MailPackets.cpp +++ b/src/server/game/Server/Packets/MailPackets.cpp @@ -124,8 +124,8 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Mail::MailListEntry const data << float(entry.DaysLeft); data << int32(entry.MailTemplateID); data << uint32(entry.Attachments.size()); - data.WriteBit(entry.SenderCharacter.is_initialized()); - data.WriteBit(entry.AltSenderID.is_initialized()); + data.WriteBit(entry.SenderCharacter.has_value()); + data.WriteBit(entry.AltSenderID.has_value()); data.WriteBits(entry.Subject.size(), 8); data.WriteBits(entry.Body.size(), 13); data.FlushBits(); diff --git a/src/server/game/Server/Packets/MiscPackets.cpp b/src/server/game/Server/Packets/MiscPackets.cpp index 3d31d29c94..f464af32b0 100644 --- a/src/server/game/Server/Packets/MiscPackets.cpp +++ b/src/server/game/Server/Packets/MiscPackets.cpp @@ -50,14 +50,14 @@ WorldPacket const* WorldPackets::Misc::SetCurrency::Write() _worldPacket << int32(Type); _worldPacket << int32(Quantity); _worldPacket << uint32(Flags); - _worldPacket.WriteBit(WeeklyQuantity.is_initialized()); - _worldPacket.WriteBit(TrackedQuantity.is_initialized()); - _worldPacket.WriteBit(MaxQuantity.is_initialized()); - _worldPacket.WriteBit(Unused901.is_initialized()); + _worldPacket.WriteBit(WeeklyQuantity.has_value()); + _worldPacket.WriteBit(TrackedQuantity.has_value()); + _worldPacket.WriteBit(MaxQuantity.has_value()); + _worldPacket.WriteBit(Unused901.has_value()); _worldPacket.WriteBit(SuppressChatLog); - _worldPacket.WriteBit(QuantityChange.is_initialized()); - _worldPacket.WriteBit(QuantityGainSource.is_initialized()); - _worldPacket.WriteBit(QuantityLostSource.is_initialized()); + _worldPacket.WriteBit(QuantityChange.has_value()); + _worldPacket.WriteBit(QuantityGainSource.has_value()); + _worldPacket.WriteBit(QuantityLostSource.has_value()); _worldPacket.FlushBits(); if (WeeklyQuantity) @@ -98,11 +98,11 @@ WorldPacket const* WorldPackets::Misc::SetupCurrency::Write() _worldPacket << int32(data.Type); _worldPacket << int32(data.Quantity); - _worldPacket.WriteBit(data.WeeklyQuantity.is_initialized()); - _worldPacket.WriteBit(data.MaxWeeklyQuantity.is_initialized()); - _worldPacket.WriteBit(data.TrackedQuantity.is_initialized()); - _worldPacket.WriteBit(data.MaxQuantity.is_initialized()); - _worldPacket.WriteBit(data.Unused901.is_initialized()); + _worldPacket.WriteBit(data.WeeklyQuantity.has_value()); + _worldPacket.WriteBit(data.MaxWeeklyQuantity.has_value()); + _worldPacket.WriteBit(data.TrackedQuantity.has_value()); + _worldPacket.WriteBit(data.MaxQuantity.has_value()); + _worldPacket.WriteBit(data.Unused901.has_value()); _worldPacket.WriteBits(data.Flags, 5); _worldPacket.FlushBits(); @@ -181,9 +181,9 @@ WorldPacket const* WorldPackets::Misc::WorldServerInfo::Write() _worldPacket << uint8(IsTournamentRealm); _worldPacket.WriteBit(XRealmPvpAlert); _worldPacket.WriteBit(BlockExitingLoadingScreen); - _worldPacket.WriteBit(RestrictedAccountMaxLevel.is_initialized()); - _worldPacket.WriteBit(RestrictedAccountMaxMoney.is_initialized()); - _worldPacket.WriteBit(InstanceGroupSize.is_initialized()); + _worldPacket.WriteBit(RestrictedAccountMaxLevel.has_value()); + _worldPacket.WriteBit(RestrictedAccountMaxMoney.has_value()); + _worldPacket.WriteBit(InstanceGroupSize.has_value()); if (RestrictedAccountMaxLevel) _worldPacket << uint32(*RestrictedAccountMaxLevel); @@ -680,8 +680,8 @@ WorldPacket const* WorldPackets::Misc::OverrideLight::Write() WorldPacket const* WorldPackets::Misc::DisplayGameError::Write() { _worldPacket << uint32(Error); - _worldPacket.WriteBit(Arg.is_initialized()); - _worldPacket.WriteBit(Arg2.is_initialized()); + _worldPacket.WriteBit(Arg.has_value()); + _worldPacket.WriteBit(Arg2.has_value()); _worldPacket.FlushBits(); if (Arg) diff --git a/src/server/game/Server/Packets/MovementPackets.cpp b/src/server/game/Server/Packets/MovementPackets.cpp index 8bc93a75a7..f386fc9a24 100644 --- a/src/server/game/Server/Packets/MovementPackets.cpp +++ b/src/server/game/Server/Packets/MovementPackets.cpp @@ -265,11 +265,11 @@ ByteBuffer& WorldPackets::operator<<(ByteBuffer& data, Movement::MovementSpline data.WriteBit(movementSpline.VehicleExitVoluntary); data.WriteBit(movementSpline.Interpolate); data.WriteBits(movementSpline.PackedDeltas.size(), 16); - data.WriteBit(movementSpline.SplineFilter.is_initialized()); - data.WriteBit(movementSpline.SpellEffectExtraData.is_initialized()); - data.WriteBit(movementSpline.JumpExtraData.is_initialized()); - data.WriteBit(movementSpline.AnimTierTransition.is_initialized()); - data.WriteBit(movementSpline.Unknown901.is_initialized()); + data.WriteBit(movementSpline.SplineFilter.has_value()); + data.WriteBit(movementSpline.SpellEffectExtraData.has_value()); + data.WriteBit(movementSpline.JumpExtraData.has_value()); + data.WriteBit(movementSpline.AnimTierTransition.has_value()); + data.WriteBit(movementSpline.Unknown901.has_value()); data.FlushBits(); if (movementSpline.SplineFilter) @@ -348,9 +348,9 @@ void WorldPackets::Movement::CommonMovement::WriteCreateObjectSplineDataBlock(:: bool hasFadeObjectTime = data.WriteBit(moveSpline.splineflags.fadeObject && moveSpline.effect_start_time < moveSpline.Duration()); data.WriteBits(moveSpline.getPath().size(), 16); data.WriteBit(false); // HasSplineFilter - data.WriteBit(moveSpline.spell_effect_extra.is_initialized()); // HasSpellEffectExtraData + data.WriteBit(moveSpline.spell_effect_extra.has_value()); // HasSpellEffectExtraData bool hasJumpExtraData = data.WriteBit(moveSpline.splineflags.parabolic && (!moveSpline.spell_effect_extra || moveSpline.effect_start_time)); - data.WriteBit(moveSpline.anim_tier.is_initialized()); // HasAnimationTierTransition + data.WriteBit(moveSpline.anim_tier.has_value()); // HasAnimationTierTransition data.WriteBit(false); // HasUnknown901 data.FlushBits(); @@ -622,8 +622,8 @@ WorldPacket const* WorldPackets::Movement::TransferPending::Write() { _worldPacket << int32(MapID); _worldPacket << OldMapPosition; - _worldPacket.WriteBit(Ship.is_initialized()); - _worldPacket.WriteBit(TransferSpellID.is_initialized()); + _worldPacket.WriteBit(Ship.has_value()); + _worldPacket.WriteBit(TransferSpellID.has_value()); if (Ship) { _worldPacket << uint32(Ship->ID); @@ -674,8 +674,8 @@ WorldPacket const* WorldPackets::Movement::MoveTeleport::Write() _worldPacket << float(Facing); _worldPacket << uint8(PreloadWorld); - _worldPacket.WriteBit(TransportGUID.is_initialized()); - _worldPacket.WriteBit(Vehicle.is_initialized()); + _worldPacket.WriteBit(TransportGUID.has_value()); + _worldPacket.WriteBit(Vehicle.has_value()); _worldPacket.FlushBits(); if (Vehicle) @@ -718,15 +718,15 @@ WorldPacket const* WorldPackets::Movement::MoveUpdateTeleport::Write() _worldPacket << *Status; _worldPacket << uint32(MovementForces ? MovementForces->size() : 0); - _worldPacket.WriteBit(WalkSpeed.is_initialized()); - _worldPacket.WriteBit(RunSpeed.is_initialized()); - _worldPacket.WriteBit(RunBackSpeed.is_initialized()); - _worldPacket.WriteBit(SwimSpeed.is_initialized()); - _worldPacket.WriteBit(SwimBackSpeed.is_initialized()); - _worldPacket.WriteBit(FlightSpeed.is_initialized()); - _worldPacket.WriteBit(FlightBackSpeed.is_initialized()); - _worldPacket.WriteBit(TurnRate.is_initialized()); - _worldPacket.WriteBit(PitchRate.is_initialized()); + _worldPacket.WriteBit(WalkSpeed.has_value()); + _worldPacket.WriteBit(RunSpeed.has_value()); + _worldPacket.WriteBit(RunBackSpeed.has_value()); + _worldPacket.WriteBit(SwimSpeed.has_value()); + _worldPacket.WriteBit(SwimBackSpeed.has_value()); + _worldPacket.WriteBit(FlightSpeed.has_value()); + _worldPacket.WriteBit(FlightBackSpeed.has_value()); + _worldPacket.WriteBit(TurnRate.has_value()); + _worldPacket.WriteBit(PitchRate.has_value()); _worldPacket.FlushBits(); if (MovementForces) @@ -839,7 +839,7 @@ void WorldPackets::Movement::MoveKnockBackAck::Read() bool hasSpeeds = _worldPacket.ReadBit(); if (hasSpeeds) { - Speeds = boost::in_place(); + Speeds.emplace(); _worldPacket >> *Speeds; } } @@ -995,12 +995,12 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MoveSetCompound { data << uint16(stateChange.MessageID); data << uint32(stateChange.SequenceIndex); - data.WriteBit(stateChange.Speed.is_initialized()); - data.WriteBit(stateChange.KnockBack.is_initialized()); - data.WriteBit(stateChange.VehicleRecID.is_initialized()); - data.WriteBit(stateChange.CollisionHeight.is_initialized()); - data.WriteBit(stateChange.MovementForce_.is_initialized()); - data.WriteBit(stateChange.MovementForceGUID.is_initialized()); + data.WriteBit(stateChange.Speed.has_value()); + data.WriteBit(stateChange.KnockBack.has_value()); + data.WriteBit(stateChange.VehicleRecID.has_value()); + data.WriteBit(stateChange.CollisionHeight.has_value()); + data.WriteBit(stateChange.MovementForce_.has_value()); + data.WriteBit(stateChange.MovementForceGUID.has_value()); data.FlushBits(); if (stateChange.MovementForce_) diff --git a/src/server/game/Server/Packets/MovementPackets.h b/src/server/game/Server/Packets/MovementPackets.h index 73310a9e02..25a7cbd85b 100644 --- a/src/server/game/Server/Packets/MovementPackets.h +++ b/src/server/game/Server/Packets/MovementPackets.h @@ -234,14 +234,14 @@ namespace WorldPackets uint32 SequenceIndex = 0; ///< Unit movement packet index, incremented each time }; + struct ShipTransferPending + { + uint32 ID = 0; ///< gameobject_template.entry of the transport the player is teleporting on + int32 OriginMapID = -1; ///< Map id the player is currently on (before teleport) + }; + class TransferPending final : public ServerPacket { - struct ShipTransferPending - { - uint32 ID = 0; ///< gameobject_template.entry of the transport the player is teleporting on - int32 OriginMapID = -1; ///< Map id the player is currently on (before teleport) - }; - public: TransferPending() : ServerPacket(SMSG_TRANSFER_PENDING, 16) { } diff --git a/src/server/game/Server/Packets/NPCPackets.cpp b/src/server/game/Server/Packets/NPCPackets.cpp index 1f8d2dcec6..fc7bd40658 100644 --- a/src/server/game/Server/Packets/NPCPackets.cpp +++ b/src/server/game/Server/Packets/NPCPackets.cpp @@ -80,7 +80,7 @@ WorldPacket const* GossipMessage::Write() _worldPacket.WriteBits(options.Text.size(), 12); _worldPacket.WriteBits(options.Confirm.size(), 12); _worldPacket.WriteBits(AsUnderlyingType(options.Status), 2); - _worldPacket.WriteBit(options.SpellID.is_initialized()); + _worldPacket.WriteBit(options.SpellID.has_value()); _worldPacket.FlushBits(); _worldPacket << options.Treasure; diff --git a/src/server/game/Server/Packets/PartyPackets.cpp b/src/server/game/Server/Packets/PartyPackets.cpp index b7aed8c385..0b1d2aa8e5 100644 --- a/src/server/game/Server/Packets/PartyPackets.cpp +++ b/src/server/game/Server/Packets/PartyPackets.cpp @@ -106,7 +106,7 @@ void WorldPackets::Party::PartyInviteResponse::Read() bool hasRolesDesired = _worldPacket.ReadBit(); if (hasRolesDesired) { - RolesDesired = boost::in_place(); + RolesDesired.emplace(); _worldPacket >> *RolesDesired; } } @@ -221,12 +221,12 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Party::PartyMemberStats c for (WorldPackets::Party::PartyMemberAuraStates const& aura : memberStats.Auras) data << aura; - data.WriteBit(memberStats.PetStats.is_initialized()); + data.WriteBit(memberStats.PetStats.has_value()); data.FlushBits(); data << memberStats.DungeonScore; - if (memberStats.PetStats.is_initialized()) + if (memberStats.PetStats.has_value()) data << *memberStats.PetStats; return data; @@ -484,21 +484,21 @@ WorldPacket const* WorldPackets::Party::PartyUpdate::Write() _worldPacket << uint32(SequenceNum); _worldPacket << LeaderGUID; _worldPacket << uint32(PlayerList.size()); - _worldPacket.WriteBit(LfgInfos.is_initialized()); - _worldPacket.WriteBit(LootSettings.is_initialized()); - _worldPacket.WriteBit(DifficultySettings.is_initialized()); + _worldPacket.WriteBit(LfgInfos.has_value()); + _worldPacket.WriteBit(LootSettings.has_value()); + _worldPacket.WriteBit(DifficultySettings.has_value()); _worldPacket.FlushBits(); for (WorldPackets::Party::PartyPlayerInfo const& playerInfos : PlayerList) _worldPacket << playerInfos; - if (LootSettings.is_initialized()) + if (LootSettings.has_value()) _worldPacket << *LootSettings; - if (DifficultySettings.is_initialized()) + if (DifficultySettings.has_value()) _worldPacket << *DifficultySettings; - if (LfgInfos.is_initialized()) + if (LfgInfos.has_value()) _worldPacket << *LfgInfos; return &_worldPacket; @@ -640,7 +640,7 @@ void WorldPackets::Party::PartyMemberFullState::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(); diff --git a/src/server/game/Server/Packets/PetPackets.cpp b/src/server/game/Server/Packets/PetPackets.cpp index 52970173ad..0595903332 100644 --- a/src/server/game/Server/Packets/PetPackets.cpp +++ b/src/server/game/Server/Packets/PetPackets.cpp @@ -104,7 +104,7 @@ WorldPacket const* WorldPackets::Pet::PetNameInvalid::Write() _worldPacket << uint8(RenameData.NewName.length()); - _worldPacket.WriteBit(RenameData.DeclinedNames.is_initialized()); + _worldPacket.WriteBit(RenameData.DeclinedNames.has_value()); if (RenameData.DeclinedNames) { @@ -128,7 +128,7 @@ void WorldPackets::Pet::PetRename::Read() if (_worldPacket.ReadBit()) { - RenameData.DeclinedNames = boost::in_place(); + RenameData.DeclinedNames.emplace(); int32 count[MAX_DECLINED_NAME_CASES]; for (int32 i = 0; i < MAX_DECLINED_NAME_CASES; i++) count[i] = _worldPacket.ReadBits(7); diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp index a3bf98830f..8cb66be37f 100644 --- a/src/server/game/Server/Packets/QueryPackets.cpp +++ b/src/server/game/Server/Packets/QueryPackets.cpp @@ -107,8 +107,8 @@ void WorldPackets::Query::QueryPlayerName::Read() ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Query::PlayerGuidLookupHint const& lookupHint) { - data.WriteBit(lookupHint.VirtualRealmAddress.is_initialized()); - data.WriteBit(lookupHint.NativeRealmAddress.is_initialized()); + data.WriteBit(lookupHint.VirtualRealmAddress.has_value()); + data.WriteBit(lookupHint.NativeRealmAddress.has_value()); data.FlushBits(); if (lookupHint.VirtualRealmAddress) diff --git a/src/server/game/Server/Packets/QueryPackets.h b/src/server/game/Server/Packets/QueryPackets.h index 75d8b1f3d8..26fb9da11c 100644 --- a/src/server/game/Server/Packets/QueryPackets.h +++ b/src/server/game/Server/Packets/QueryPackets.h @@ -61,12 +61,6 @@ namespace WorldPackets struct CreatureStats { - CreatureStats() - { - Flags.fill(0); - ProxyCreatureID.fill(0); - } - std::string Title; std::string TitleAlt; std::string CursorName; @@ -86,10 +80,10 @@ namespace WorldPackets int32 CreatureDifficultyID = 0; int32 WidgetSetID = 0; int32 WidgetSetUnitConditionID = 0; - std::array Flags; - std::array ProxyCreatureID; - std::array Name; - std::array NameAlt; + std::array Flags = { }; + std::array ProxyCreatureID = { }; + std::array Name = { }; + std::array NameAlt = { }; }; class QueryCreatureResponse final : public ServerPacket diff --git a/src/server/game/Server/Packets/QuestPackets.cpp b/src/server/game/Server/Packets/QuestPackets.cpp index f012b07171..4fa60c84f5 100644 --- a/src/server/game/Server/Packets/QuestPackets.cpp +++ b/src/server/game/Server/Packets/QuestPackets.cpp @@ -710,9 +710,9 @@ ByteBuffer& operator<<(ByteBuffer& data, PlayerChoiceResponse const& playerChoic data.WriteBits(playerChoiceResponse.ButtonTooltip.length(), 9); data.WriteBits(playerChoiceResponse.Description.length(), 11); data.WriteBits(playerChoiceResponse.Confirmation.length(), 7); - data.WriteBit(playerChoiceResponse.RewardQuestID.is_initialized()); - data.WriteBit(playerChoiceResponse.Reward.is_initialized()); - data.WriteBit(playerChoiceResponse.MawPower.is_initialized()); + data.WriteBit(playerChoiceResponse.RewardQuestID.has_value()); + data.WriteBit(playerChoiceResponse.Reward.has_value()); + data.WriteBit(playerChoiceResponse.MawPower.has_value()); data.FlushBits(); if (playerChoiceResponse.Reward) diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp index 7500a7cdb7..862c269ef5 100644 --- a/src/server/game/Server/Packets/SpellPackets.cpp +++ b/src/server/game/Server/Packets/SpellPackets.cpp @@ -101,13 +101,13 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo cons data << uint16(auraData.CastLevel); data << uint8(auraData.Applications); data << int32(auraData.ContentTuningID); - data.WriteBit(auraData.CastUnit.is_initialized()); - data.WriteBit(auraData.Duration.is_initialized()); - data.WriteBit(auraData.Remaining.is_initialized()); - data.WriteBit(auraData.TimeMod.is_initialized()); + data.WriteBit(auraData.CastUnit.has_value()); + data.WriteBit(auraData.Duration.has_value()); + data.WriteBit(auraData.Remaining.has_value()); + data.WriteBit(auraData.TimeMod.has_value()); data.WriteBits(auraData.Points.size(), 6); data.WriteBits(auraData.EstimatedPoints.size(), 6); - data.WriteBit(auraData.ContentTuning.is_initialized()); + data.WriteBit(auraData.ContentTuning.has_value()); if (auraData.ContentTuning) data << *auraData.ContentTuning; @@ -136,7 +136,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo cons ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraInfo const& aura) { data << aura.Slot; - data.WriteBit(aura.AuraData.is_initialized()); + data.WriteBit(aura.AuraData.has_value()); data.FlushBits(); if (aura.AuraData) @@ -159,7 +159,7 @@ WorldPacket const* WorldPackets::Spells::AuraUpdate::Write() ByteBuffer& operator>>(ByteBuffer& buffer, Optional& location) { - location = boost::in_place(); + location.emplace(); buffer >> location->Transport; buffer >> location->Location.m_positionX; buffer >> location->Location.m_positionY; @@ -244,7 +244,7 @@ ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::SpellCastReques if (hasMoveUpdate) { - request.MoveUpdate = boost::in_place(); + request.MoveUpdate.emplace(); buffer >> *request.MoveUpdate; } @@ -298,10 +298,10 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::TargetLocation co ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData const& spellTargetData) { data.WriteBits(spellTargetData.Flags, 26); - data.WriteBit(spellTargetData.SrcLocation.is_initialized()); - data.WriteBit(spellTargetData.DstLocation.is_initialized()); - data.WriteBit(spellTargetData.Orientation.is_initialized()); - data.WriteBit(spellTargetData.MapID.is_initialized()); + data.WriteBit(spellTargetData.SrcLocation.has_value()); + data.WriteBit(spellTargetData.DstLocation.has_value()); + data.WriteBit(spellTargetData.Orientation.has_value()); + data.WriteBit(spellTargetData.MapID.has_value()); data.WriteBits(spellTargetData.Name.size(), 7); data.FlushBits(); @@ -409,7 +409,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con data.WriteBits(spellCastData.HitStatus.size(), 16); data.WriteBits(spellCastData.MissStatus.size(), 16); data.WriteBits(spellCastData.RemainingPower.size(), 9); - data.WriteBit(spellCastData.RemainingRunes.is_initialized()); + data.WriteBit(spellCastData.RemainingRunes.has_value()); data.WriteBits(spellCastData.TargetPoints.size(), 16); data.FlushBits(); @@ -646,8 +646,8 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellHistoryEntry data << int32(historyEntry.RecoveryTime); data << int32(historyEntry.CategoryRecoveryTime); data << float(historyEntry.ModRate); - data.WriteBit(historyEntry.unused622_1.is_initialized()); - data.WriteBit(historyEntry.unused622_2.is_initialized()); + data.WriteBit(historyEntry.unused622_1.has_value()); + data.WriteBit(historyEntry.unused622_2.has_value()); data.WriteBit(historyEntry.OnHold); if (historyEntry.unused622_1) data << uint32(*historyEntry.unused622_1); @@ -833,8 +833,8 @@ WorldPacket const* WorldPackets::Spells::SpellChannelStart::Write() _worldPacket << int32(SpellID); _worldPacket << Visual; _worldPacket << uint32(ChannelDuration); - _worldPacket.WriteBit(InterruptImmunities.is_initialized()); - _worldPacket.WriteBit(HealPrediction.is_initialized()); + _worldPacket.WriteBit(InterruptImmunities.has_value()); + _worldPacket.WriteBit(HealPrediction.has_value()); _worldPacket.FlushBits(); if (InterruptImmunities) @@ -967,7 +967,7 @@ void WorldPackets::Spells::UpdateMissileTrajectory::Read() _worldPacket.ResetBitPos(); if (hasStatus) { - Status = boost::in_place(); + Status.emplace(); _worldPacket >> *Status; } } diff --git a/src/server/game/Server/Packets/SystemPackets.cpp b/src/server/game/Server/Packets/SystemPackets.cpp index 509e73cf83..fbb59fea3a 100644 --- a/src/server/game/Server/Packets/SystemPackets.cpp +++ b/src/server/game/Server/Packets/SystemPackets.cpp @@ -71,14 +71,14 @@ WorldPacket const* FeatureSystemStatus::Write() _worldPacket << uint32(HiddenUIClubsPresenceUpdateTimer); _worldPacket.WriteBit(VoiceEnabled); - _worldPacket.WriteBit(EuropaTicketSystemStatus.is_initialized()); + _worldPacket.WriteBit(EuropaTicketSystemStatus.has_value()); _worldPacket.WriteBit(ScrollOfResurrectionEnabled); _worldPacket.WriteBit(BpayStoreEnabled); _worldPacket.WriteBit(BpayStoreAvailable); _worldPacket.WriteBit(BpayStoreDisabledByParentalControls); _worldPacket.WriteBit(ItemRestorationButtonEnabled); _worldPacket.WriteBit(BrowserEnabled); - _worldPacket.WriteBit(SessionAlert.is_initialized()); + _worldPacket.WriteBit(SessionAlert.has_value()); _worldPacket.WriteBit(RAFSystem.Enabled); _worldPacket.WriteBit(RAFSystem.RecruitingEnabled); _worldPacket.WriteBit(CharUndeleteEnabled); @@ -173,7 +173,7 @@ WorldPacket const* FeatureSystemStatusGlueScreen::Write() _worldPacket.WriteBit(LiveRegionAccountCopyEnabled); _worldPacket.WriteBit(LiveRegionKeyBindingsCopyEnabled); _worldPacket.WriteBit(Unknown901CheckoutRelated); - _worldPacket.WriteBit(EuropaTicketSystemStatus.is_initialized()); + _worldPacket.WriteBit(EuropaTicketSystemStatus.has_value()); _worldPacket.FlushBits(); if (EuropaTicketSystemStatus) diff --git a/src/server/game/Server/Packets/TaxiPackets.cpp b/src/server/game/Server/Packets/TaxiPackets.cpp index a1810c443d..c0075bc111 100644 --- a/src/server/game/Server/Packets/TaxiPackets.cpp +++ b/src/server/game/Server/Packets/TaxiPackets.cpp @@ -33,13 +33,13 @@ WorldPacket const* WorldPackets::Taxi::TaxiNodeStatus::Write() WorldPacket const* WorldPackets::Taxi::ShowTaxiNodes::Write() { - _worldPacket.WriteBit(WindowInfo.is_initialized()); + _worldPacket.WriteBit(WindowInfo.has_value()); _worldPacket.FlushBits(); _worldPacket << uint32(CanLandNodes.size()); _worldPacket << uint32(CanUseNodes.size()); - if (WindowInfo.is_initialized()) + if (WindowInfo.has_value()) { _worldPacket << WindowInfo->UnitGUID; _worldPacket << uint32(WindowInfo->CurrentNode); diff --git a/src/server/game/Server/Packets/TicketPackets.cpp b/src/server/game/Server/Packets/TicketPackets.cpp index ec29dcf20c..b9c3c79760 100644 --- a/src/server/game/Server/Packets/TicketPackets.cpp +++ b/src/server/game/Server/Packets/TicketPackets.cpp @@ -76,11 +76,11 @@ void WorldPackets::Ticket::SubmitUserFeedback::Read() } } -WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLine::SupportTicketChatLine(time_t timestamp, std::string const& text) : +WorldPackets::Ticket::SupportTicketChatLine::SupportTicketChatLine(time_t timestamp, std::string const& text) : Timestamp(timestamp), Text(text) { } -ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLine& line) +ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketChatLine& line) { data >> line.Timestamp; line.Text = data.ReadString(data.ReadBits(12)); @@ -88,12 +88,12 @@ ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubm return data; } -WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLine::SupportTicketChatLine(ByteBuffer& data) +WorldPackets::Ticket::SupportTicketChatLine::SupportTicketChatLine(ByteBuffer& data) { data >> *this; } -ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLog& chatlog) +ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketChatLog& chatlog) { uint32 linesCount = data.read(); bool hasReportLineIndex = data.ReadBit(); @@ -108,7 +108,7 @@ ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubm return data; } -ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketHorusChatLine& line) +ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketHorusChatLine& line) { data >> line.Timestamp; data >> line.AuthorGUID; @@ -124,13 +124,13 @@ ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubm if (hasChannelGUID) { - line.ChannelGUID = boost::in_place(); + line.ChannelGUID.emplace(); data >> *line.ChannelGUID; } if (hasRealmAddress) { - line.RealmAddress = boost::in_place(); + line.RealmAddress.emplace(); data >> line.RealmAddress->VirtualRealmAddress; data >> line.RealmAddress->field_4; data >> line.RealmAddress->field_6; @@ -144,12 +144,12 @@ ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubm return data; } -WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketHorusChatLine::SupportTicketHorusChatLine(ByteBuffer& data) +WorldPackets::Ticket::SupportTicketHorusChatLine::SupportTicketHorusChatLine(ByteBuffer& data) { data >> *this; } -ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketHorusChatLog& chatlog) +ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketHorusChatLog& chatlog) { uint32 linesCount = data.read(); data.ResetBitPos(); @@ -160,9 +160,9 @@ ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubm return data; } -ByteBuffer& operator>>(ByteBuffer& data, Optional& mail) +ByteBuffer& operator>>(ByteBuffer& data, Optional& mail) { - mail = boost::in_place(); + mail.emplace(); data >> mail->MailID; uint32 bodyLength = data.ReadBits(13); @@ -173,9 +173,9 @@ ByteBuffer& operator>>(ByteBuffer& data, Optional>(ByteBuffer& data, Optional& event) +ByteBuffer& operator>>(ByteBuffer& data, Optional& event) { - event = boost::in_place(); + event.emplace(); data >> event->EventID; data >> event->InviteID; @@ -184,9 +184,9 @@ ByteBuffer& operator>>(ByteBuffer& data, Optional>(ByteBuffer& data, Optional& pet) +ByteBuffer& operator>>(ByteBuffer& data, Optional& pet) { - pet = boost::in_place(); + pet.emplace(); data >> pet->PetID; pet->PetName = data.ReadString(data.ReadBits(8)); @@ -194,9 +194,9 @@ ByteBuffer& operator>>(ByteBuffer& data, Optional>(ByteBuffer& data, Optional& guild) +ByteBuffer& operator>>(ByteBuffer& data, Optional& guild) { - guild = boost::in_place(); + guild.emplace(); uint32 nameLength = data.ReadBits(7); data >> guild->GuildID; @@ -205,9 +205,9 @@ ByteBuffer& operator>>(ByteBuffer& data, Optional>(ByteBuffer& data, Optional& lfgListSearchResult) +ByteBuffer& operator>>(ByteBuffer& data, Optional& lfgListSearchResult) { - lfgListSearchResult = boost::in_place(); + lfgListSearchResult.emplace(); data >> lfgListSearchResult->RideTicket; data >> lfgListSearchResult->GroupFinderActivityID; @@ -228,9 +228,9 @@ ByteBuffer& operator>>(ByteBuffer& data, Optional>(ByteBuffer& data, Optional& lfgListApplicant) +ByteBuffer& operator>>(ByteBuffer& data, Optional& lfgListApplicant) { - lfgListApplicant = boost::in_place(); + lfgListApplicant.emplace(); data >> lfgListApplicant->RideTicket; lfgListApplicant->Comment = data.ReadString(data.ReadBits(9)); @@ -238,9 +238,9 @@ ByteBuffer& operator>>(ByteBuffer& data, Optional>(ByteBuffer& data, Optional& clubInfo) +ByteBuffer& operator>>(ByteBuffer& data, Optional& clubInfo) { - clubInfo = boost::in_place(); + clubInfo.emplace(); data >> clubInfo->ClubFinderPostingID; data >> clubInfo->ClubID; @@ -250,9 +250,9 @@ ByteBuffer& operator>>(ByteBuffer& data, Optional>(ByteBuffer& data, Optional& unused) +ByteBuffer& operator>>(ByteBuffer& data, Optional& unused) { - unused = boost::in_place(); + unused.emplace(); uint32 field_0Length = data.ReadBits(7); data >> unused->field_104; @@ -283,7 +283,7 @@ void WorldPackets::Ticket::SupportTicketSubmitComplaint::Read() if (hasClubMessage) { - CommunityMessage = boost::in_place(); + CommunityMessage.emplace(); CommunityMessage->IsPlayerUsingVoice = _worldPacket.ReadBit(); _worldPacket.ResetBitPos(); } diff --git a/src/server/game/Server/Packets/TicketPackets.h b/src/server/game/Server/Packets/TicketPackets.h index 9982d60da6..db82d3af91 100644 --- a/src/server/game/Server/Packets/TicketPackets.h +++ b/src/server/game/Server/Packets/TicketPackets.h @@ -104,114 +104,114 @@ namespace WorldPackets bool IsSuggestion = false; }; + struct SupportTicketChatLine + { + SupportTicketChatLine(ByteBuffer& data); + SupportTicketChatLine(time_t timestamp, std::string const& text); + + WorldPackets::Timestamp<> Timestamp; + std::string Text; + }; + + struct SupportTicketChatLog + { + std::vector Lines; + Optional ReportLineIndex; + }; + + struct SupportTicketHorusChatLine + { + SupportTicketHorusChatLine(ByteBuffer& data); + + struct SenderRealm + { + uint32 VirtualRealmAddress; + uint16 field_4; + uint8 field_6; + }; + + WorldPackets::Timestamp<> Timestamp; + ObjectGuid AuthorGUID; + Optional ClubID; + Optional ChannelGUID; + Optional RealmAddress; + Optional SlashCmd; + std::string Text; + }; + + struct SupportTicketHorusChatLog + { + std::vector Lines; + }; + + struct SupportTicketMailInfo + { + int32 MailID = 0; + std::string MailSubject; + std::string MailBody; + }; + + struct SupportTicketCalendarEventInfo + { + uint64 EventID = 0; + uint64 InviteID = 0; + std::string EventTitle; + }; + + struct SupportTicketPetInfo + { + ObjectGuid PetID; + std::string PetName; + }; + + struct SupportTicketGuildInfo + { + ObjectGuid GuildID; + std::string GuildName; + }; + + struct SupportTicketLFGListSearchResult + { + WorldPackets::LFG::RideTicket RideTicket; + uint32 GroupFinderActivityID = 0; + ObjectGuid LastTitleAuthorGuid; + ObjectGuid LastDescriptionAuthorGuid; + ObjectGuid LastVoiceChatAuthorGuid; + ObjectGuid ListingCreatorGuid; + ObjectGuid Unknown735; + std::string Title; + std::string Description; + std::string VoiceChat; + }; + + struct SupportTicketLFGListApplicant + { + WorldPackets::LFG::RideTicket RideTicket; + std::string Comment; + }; + + struct SupportTicketCommunityMessage + { + bool IsPlayerUsingVoice = false; + }; + + struct SupportTicketClubFinderResult + { + uint64 ClubFinderPostingID = 0; + uint64 ClubID = 0; + ObjectGuid ClubFinderGUID; + std::string ClubName; + }; + + struct SupportTicketUnused910 + { + std::string field_0; + ObjectGuid field_104; + }; + class SupportTicketSubmitComplaint final : public ClientPacket { public: - struct SupportTicketChatLine - { - SupportTicketChatLine(ByteBuffer& data); - SupportTicketChatLine(time_t timestamp, std::string const& text); - - WorldPackets::Timestamp<> Timestamp; - std::string Text; - }; - - struct SupportTicketChatLog - { - std::vector Lines; - Optional ReportLineIndex; - }; - - struct SupportTicketHorusChatLine - { - SupportTicketHorusChatLine(ByteBuffer& data); - - struct SenderRealm - { - uint32 VirtualRealmAddress; - uint16 field_4; - uint8 field_6; - }; - - WorldPackets::Timestamp<> Timestamp; - ObjectGuid AuthorGUID; - Optional ClubID; - Optional ChannelGUID; - Optional RealmAddress; - Optional SlashCmd; - std::string Text; - }; - - struct SupportTicketHorusChatLog - { - std::vector Lines; - }; - - struct SupportTicketMailInfo - { - int32 MailID = 0; - std::string MailSubject; - std::string MailBody; - }; - - struct SupportTicketCalendarEventInfo - { - uint64 EventID = 0; - uint64 InviteID = 0; - std::string EventTitle; - }; - - struct SupportTicketPetInfo - { - ObjectGuid PetID; - std::string PetName; - }; - - struct SupportTicketGuildInfo - { - ObjectGuid GuildID; - std::string GuildName; - }; - - struct SupportTicketLFGListSearchResult - { - WorldPackets::LFG::RideTicket RideTicket; - uint32 GroupFinderActivityID = 0; - ObjectGuid LastTitleAuthorGuid; - ObjectGuid LastDescriptionAuthorGuid; - ObjectGuid LastVoiceChatAuthorGuid; - ObjectGuid ListingCreatorGuid; - ObjectGuid Unknown735; - std::string Title; - std::string Description; - std::string VoiceChat; - }; - - struct SupportTicketLFGListApplicant - { - WorldPackets::LFG::RideTicket RideTicket; - std::string Comment; - }; - - struct SupportTicketCommunityMessage - { - bool IsPlayerUsingVoice = false; - }; - - struct SupportTicketClubFinderResult - { - uint64 ClubFinderPostingID = 0; - uint64 ClubID = 0; - ObjectGuid ClubFinderGUID; - std::string ClubName; - }; - - struct SupportTicketUnused910 - { - std::string field_0; - ObjectGuid field_104; - }; - SupportTicketSubmitComplaint(WorldPacket&& packet) : ClientPacket(CMSG_SUPPORT_TICKET_SUBMIT_COMPLAINT, std::move(packet)) { } void Read() override; diff --git a/src/server/game/Server/Packets/TradePackets.cpp b/src/server/game/Server/Packets/TradePackets.cpp index 54d3dff957..7a92246ab6 100644 --- a/src/server/game/Server/Packets/TradePackets.cpp +++ b/src/server/game/Server/Packets/TradePackets.cpp @@ -82,7 +82,7 @@ WorldPacket const* WorldPackets::Trade::TradeStatus::Write() return &_worldPacket; } -ByteBuffer& operator<<(ByteBuffer& buffer, WorldPackets::Trade::TradeUpdated::UnwrappedTradeItem const& unwrappedTradeItem) +ByteBuffer& operator<<(ByteBuffer& buffer, WorldPackets::Trade::UnwrappedTradeItem const& unwrappedTradeItem) { buffer << int32(unwrappedTradeItem.EnchantID); buffer << int32(unwrappedTradeItem.OnUseEnchantmentID); @@ -100,13 +100,13 @@ ByteBuffer& operator<<(ByteBuffer& buffer, WorldPackets::Trade::TradeUpdated::Un return buffer; } -ByteBuffer& operator<<(ByteBuffer& buffer, WorldPackets::Trade::TradeUpdated::TradeItem const& tradeItem) +ByteBuffer& operator<<(ByteBuffer& buffer, WorldPackets::Trade::TradeItem const& tradeItem) { buffer << uint8(tradeItem.Slot); buffer << uint32(tradeItem.StackCount); buffer << tradeItem.GiftCreator; buffer << tradeItem.Item; - buffer.WriteBit(tradeItem.Unwrapped.is_initialized()); + buffer.WriteBit(tradeItem.Unwrapped.has_value()); buffer.FlushBits(); if (tradeItem.Unwrapped) buffer << *tradeItem.Unwrapped; diff --git a/src/server/game/Server/Packets/TradePackets.h b/src/server/game/Server/Packets/TradePackets.h index bea82a02d2..44fc6497b8 100644 --- a/src/server/game/Server/Packets/TradePackets.h +++ b/src/server/game/Server/Packets/TradePackets.h @@ -150,31 +150,31 @@ namespace WorldPackets bool PartnerIsSameBnetAccount = false; }; + struct UnwrappedTradeItem + { + WorldPackets::Item::ItemInstance Item; + int32 EnchantID = 0; + int32 OnUseEnchantmentID = 0; + ObjectGuid Creator; + int32 Charges = 0; + bool Lock = false; + uint32 MaxDurability = 0; + uint32 Durability = 0; + std::vector Gems; + }; + + struct TradeItem + { + uint8 Slot = 0; + Item::ItemInstance Item; + int32 StackCount = 0; + ObjectGuid GiftCreator; + Optional Unwrapped; + }; + class TradeUpdated final : public ServerPacket { public: - struct UnwrappedTradeItem - { - WorldPackets::Item::ItemInstance Item; - int32 EnchantID = 0; - int32 OnUseEnchantmentID = 0; - ObjectGuid Creator; - int32 Charges = 0; - bool Lock = false; - uint32 MaxDurability = 0; - uint32 Durability = 0; - std::vector Gems; - }; - - struct TradeItem - { - uint8 Slot = 0; - Item::ItemInstance Item; - int32 StackCount = 0; - ObjectGuid GiftCreator; - Optional Unwrapped; - }; - TradeUpdated() : ServerPacket(SMSG_TRADE_UPDATED, 8 + 4 + 1 + 4 + 7 * sizeof(UnwrappedTradeItem) + 4 + 4 + 4 + 4) { } WorldPacket const* Write() override; diff --git a/src/server/game/Server/Packets/WhoPackets.cpp b/src/server/game/Server/Packets/WhoPackets.cpp index 4add305e71..ad1404fb8c 100644 --- a/src/server/game/Server/Packets/WhoPackets.cpp +++ b/src/server/game/Server/Packets/WhoPackets.cpp @@ -42,7 +42,7 @@ ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Who::WhoWord& word) ByteBuffer& operator>>(ByteBuffer& data, Optional& serverInfo) { - serverInfo = boost::in_place(); + serverInfo.emplace(); data >> serverInfo->FactionGroup; data >> serverInfo->Locale; diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index dbe867b142..cc3cb08326 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -967,7 +967,7 @@ class TC_GAME_API WorldSession void SendNotification(char const* format, ...) ATTR_PRINTF(2, 3); void SendNotification(uint32 stringId, ...); - void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName *declinedName); + void SendPetNameInvalid(uint32 error, std::string const& name, Optional const& declinedName); void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0); void SendQueryTimeResponse(); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 3b39f084c5..5af4acd848 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -228,11 +228,9 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo if (remove) return; - auraInfo.AuraData = boost::in_place(); - Aura const* aura = GetBase(); - WorldPackets::Spells::AuraDataInfo& auraData = auraInfo.AuraData.get(); + WorldPackets::Spells::AuraDataInfo& auraData = auraInfo.AuraData.emplace(); auraData.CastID = aura->GetCastId(); auraData.SpellID = aura->GetId(); auraData.Visual = aura->GetSpellVisual(); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 53213475be..1a4d6c373d 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3049,7 +3049,7 @@ void Spell::DoSpellEffectHit(Unit* unit, SpellEffectInfo const& spellEffectInfo, } } else - hitInfo.AuraDuration = m_spellValue->Duration.get(); + hitInfo.AuraDuration = *m_spellValue->Duration; if (hitInfo.AuraDuration != hitInfo.HitAura->GetMaxDuration()) { @@ -3750,7 +3750,7 @@ void Spell::handle_immediate() m_caster->ModSpellDurationTime(m_spellInfo, duration, this); } else - duration = m_spellValue->Duration.get(); + duration = *m_spellValue->Duration; m_channeledDuration = duration; SendChannelStart(duration); @@ -4900,7 +4900,7 @@ void Spell::SendChannelStart(uint32 duration) if (schoolImmunityMask || mechanicImmunityMask) { - spellChannelStart.InterruptImmunities = boost::in_place(); + spellChannelStart.InterruptImmunities.emplace(); spellChannelStart.InterruptImmunities->SchoolImmunities = schoolImmunityMask; spellChannelStart.InterruptImmunities->Immunities = mechanicImmunityMask; } @@ -7516,7 +7516,7 @@ void Spell::DelayedChannel() bool Spell::HasPowerTypeCost(Powers power) const { - return GetPowerTypeCostAmount(power).is_initialized(); + return GetPowerTypeCostAmount(power).has_value(); } Optional Spell::GetPowerTypeCostAmount(Powers power) const diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 8ddd457452..0008fedf2d 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3937,7 +3937,7 @@ void Spell::EffectCharge() Optional spellEffectExtraData; if (effectInfo->MiscValueB) { - spellEffectExtraData = boost::in_place(); + spellEffectExtraData.emplace(); spellEffectExtraData->Target = unitTarget->GetGUID(); spellEffectExtraData->SpellVisualId = effectInfo->MiscValueB; } @@ -3949,7 +3949,7 @@ void Spell::EffectCharge() if (G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) && m_spellInfo->HasAttribute(SPELL_ATTR9_SPECIAL_DELAY_CALCULATION)) speed = pos.GetExactDist(m_caster) / speed; - unitCaster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed, EVENT_CHARGE, false, unitTarget, spellEffectExtraData.get_ptr()); + unitCaster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed, EVENT_CHARGE, false, unitTarget, spellEffectExtraData ? &*spellEffectExtraData : nullptr); } else { @@ -3959,7 +3959,7 @@ void Spell::EffectCharge() speed = Position(pos.x, pos.y, pos.z).GetExactDist(m_caster) / speed; } - unitCaster->GetMotionMaster()->MoveCharge(*m_preGeneratedPath, speed, unitTarget, spellEffectExtraData.get_ptr()); + unitCaster->GetMotionMaster()->MoveCharge(*m_preGeneratedPath, speed, unitTarget, spellEffectExtraData ? &*spellEffectExtraData : nullptr); } } @@ -5784,7 +5784,9 @@ void Spell::EffectJumpCharge() effectExtra->ParabolicCurveId = *params->ParabolicCurveId; } - unitCaster->GetMotionMaster()->MoveJumpWithGravity(*destTarget, speed, params->JumpGravity, EVENT_JUMP, false, arrivalCast.get_ptr(), effectExtra.get_ptr()); + unitCaster->GetMotionMaster()->MoveJumpWithGravity(*destTarget, speed, params->JumpGravity, EVENT_JUMP, false, + arrivalCast ? &*arrivalCast : nullptr, + effectExtra ? &*effectExtra : nullptr); } void Spell::EffectLearnTransmogSet() diff --git a/src/server/game/Support/SupportMgr.h b/src/server/game/Support/SupportMgr.h index b49150cef6..f1a141c747 100644 --- a/src/server/game/Support/SupportMgr.h +++ b/src/server/game/Support/SupportMgr.h @@ -49,7 +49,7 @@ enum SupportSpamType SUPPORT_SPAM_TYPE_CALENDAR = 2 }; -using ChatLog = WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLog; +using ChatLog = WorldPackets::Ticket::SupportTicketChatLog; class TC_GAME_API Ticket { diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 5f5a0caf3e..3ec810f5c4 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -171,10 +171,10 @@ public: handler->SetSentErrorMessage(true); return false; case 1: - sWorld->SetForcedWarModeFactionBalanceState(TEAM_ALLIANCE, rewardValue.get_value_or(0)); + sWorld->SetForcedWarModeFactionBalanceState(TEAM_ALLIANCE, rewardValue.value_or(0)); break; case 2: - sWorld->SetForcedWarModeFactionBalanceState(TEAM_HORDE, rewardValue.get_value_or(0)); + sWorld->SetForcedWarModeFactionBalanceState(TEAM_HORDE, rewardValue.value_or(0)); break; case 3: sWorld->SetForcedWarModeFactionBalanceState(TEAM_NEUTRAL); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 4365dac157..74e72322b9 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -1078,7 +1078,7 @@ class spell_pal_righteous_protector : public AuraScript else _baseHolyPowerCost.reset(); - return _baseHolyPowerCost.is_initialized(); + return _baseHolyPowerCost.has_value(); } void HandleEffectProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/) diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index da374f536d..3ba959a866 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -91,7 +91,7 @@ Optional GetFinishingMoveCPCost(Spell const* spell) * A finishing move is a spell that cost combo points */ bool IsFinishingMove(Spell const* spell) { - return GetFinishingMoveCPCost(spell).is_initialized(); + return GetFinishingMoveCPCost(spell).has_value(); } // 53 - Backstab