// LordHavoc: rewrote this file, it was really bad code
void RubbleLimit(string cname, float limit, void() deleteproc)
-{
+{SELFPARAM();
entity e;
entity oldest;
- entity oldself;
float c;
float oldesttime;
- oldself = self;
-
// remove rubble of the same type if it's at the limit
// remove multiple rubble if the limit has been decreased
while(1)
break;
// delete this oldest one and search again
- self = oldest;
- deleteproc();
- self = oldself;
+ WITH(entity, self, oldest, deleteproc());
}
}
entity RubbleNew(string cname)
{
- entity e;
// spawn a new entity and return it
- e = spawn();
+ entity e = spawn();
e.classname = cname;
e.creationtime = time;
return e;