From 554bf506c54248712f98103dd50102c45024c85a Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Thu, 9 Mar 2023 13:16:27 +0200 Subject: [PATCH] fix: player timed events not carrying over between maps (#106) --- src/ElunaLuaEngine_SC.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp index c0408d8..d514fd5 100644 --- a/src/ElunaLuaEngine_SC.cpp +++ b/src/ElunaLuaEngine_SC.cpp @@ -901,16 +901,8 @@ public: void OnWorldObjectSetMap(WorldObject* object, Map* /*map*/) override { - delete object->elunaEvents; - - // On multithread replace this with a pointer to map's Eluna pointer stored in a map - object->elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, object); - } - - void OnWorldObjectResetMap(WorldObject* object) override - { - delete object->elunaEvents; - object->elunaEvents = nullptr; + if (!object->elunaEvents) + object->elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, object); } void OnWorldObjectUpdate(WorldObject* object, uint32 diff) override