void Call_Notification_Function_With_VarArgs(float stringcount, float floatcount, void func, float net_type, float net_name, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
{
- #define VARLIST(stringc,floatc,args) \
+ #define VARLIST \
VARITEM(1, 0, s1) \
VARITEM(2, 0, XPD2(s1, s2)) \
VARITEM(3, 0, XPD3(s1, s2, s3)) \
VARITEM(4, 4, XPD2(XPD4(s1, s2, s3, s4), XPD4(f1, f2, f3, f4)))
#define VARITEM(stringc,floatc,args) if((stringcount == stringc) && (floatcount == floatc)) { func(net_type, net_name, args); }
- //VARLIST
+ VARLIST
+ #undef VARITEM
}
#ifdef CSQC
#endif
#ifdef SVQC
-void Send_Notification(entity client, float broadcast, float net_type, float net_name, ...count)
+void Send_Notification(entity client, float broadcast, float net_type, float net_name, float f_stringcount, float f_floatcount, ...count)
{
if((broadcast == MSG_BROADCAST || broadcast == MSG_ONE) && net_type && net_name)
{
print("stringcount: ", ftos(stringcount), ", floatcount: ", ftos(floatcount), ".\n");
- if((stringcount + floatcount) > count) { backtrace(strcat("Not enough arguments for notification! We needed ", strcat("stringcount=", ftos(stringcount), " + floatcount=", ftos(floatcount), ","), " but only got total count=", ftos(count), ".\n")); }
- else if((stringcount + floatcount) < count) { backtrace(strcat("Too many arguments for notification! We only needed ", strcat("stringcount=", ftos(stringcount), " + floatcount=", ftos(floatcount), ","), " but got total count=", ftos(count), ".\n")); }
+ if(stringcount != f_stringcount) { backtrace(strcat("Incorrect string arguments for notification! stringcount: ", ftos(stringcount), ", f_stringcount: ", ftos(f_stringcount), ".\nCheck the notification definition and the function call for accuracy...?\n")); return; }
+ else if(floatcount != f_floatcount) { backtrace(strcat("Incorrect float arguments for notification! floatcount: ", ftos(floatcount), ", f_floatcount: ", ftos(f_floatcount), ".\nCheck the notification definition and the function call for accuracy...?\n")); return; }
+ else if((stringcount + floatcount) > count) { backtrace(strcat("Not enough arguments for notification! ", strcat("stringcount(", ftos(stringcount), ") + floatcount(", ftos(floatcount), "),"), " > count(", ftos(count), ").\nCheck the notification definition and the function call for accuracy...?\n")); return; }
+ else if((stringcount + floatcount) < count) { backtrace(strcat("Too many arguments for notification! ", strcat("stringcount(", ftos(stringcount), ") + floatcount(", ftos(floatcount), "),"), " < count(", ftos(count), ").\nCheck the notification definition and the function call for accuracy...?\n")); return; }
//if(Count_Proper_Strings(NO_STR_ARG, s1, s2) > stringcount) { backtrace("Too many string arguments for notification!\n"); return; }
//if(Count_Proper_Floats(NO_FL_ARG, f1, f2, f3) > floatcount) { backtrace("Too many float arguments for notification!\n"); return; }
+
#define WRITE_NOTIFICATION(msg) \
WriteByte(msg, SVC_TEMPENTITY); \
WriteByte(msg, TE_CSQC_NOTIFICATION); \