From 8986f3650549d3b642a5a91b71dbaed718c25714 Mon Sep 17 00:00:00 2001 From: z411 Date: Sat, 12 Nov 2022 01:39:45 -0300 Subject: [PATCH] Simplify announcer queue code --- qcsrc/common/notifications/all.qc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index 8e524c216..557a1b00c 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -1214,21 +1214,17 @@ void Local_Notification_Queue_Add(MSG net_type, entity notif, float queue_time) void Local_Notification_Queue_Process() { - if(!notif_queue_length) + if(!notif_queue_length || notif_queue_time[0] > time) return; - int j; - if(notif_queue_time[0] <= time) { - Local_Notification_Queue_Run(notif_queue_type[0], notif_queue_entity[0]); - - // Shift queue to the left - for (j = 0; j < notif_queue_length - 1; j++) { - notif_queue_type[j] = notif_queue_type[j+1]; - notif_queue_entity[j] = notif_queue_entity[j+1]; - notif_queue_time[j] = notif_queue_time[j+1]; - } - - --notif_queue_length; + Local_Notification_Queue_Run(notif_queue_type[0], notif_queue_entity[0]); + + // Shift queue to the left + --notif_queue_length; + for (int j = 0; j < notif_queue_length; j++) { + notif_queue_type[j] = notif_queue_type[j+1]; + notif_queue_entity[j] = notif_queue_entity[j+1]; + notif_queue_time[j] = notif_queue_time[j+1]; } } -- 2.39.2