mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 03:12:09 +01:00
Core/Misc: Use boost::in_place() to initialize optionals.
* Improves commit 800d5d8939
* Thanks @Shauren for this great suggestion.
This commit is contained in:
@@ -222,7 +222,7 @@ void SpellCastTargets::Write(WorldPackets::Spells::SpellTargetData& data)
|
||||
|
||||
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
|
||||
{
|
||||
data.SrcLocation = WorldPackets::Spells::TargetLocation();
|
||||
data.SrcLocation = boost::in_place();
|
||||
data.SrcLocation->Transport = m_src._transportGUID; // relative position guid here - transport for example
|
||||
if (!m_src._transportGUID.IsEmpty())
|
||||
data.SrcLocation->Location = m_src._transportOffset;
|
||||
@@ -232,7 +232,7 @@ void SpellCastTargets::Write(WorldPackets::Spells::SpellTargetData& data)
|
||||
|
||||
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
{
|
||||
data.DstLocation = WorldPackets::Spells::TargetLocation();
|
||||
data.DstLocation = boost::in_place();
|
||||
data.DstLocation->Transport = m_dst._transportGUID; // relative position guid here - transport for example
|
||||
if (!m_dst._transportGUID.IsEmpty())
|
||||
data.DstLocation->Location = m_dst._transportOffset;
|
||||
@@ -3888,7 +3888,7 @@ void Spell::SendSpellStart()
|
||||
|
||||
if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list
|
||||
{
|
||||
castData.RemainingRunes = WorldPackets::Spells::RuneData();
|
||||
castData.RemainingRunes = boost::in_place();
|
||||
|
||||
//TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
|
||||
//The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster
|
||||
@@ -4006,7 +4006,7 @@ void Spell::SendSpellGo()
|
||||
|
||||
if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list
|
||||
{
|
||||
castData.RemainingRunes = WorldPackets::Spells::RuneData();
|
||||
castData.RemainingRunes = boost::in_place();
|
||||
|
||||
//TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
|
||||
//The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster
|
||||
|
||||
Reference in New Issue
Block a user