]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/effects/qc/rubble.qh
Merge branch 'Mario/infinite_ammo_start' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / effects / qc / rubble.qh
index 83a6941213d627dbeca64e0174cc9e662696310e..eccd11282a46eb76d74e5b5a789b0a33a0a390c8 100644 (file)
@@ -1,47 +1,18 @@
 #pragma once
 
-#ifdef CSQC
-
+#ifdef GAMEQC
 entityclass(Rubble);
-class(Rubble).float creationtime;
+classfield(Rubble).float creationtime;
 
-void RubbleLimit(string cname, float 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
-               FOREACH_ENTITY_CLASS(cname, true,
-               {
-                       ++c;
-                       if(!oldest || oldesttime > it.creationtime)
-                       {
-                               oldest = it;
-                               oldesttime = it.creationtime;
-                       }
-               });
+#ifdef CSQC
+IntrusiveList CasingsNGibs;
+STATIC_INIT(CasingsNGibs) { CasingsNGibs = IL_NEW(); }
+#endif
 
-               // stop if there are less than the limit already
-               if (c <= limit) break;
+void LimitedChildrenRubble(IntrusiveList list, string cname, int limit, void(entity) deleteproc, entity parent);
 
-               // delete this oldest one and search again
-               deleteproc(oldest);
-       }
-}
+entity ReplaceOldListedChildRubble(IntrusiveList list, entity child, entity oldChild);
 
-entity RubbleNew(string cname)
-{
-       // spawn a new entity and return it
-       entity e = spawn();
-       e.classname = cname;
-       e.creationtime = time;
-       return e;
-}
+entity ListNewChildRubble(IntrusiveList list, entity child);
 
 #endif