@@ -940,9 +940,6 @@ void MovementInfo::OutDebug()
940
940
}
941
941
942
942
WorldObject::WorldObject (bool isWorldObject) : Object(), WorldLocation(), LastUsedScriptID(0 ),
943
- #ifdef ELUNA
944
- elunaEvents (NULL ),
945
- #endif
946
943
m_movementInfo(), m_name(), m_isActive(false ), m_isFarVisible(false ), m_isStoredInWorldObjectGridContainer(isWorldObject), m_zoneScript(nullptr ),
947
944
m_transport(nullptr ), m_zoneId(0 ), m_areaId(0 ), m_staticFloorZ(VMAP_INVALID_HEIGHT), m_outdoors(false ), m_liquidStatus(LIQUID_MAP_NO_WATER),
948
945
m_currMap(nullptr ), m_InstanceId(0 ), m_phaseMask(PHASEMASK_NORMAL), m_notifyflags(0 )
@@ -953,10 +950,6 @@ m_currMap(nullptr), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_notifyflag
953
950
954
951
WorldObject::~WorldObject ()
955
952
{
956
- #ifdef ELUNA
957
- delete elunaEvents;
958
- elunaEvents = NULL ;
959
- #endif
960
953
// this may happen because there are many !create/delete
961
954
if (IsStoredInWorldObjectGridContainer () && m_currMap)
962
955
{
@@ -1832,19 +1825,9 @@ void WorldObject::SetMap(Map* map)
1832
1825
m_mapId = map->GetId ();
1833
1826
m_InstanceId = map->GetInstanceId ();
1834
1827
#ifdef ELUNA
1835
- // @todo: possibly look into cleanly clearing all pending events from previous map's event mgr.
1836
-
1837
- // if multistate, delete elunaEvents and set to nullptr. events shouldn't move across states.
1838
- // in single state, the timed events should move across maps
1839
- if (!sElunaConfig ->IsElunaCompatibilityMode ())
1840
- {
1841
- delete elunaEvents;
1842
- elunaEvents = nullptr ; // set to null in case map doesn't use eluna
1843
- }
1844
-
1845
1828
if (Eluna* e = map->GetEluna ())
1846
- if (!elunaEvents)
1847
- elunaEvents = new ElunaEventProcessor (e, this );
1829
+ if (!elunaEvents || (elunaEvents && ! sElunaConfig -> IsElunaCompatibilityMode ()) )
1830
+ elunaEvents = std::make_unique< ElunaEventProcessor> (e, this );
1848
1831
#endif
1849
1832
if (IsStoredInWorldObjectGridContainer ())
1850
1833
m_currMap->AddWorldObject (this );
0 commit comments