Core/Objects: Removed type casts before accessing WorldObject::m_Events that became unneccessary after moving it from Unit to WorldObject

This commit is contained in:
Shauren
2025-01-24 18:40:25 +01:00
parent 68b10dcaab
commit bc8874f305
5 changed files with 8 additions and 28 deletions

View File

@@ -333,9 +333,7 @@ void TempSummon::UnSummon(uint32 msTime)
{
if (msTime)
{
ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(Milliseconds(msTime)));
m_Events.AddEventAtOffset(new ForcedDespawnDelayEvent(*this, 0s), Milliseconds(msTime));
return;
}
@@ -358,12 +356,6 @@ void TempSummon::UnSummon(uint32 msTime)
AddObjectToRemoveList();
}
bool ForcedUnsummonDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
m_owner.UnSummon();
return true;
}
void TempSummon::RemoveFromWorld()
{
if (!IsInWorld())

View File

@@ -161,13 +161,4 @@ class TC_GAME_API Puppet : public Minion
void Update(uint32 time) override;
};
class TC_GAME_API ForcedUnsummonDelayEvent : public BasicEvent
{
public:
ForcedUnsummonDelayEvent(TempSummon& owner) : BasicEvent(), m_owner(owner) { }
bool Execute(uint64 e_time, uint32 p_time) override;
private:
TempSummon& m_owner;
};
#endif

View File

@@ -101,7 +101,7 @@ void Totem::UnSummon(uint32 msTime)
{
if (msTime)
{
m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(Milliseconds(msTime)));
m_Events.AddEventAtOffset(new ForcedDespawnDelayEvent(*this, 0s), Milliseconds(msTime));
return;
}

View File

@@ -1025,13 +1025,9 @@ void Aura::DropChargeDelayed(uint32 delay, AuraRemoveMode removeMode)
// aura is already during delayed charge drop
if (m_dropEvent)
return;
// only units have events
Unit* owner = m_owner->ToUnit();
if (!owner)
return;
m_dropEvent = new ChargeDropEvent(this, removeMode);
owner->m_Events.AddEvent(m_dropEvent, owner->m_Events.CalculateTime(Milliseconds(delay)));
m_owner->m_Events.AddEventAtOffset(m_dropEvent, Milliseconds(delay));
}
void Aura::SetStackAmount(uint8 stackAmount)

View File

@@ -243,13 +243,13 @@ class spell_ioc_parachute_ic : public AuraScript
class StartLaunchEvent : public BasicEvent
{
public:
StartLaunchEvent(Position const& pos, ObjectGuid const& guid) : _pos(pos), _guid(guid)
StartLaunchEvent(Map const* map, Position const& pos, ObjectGuid const& guid) : _map(map), _pos(pos), _guid(guid)
{
}
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
{
Player* player = ObjectAccessor::FindPlayer(_guid);
Player* player = ObjectAccessor::GetPlayer(_map, _guid);
if (!player || !player->GetVehicle())
return true;
@@ -263,6 +263,7 @@ class StartLaunchEvent : public BasicEvent
}
private:
Map const* _map;
Position _pos;
ObjectGuid _guid;
};
@@ -272,10 +273,10 @@ class spell_ioc_launch : public SpellScript
{
void Launch()
{
if (!GetCaster()->ToCreature() || !GetExplTargetDest())
if (!GetCaster()->IsCreature() || !GetExplTargetDest())
return;
GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), ASSERT_NOTNULL(GetHitPlayer())->GetGUID()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms));
GetCaster()->m_Events.AddEventAtOffset(new StartLaunchEvent(GetCaster()->GetMap(), *GetExplTargetDest(), GetHitUnit()->GetGUID()), 2500ms);
}
void Register() override