]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clear server notices when they've expired
authorterencehill <piuntn@gmail.com>
Thu, 7 Jul 2016 11:10:53 +0000 (13:10 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 9 Jul 2016 16:58:46 +0000 (18:58 +0200)
qcsrc/common/net_notice.qc

index 1e1726ae452fe716041d291f30581eb3a1d3cab9..2dcd618c056974211c03ac979b09c22ae8803d12 100644 (file)
@@ -41,24 +41,30 @@ NET_HANDLE(TE_CSQC_SVNOTICE, bool isNew)
        return true;
 }
 entity cl_notices;
-STATIC_INIT(cl_notice)
-{
-    cl_notices = LL_NEW();
-}
 void cl_notice_read()
 {
     entity _notice = new_pure(sv_notice);
     _notice.netname = strzone(ReadString());
     _notice.alpha = ReadLong() + time;
     _notice.skin = ReadByte();
+    if(!cl_notices)
+       cl_notices = LL_NEW();
     LL_PUSH(cl_notices, _notice);
 }
 
 void cl_notice_run()
 {
+       if (!cl_notices)
+               return;
+
     bool flag = false;
     LL_EACH(cl_notices, it.alpha > time, { flag = true; break; });
-    if (!flag) return;
+       if (!flag)
+       {
+               LL_DELETE(cl_notices);
+               return;
+       }
+
     const int M1 = 30;
     const int M2 = 10;