]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify announcer queue code
authorz411 <z411@omaera.org>
Sat, 12 Nov 2022 04:39:45 +0000 (01:39 -0300)
committerz411 <z411@omaera.org>
Sat, 12 Nov 2022 04:58:37 +0000 (01:58 -0300)
qcsrc/common/notifications/all.qc

index 8e524c2165c8c42dbac12d54aaaded27e85e7403..557a1b00cabf3aa0577c8a4b5b37f8e878fef96a 100644 (file)
@@ -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];
        }
 }