]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix the broken stuffz, now notifications are sent properly via client ents
authorSamual Lenks <samual@xonotic.org>
Mon, 4 Feb 2013 04:04:43 +0000 (23:04 -0500)
committerSamual Lenks <samual@xonotic.org>
Mon, 4 Feb 2013 04:04:43 +0000 (23:04 -0500)
qcsrc/common/notifications.qc

index 1e61db13ac10762ff042482a0ac937bc0f14ac73..d31763d91a53c425e693a3e4c3b77c50f0b79fbb 100644 (file)
@@ -318,10 +318,14 @@ void Read_Notification(float is_new)
 #endif
 
 #ifdef SVQC
+void Notification_Remove()
+{
+       float i;
+       for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } }
+       remove(self);
+}
 float Write_Notification(entity client, float sf)
 {
-       print("\n\nWrite_Notification():");
-       eprint(self);
        float i, send = FALSE;
        
        switch(self.nent_broadcast)
@@ -353,8 +357,7 @@ void Send_Notification(float broadcast, entity client, float net_type, float net
        {
                float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
                float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
-               float i, tmp_f;
-               string tmp_s;
+               float i;
 
                dprint("Send_Notification(", ftos(broadcast), ", ", ftos(net_type), ", ", Get_Field_Value(F_NAME, net_type, net_name), strcat(", ", ftos(count), ");\n"));
                dprint("  ^--: stringcount: ", ftos(stringcount), ", floatcount: ", ftos(floatcount), ".\n");
@@ -369,13 +372,13 @@ void Send_Notification(float broadcast, entity client, float net_type, float net
                notif.nent_net_name = net_name;
                notif.nent_stringcount = stringcount;
                notif.nent_floatcount = floatcount; 
-               for(i = 0; i < stringcount; ++i) { tmp_s = ...(i, string); notif.nent_strings[i] = tmp_s; dprint("WriteString(...(", ftos(i), ", string)); - ", tmp_s, "\n"); } 
-               for(i = 0; i < floatcount; ++i) { tmp_f = ...((stringcount + i), float); notif.nent_floats[i] = tmp_f; dprint("WriteLong(...(", ftos((stringcount + i)), ", float)); - ", ftos(tmp_f), "\n"); }
-
-               print("\n\nSend_Notification():");
-               eprint(notif);
+               for(i = 0; i < stringcount; ++i) { notif.nent_strings[i] = strzone(...(i, string)); }
+               for(i = 0; i < floatcount; ++i) { notif.nent_floats[i] = ...((stringcount + i), float); }
+               
+               notif.think = Notification_Remove;
+               notif.nextthink = (time + 0.5); 
 
-               Net_LinkEntity(notif, FALSE, 0.5, Write_Notification);
+               Net_LinkEntity(notif, FALSE, 0, Write_Notification);
 
                if(!server_is_local)
                {