]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/notifications/all.qc
Merge branch 'master' into terencehill/scoreboard_panel_2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / notifications / all.qc
index e52e9de0971f10c73ec9e42685a52d541df465a3..d1aa1dbf96deaabea08599cdad263c8ae8c3c8a9 100644 (file)
@@ -43,7 +43,7 @@ string Notification_CheckArgs(
                case NOTIF_ALL:
                {
                        if (client) {
-                               return "Entity provided when world was required!";
+                               return "Entity provided when NULL was required!";
                        }
                        break;
                }
@@ -153,7 +153,7 @@ void Destroy_Notification_Entity(entity notif)
        if (notif.nent_icon != "") strunzone(notif.nent_icon);
        if (notif.nent_durcnt != "") strunzone(notif.nent_durcnt);
        if (notif.nent_string != "") strunzone(notif.nent_string);
-       remove(notif);
+       delete(notif);
 }
 
 void Destroy_All_Notifications()
@@ -758,14 +758,14 @@ void Create_Notification_Entity_Choice(entity notif,
 
 // used by MSG_CHOICE to build list of choices
 #ifdef SVQC
-void Notification_GetCvars()
+void Notification_GetCvars(entity this)
 {
-       int idx = 0;
        FOREACH(Notifications, it.nent_type == MSG_CHOICE, {
                GetCvars_handleFloat(
+                       this,
                        get_cvars_s,
                        get_cvars_f,
-                       msg_choice_choices[idx++],
+                       msg_choice_choices[it.nent_choice_idx],
                        sprintf("notification_%s", it.nent_name)
                );
        });
@@ -1086,7 +1086,7 @@ void Local_Notification_sound(
                #ifdef NOTIFICATIONS_DEBUG
                Debug_Notification(sprintf(
                        (
-                               "Local_Notification_sound(world, %f, '%s', %f, %f) "
+                               "Local_Notification_sound(NULL, %f, '%s', %f, %f) "
                                "^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', timediff: %f, limit: %f\n"
                         ),
                        soundchannel,
@@ -1479,9 +1479,8 @@ NET_HANDLE(ENT_CLIENT_NOTIFICATION, bool is_new)
 #endif
 
 #ifdef SVQC
-void Net_Notification_Remove()
+void Net_Notification_Remove(entity this)
 {
-       SELFPARAM();
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
                "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
@@ -1492,7 +1491,7 @@ void Net_Notification_Remove()
        ));
        #endif
        for (int i = 0; i < this.nent_stringcount; ++i) { if (this.nent_strings[i]) strunzone(this.nent_strings[i]); }
-       remove(this);
+       delete(this);
 }
 
 bool Net_Write_Notification(entity this, entity client, int sf)
@@ -1548,6 +1547,7 @@ void Send_Notification(
        MSG net_type, Notification net_name,
        ...count)
 {
+    if (broadcast != NOTIF_ALL && broadcast != NOTIF_ALL_EXCEPT && !IS_REAL_CLIENT(client)) return;
        entity notif = net_name;
        string parms = sprintf("%s, '%s', %s, %s",
                Get_Notif_BroadcastName(broadcast),
@@ -1681,8 +1681,7 @@ void Send_Notification(
        }
        else
        {
-               entity net_notif = new(net_notification);
-               make_pure(net_notif);
+               entity net_notif = new_pure(net_notification);
                net_notif.owner = notif;
                net_notif.nent_broadcast = broadcast;
                net_notif.nent_client = client;
@@ -1698,7 +1697,7 @@ void Send_Notification(
                        net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float);
                }
 
-               net_notif.think = Net_Notification_Remove;
+               setthink(net_notif, Net_Notification_Remove);
                net_notif.nextthink = (time > autocvar_notification_lifetime_mapload)
                        ? (time + autocvar_notification_lifetime_runtime)
                        : autocvar_notification_lifetime_mapload;