diff --git a/src/dict.cpp b/src/dict.cpp index ce75aeb1..469e0d30 100644 --- a/src/dict.cpp +++ b/src/dict.cpp @@ -134,6 +134,19 @@ void Dict::RemoveSlot(int id) } } +void Dict::RemoveSlot(Entity *entity) +{ + for (int id = 0; id < data->maxid; id++) + if (data->entities[id] == entity) + { + RemoveSlot(id); + return; + } + +#if !LOL_RELEASE + Log::Error("removing unregistered entity %p\n", entity); +#endif +} void Dict::SetEntity(int id, Entity *entity) { diff --git a/src/dict.h b/src/dict.h index 3c94b3e1..a4fc4820 100644 --- a/src/dict.h +++ b/src/dict.h @@ -31,6 +31,7 @@ public: int MakeSlot(char const *name); void RemoveSlot(int id); + void RemoveSlot(Entity *entity); void SetEntity(int id, Entity *entity); Entity *GetEntity(int id);