-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch eluna event processor to unique pointers
- Loading branch information
Showing
2 changed files
with
3 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -940,9 +940,6 @@ void MovementInfo::OutDebug() | |
} | ||
|
||
WorldObject::WorldObject(bool isWorldObject) : Object(), WorldLocation(), LastUsedScriptID(0), | ||
#ifdef ELUNA | ||
elunaEvents(NULL), | ||
#endif | ||
m_movementInfo(), m_name(), m_isActive(false), m_isFarVisible(false), m_isStoredInWorldObjectGridContainer(isWorldObject), m_zoneScript(nullptr), | ||
m_transport(nullptr), m_zoneId(0), m_areaId(0), m_staticFloorZ(VMAP_INVALID_HEIGHT), m_outdoors(false), m_liquidStatus(LIQUID_MAP_NO_WATER), | ||
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 | |
|
||
WorldObject::~WorldObject() | ||
{ | ||
#ifdef ELUNA | ||
delete elunaEvents; | ||
elunaEvents = NULL; | ||
#endif | ||
// this may happen because there are many !create/delete | ||
if (IsStoredInWorldObjectGridContainer() && m_currMap) | ||
{ | ||
|
@@ -1832,19 +1825,9 @@ void WorldObject::SetMap(Map* map) | |
m_mapId = map->GetId(); | ||
m_InstanceId = map->GetInstanceId(); | ||
#ifdef ELUNA | ||
//@todo: possibly look into cleanly clearing all pending events from previous map's event mgr. | ||
|
||
// if multistate, delete elunaEvents and set to nullptr. events shouldn't move across states. | ||
// in single state, the timed events should move across maps | ||
if (!sElunaConfig->IsElunaCompatibilityMode()) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Foereaper
Author
Member
|
||
{ | ||
delete elunaEvents; | ||
elunaEvents = nullptr; // set to null in case map doesn't use eluna | ||
} | ||
|
||
if (Eluna* e = map->GetEluna()) | ||
if (!elunaEvents) | ||
elunaEvents = new ElunaEventProcessor(e, this); | ||
if (!elunaEvents || (elunaEvents && !sElunaConfig->IsElunaCompatibilityMode())) | ||
elunaEvents = std::make_unique<ElunaEventProcessor>(e, this); | ||
#endif | ||
if (IsStoredInWorldObjectGridContainer()) | ||
m_currMap->AddWorldObject(this); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If it is possible for
map->GetEluna()
to return nullptr then this branch should be kept (and changed to just assign nullptr/reset on unique_ptr)