From 4233bc1991d64dc2240a2de48eac7c576e4c6c30 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 7 Jul 2016 13:10:53 +0200 Subject: [PATCH] Clear server notices when they've expired --- qcsrc/common/net_notice.qc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/qcsrc/common/net_notice.qc b/qcsrc/common/net_notice.qc index 1e1726ae4..2dcd618c0 100644 --- a/qcsrc/common/net_notice.qc +++ b/qcsrc/common/net_notice.qc @@ -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; -- 2.39.2