Rubble: move to qc effects
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 5 Nov 2015 21:40:55 +0000 (08:40 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 5 Nov 2015 21:40:55 +0000 (08:40 +1100)
qcsrc/client/progs.inc
qcsrc/client/rubble.qc [deleted file]
qcsrc/client/rubble.qh [deleted file]
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/rubble.qh [new file with mode: 0644]

index e2cd0d6..4e12791 100644 (file)
@@ -13,7 +13,6 @@
 #include "miscfunctions.qc"
 #include "movelib.qc"
 #include "player_skeleton.qc"
-#include "rubble.qc"
 #include "scoreboard.qc"
 #include "shownames.qc"
 #include "teamradar.qc"
diff --git a/qcsrc/client/rubble.qc b/qcsrc/client/rubble.qc
deleted file mode 100644 (file)
index 3a0d343..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "rubble.qh"
-
-// LordHavoc: rewrote this file, it was really bad code
-
-void RubbleLimit(string cname, float limit, void() deleteproc)
-{SELFPARAM();
-       entity e;
-       entity oldest;
-       float c;
-       float oldesttime;
-
-       // remove rubble of the same type if it's at the limit
-       // remove multiple rubble if the limit has been decreased
-       while(1)
-       {
-               e = findchain(classname,cname);
-               if (e == world)
-                       break;
-               // walk the list and count the entities, find the oldest
-               // initialize our search with the first entity
-               c = 1;
-               oldest = e;
-               oldesttime = e.creationtime;
-               e = e.chain;
-               // compare to all other matching entities
-               while (e)
-               {
-                       c = c + 1;
-                       if (oldesttime > e.creationtime)
-                       {
-                               oldesttime = e.creationtime;
-                               oldest = e;
-                       }
-                       e = e.chain;
-               }
-
-               // stop if there are less than the limit already
-               if (c <= limit)
-                       break;
-
-               // delete this oldest one and search again
-               WITH(entity, self, oldest, deleteproc());
-       }
-}
-
-entity RubbleNew(string cname)
-{
-       // spawn a new entity and return it
-       entity e = spawn();
-       e.classname = cname;
-       e.creationtime = time;
-       return e;
-}
diff --git a/qcsrc/client/rubble.qh b/qcsrc/client/rubble.qh
deleted file mode 100644 (file)
index 9441168..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef CLIENT_RUBBLE_H
-#define CLIENT_RUBBLE_H
-entityclass(Rubble);
-class(Rubble) .float creationtime;
-void RubbleLimit(string cname, float limit, void() deleteproc);
-entity RubbleNew(string cname);
-#endif
index e79300c..815555d 100644 (file)
@@ -4,7 +4,7 @@
 
 #ifdef CSQC
 #include "../../movetypes/movetypes.qh"
-#include "../../../client/rubble.qh"
+#include "rubble.qh"
 #endif
 
 REGISTER_NET_TEMP(casings)
diff --git a/qcsrc/common/effects/qc/rubble.qh b/qcsrc/common/effects/qc/rubble.qh
new file mode 100644 (file)
index 0000000..1a7cad8
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef RUBBLE_H
+#define RUBBLE_H
+
+#ifdef CSQC
+
+entityclass(Rubble);
+class(Rubble).float creationtime;
+
+void RubbleLimit(string cname, float limit, void() deleteproc)
+{
+       SELFPARAM();
+       entity e;
+       entity oldest;
+       float c;
+       float oldesttime;
+
+       // remove rubble of the same type if it's at the limit
+       // remove multiple rubble if the limit has been decreased
+       while (1)
+       {
+               e = findchain(classname, cname);
+               if (e == world) break;
+               // walk the list and count the entities, find the oldest
+               // initialize our search with the first entity
+               c = 1;
+               oldest = e;
+               oldesttime = e.creationtime;
+               e = e.chain;
+               // compare to all other matching entities
+               while (e)
+               {
+                       c = c + 1;
+                       if (oldesttime > e.creationtime)
+                       {
+                               oldesttime = e.creationtime;
+                               oldest = e;
+                       }
+                       e = e.chain;
+               }
+
+               // stop if there are less than the limit already
+               if (c <= limit) break;
+
+               // delete this oldest one and search again
+               WITH(entity, self, oldest, deleteproc());
+       }
+}
+
+entity RubbleNew(string cname)
+{
+       // spawn a new entity and return it
+       entity e = spawn();
+       e.classname = cname;
+       e.creationtime = time;
+       return e;
+}
+
+#endif
+
+#endif