entityclass(Rubble);
class(Rubble).float creationtime;
-void RubbleLimit(string cname, float limit, void() deleteproc)
+void RubbleLimit(string cname, float limit, void(entity) deleteproc)
{
- SELFPARAM();
entity e;
entity oldest;
float c;
while (1)
{
e = findchain(classname, cname);
- if (e == world) break;
+ if (e == NULL) break;
// walk the list and count the entities, find the oldest
// initialize our search with the first entity
c = 1;
if (c <= limit) break;
// delete this oldest one and search again
- WITH(entity, self, oldest, deleteproc());
+ deleteproc(oldest);
}
}