Core/Misc: replace boost::optional with std::optional

This commit is contained in:
Ovahlord committed 2021-02-19 14:07:43 +01:00
1 parent 44de269fca
commit 0299fa4fe1
38 files changed
+111 -143

No files matched your search

+10 -10
View File
@@ -21,7 +21,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellHealPredicti
{
data << int32(predict.Points);
data << uint8(predict.Type);
if (predict.BeaconGUID.is_initialized())
if (predict.BeaconGUID.has_value())
data << predict.BeaconGUID->WriteAsPacked();
return data;
}
@@ -75,10 +75,10 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData c
{
data << uint32(spellTargetData.Flags);
if (spellTargetData.Unit.is_initialized())
if (spellTargetData.Unit.has_value())
data << spellTargetData.Unit->WriteAsPacked();
if (spellTargetData.Item.is_initialized())
if (spellTargetData.Item.has_value())
data << spellTargetData.Item->WriteAsPacked();
if (spellTargetData.SrcLocation)
@@ -87,7 +87,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData c
if (spellTargetData.DstLocation)
data << *spellTargetData.DstLocation;
if (spellTargetData.Name.is_initialized())
if (spellTargetData.Name.has_value())
data << *spellTargetData.Name;
return data;
@@ -125,7 +125,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con
data << spellCastData.Target;
if (spellCastData.RemainingPower.is_initialized())
if (spellCastData.RemainingPower.has_value())
data << uint32(*spellCastData.RemainingPower);
if (spellCastData.RemainingRunes)
@@ -140,7 +140,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con
if (spellCastData.ProjectileVisuals)
data << *spellCastData.ProjectileVisuals;
if (spellCastData.DestLocSpellCastIndex.is_initialized())
if (spellCastData.DestLocSpellCastIndex.has_value())
data << uint8(*spellCastData.DestLocSpellCastIndex);
// Todo: TARGET_FLAG_EXTRA_TARGETS (unused as it seems though)
@@ -188,11 +188,11 @@ WorldPacket const* WorldPackets::Spells::ChannelStart::Write()
_worldPacket << uint32(SpellID);
_worldPacket << int32(ChannelDuration);
_worldPacket << uint8(InterruptImmunities.is_initialized());
_worldPacket << uint8(InterruptImmunities.has_value());
if (InterruptImmunities)
_worldPacket << *InterruptImmunities;
_worldPacket << uint8(HealPrediction.is_initialized());
_worldPacket << uint8(HealPrediction.has_value());
if (HealPrediction)
_worldPacket << *HealPrediction;
@@ -217,7 +217,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo cons
data << uint8(auraData.Applications);
if (auraData.CastUnit)
data << auraData.CastUnit.get().WriteAsPacked();
data << auraData.CastUnit.value().WriteAsPacked();
if (auraData.Duration)
data << int32(*auraData.Duration);
@@ -226,7 +226,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo cons
data << int32(*auraData.Remaining);
for (uint8 i = 0; i < 3 /*MAX_SPELL_EFFECTS*/; ++i)
if (auraData.Points[i].is_initialized())
if (auraData.Points[i].has_value())
data << int32(*auraData.Points[i]);
return data;