Skip to content

Commit 6dcd7e7

Browse files
committed
Switch to using GUID as hashmap key
1 parent 1fef70b commit 6dcd7e7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

ElunaEventMgr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ ElunaEventProcessor* EventMgr::GetGlobalProcessor(GlobalEventSpace space)
234234

235235
uint64 EventMgr::CreateObjectProcessor(WorldObject* obj)
236236
{
237-
uint64 id = nextProcessorId++;
237+
uint64 id = obj->GetGUID().GetRawValue();
238238
auto proc = std::make_unique<ElunaEventProcessor>(E, obj);
239239
ElunaEventProcessor* raw = proc.get();
240240

@@ -247,7 +247,7 @@ uint64 EventMgr::CreateObjectProcessor(WorldObject* obj)
247247
ElunaEventProcessor* EventMgr::GetObjectProcessor(uint64 processorId)
248248
{
249249
auto it = objectProcessors.find(processorId);
250-
return it == objectProcessors.end() ? nullptr : it->second.get();
250+
return (it != objectProcessors.end()) ? it->second.get() : nullptr;
251251
}
252252

253253
void EventMgr::FlagObjectProcessorForDeletion(uint64 processorId)

ElunaEventMgr.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ class ElunaProcessorInfo
125125
{
126126
public:
127127
ElunaProcessorInfo(EventMgr* mgr, uint64 processorId)
128-
: mgr(mgr), processorId(processorId) {
128+
: mgr(mgr), processorId(processorId)
129+
{
129130
}
130131

131132
~ElunaProcessorInfo();
@@ -166,8 +167,6 @@ class EventMgr
166167

167168
Eluna* E;
168169

169-
uint64 nextProcessorId = 1; // internal ID generator
170-
171170
void CleanupObjectProcessors();
172171

173172
friend class ElunaEventProcessor;

0 commit comments

Comments
 (0)