Browse Source

core: Dict::RemoveSlot can now directly remove an Entity.

legacy
Sam Hocevar sam 13 years ago
parent
commit
e1d8124983
2 changed files with 14 additions and 0 deletions
  1. +13
    -0
      src/dict.cpp
  2. +1
    -0
      src/dict.h

+ 13
- 0
src/dict.cpp View File

@@ -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)
{


+ 1
- 0
src/dict.h View File

@@ -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);


Loading…
Cancel
Save