From 89a159e3c55b771605802d76c125c800cf3dea7b Mon Sep 17 00:00:00 2001 From: TimePath Date: Fri, 6 Nov 2015 08:40:55 +1100 Subject: [PATCH] Rubble: move to qc effects --- qcsrc/client/progs.inc | 1 - qcsrc/client/rubble.qh | 7 ------ qcsrc/common/effects/qc/casings.qc | 2 +- .../rubble.qc => common/effects/qc/rubble.qh} | 25 ++++++++++++------- 4 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 qcsrc/client/rubble.qh rename qcsrc/{client/rubble.qc => common/effects/qc/rubble.qh} (79%) diff --git a/qcsrc/client/progs.inc b/qcsrc/client/progs.inc index e2cd0d689..4e127917a 100644 --- a/qcsrc/client/progs.inc +++ b/qcsrc/client/progs.inc @@ -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.qh b/qcsrc/client/rubble.qh deleted file mode 100644 index 944116802..000000000 --- a/qcsrc/client/rubble.qh +++ /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 diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index e79300cb0..815555df6 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -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/client/rubble.qc b/qcsrc/common/effects/qc/rubble.qh similarity index 79% rename from qcsrc/client/rubble.qc rename to qcsrc/common/effects/qc/rubble.qh index 3a0d3430d..1a7cad850 100644 --- a/qcsrc/client/rubble.qc +++ b/qcsrc/common/effects/qc/rubble.qh @@ -1,9 +1,14 @@ -#include "rubble.qh" +#ifndef RUBBLE_H +#define RUBBLE_H -// LordHavoc: rewrote this file, it was really bad code +#ifdef CSQC + +entityclass(Rubble); +class(Rubble).float creationtime; void RubbleLimit(string cname, float limit, void() deleteproc) -{SELFPARAM(); +{ + SELFPARAM(); entity e; entity oldest; float c; @@ -11,11 +16,10 @@ void RubbleLimit(string cname, float limit, void() deleteproc) // remove rubble of the same type if it's at the limit // remove multiple rubble if the limit has been decreased - while(1) + while (1) { - e = findchain(classname,cname); - if (e == world) - break; + 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; @@ -35,8 +39,7 @@ void RubbleLimit(string cname, float limit, void() deleteproc) } // stop if there are less than the limit already - if (c <= limit) - break; + if (c <= limit) break; // delete this oldest one and search again WITH(entity, self, oldest, deleteproc()); @@ -51,3 +54,7 @@ entity RubbleNew(string cname) e.creationtime = time; return e; } + +#endif + +#endif -- 2.39.2