X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fnotifications%2Fall.qc;h=acd570d0b67aeb7318267717b08ca924e1b7c949;hb=65e9ceb03c81bc515d090a54f65dd620c8c6dc43;hp=ad2013dfa5b9d214128165e81281e345b868b668;hpb=d271f27a5ac351a3a7b39636932f6d661492be1d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index ad2013dfa..acd570d0b 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -1,3 +1,4 @@ +#include "all.qh" #if defined(CSQC) #include #elif defined(MENUQC) @@ -7,8 +8,7 @@ #include #include #include - #include "all.qh" - #include + #include #endif // ================================================ @@ -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() @@ -572,7 +572,7 @@ void Create_Notification_Entity_InfoCenter(entity notif, } else if(icon != "") { - LOG_WARNINGF( + LOG_WARNF( ( "^1NOTIFICATION HAS ICON BUT NO HUDARGS: " "^7net_type = %s, net_name = %s.\n" @@ -589,7 +589,7 @@ void Create_Notification_Entity_InfoCenter(entity notif, if (cpid == CPID_Null && durcnt != "0 0") { - LOG_WARNINGF( + LOG_WARNF( ( "Notification has durcnt but no cpid: " "net_type = %s, net_name = %s." @@ -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, @@ -1210,7 +1210,7 @@ void Local_Notification(MSG net_type, Notification net_name, ...count) Get_Notif_TypeName(net_type) )); #endif - LOG_WARNINGF("Incorrect usage of Local_Notification: %s\n", "Null notification"); + LOG_WARNF("Incorrect usage of Local_Notification: %s", "Null notification"); return; } @@ -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) @@ -1524,7 +1523,7 @@ void Kill_Notification( #endif string checkargs = Notification_CheckArgs(broadcast, client); - if (checkargs != "") { LOG_WARNINGF("Incorrect usage of Kill_Notification: %s", checkargs); return; } + if (checkargs != "") { LOG_WARNF("Incorrect usage of Kill_Notification: %s", checkargs); return; } entity net_notif = new_pure(net_kill_notification); net_notif.nent_broadcast = broadcast; @@ -1562,7 +1561,7 @@ void Send_Notification( if (!notif) { - LOG_WARNING("Send_Notification: Could not find notification entity!"); + LOG_WARN("Send_Notification: Could not find notification entity!"); return; } @@ -1571,7 +1570,7 @@ void Send_Notification( if (!net_name) { checkargs = sprintf("No notification provided! %s", checkargs); } if (checkargs != "") { - LOG_WARNINGF("Incorrect usage of Send_Notification: %s", checkargs); + LOG_WARNF("Incorrect usage of Send_Notification: %s", checkargs); return; } @@ -1595,7 +1594,7 @@ void Send_Notification( if ((notif.nent_stringcount + notif.nent_floatcount) != count) { - LOG_WARNINGF( + LOG_WARNF( "Argument mismatch for Send_Notification(%s, ...)! " "stringcount(%d) + floatcount(%d) != count(%d)\n" "Check the definition and function call for accuracy...?\n", @@ -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;