]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/effects/qc/rubble.qh
Add g_balance_electro_secondary_limit setting to allow controlling the maximum number...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / effects / qc / rubble.qh
index 83f0ce855eda15d8371d10c1c49376bca57d60bb..406d602c145d2359a6dd4d52fa324640f9e0857b 100644 (file)
@@ -1,48 +1,13 @@
 #pragma once
 
-#ifdef CSQC
-
+#ifdef GAMEQC
 entityclass(Rubble);
 classfield(Rubble).float creationtime;
 
 IntrusiveList g_rubble;
 STATIC_INIT(g_rubble) { g_rubble = IL_NEW(); }
 
-void RubbleLimit(string cname, int limit, void(entity) deleteproc)
-{
-       // remove rubble of the same type if it's at the limit
-       // remove multiple rubble if the limit has been decreased
-       while (1)
-       {
-               // walk the list and count the entities, find the oldest
-               // initialize our search with the first entity
-               int c = 0;
-               entity oldest = NULL;
-               float oldesttime = 0;
-               // compare to all other matching entities
-               IL_EACH(g_rubble, it.classname == cname,
-               {
-                       ++c;
-                       if(!oldest || oldesttime > it.creationtime)
-                       {
-                               oldest = it;
-                               oldesttime = it.creationtime;
-                       }
-               });
-
-               // stop if there are less than the limit already
-               if (c <= limit) break;
-
-               // delete this oldest one and search again
-               deleteproc(oldest);
-       }
-}
-
-entity RubbleNew(entity e)
-{
-       e.creationtime = time;
-       IL_PUSH(g_rubble, e);
-       return e;
-}
+void RubbleLimit(string cname, int limit, void(entity) deleteproc);
 
+entity RubbleNew(entity e);
 #endif