#define HANDLE_CPID(cpid) ((min(NOTIF_MAX, cpid) == NO_CPID) ? FALSE : cpid)
#define NOTIF_MATCH(a,b) if(min(NOTIF_MAX, a) == b)
-#define VAR_TO_TEXT(var) #var
-
-#define CHECK_FIELD_AND_COUNT(field,count) if(!field) { field = (NOTIF_FIRST + count); ++count; }
-#define CHECK_MAX_NOTIFICATIONS(name,count) if(count == NOTIF_MAX) { error(strcat("Maximum notifications hit: ", VAR_TO_TEXT(name), ": ", ftos(count), ".\n")); }
// ====================================
float NOTIF_CENTER_COUNT;
float NOTIF_WEAPON_COUNT;
float NOTIF_CPID_COUNT;
-
+
#define MSG_INFO_NOTIF(name,args,normal,gentle) \
float name; \
void DecNotif_##name() \
{ \
- CHECK_FIELD_AND_COUNT(name, NOTIF_INFO_COUNT) \
- CHECK_MAX_NOTIFICATIONS(name, NOTIF_INFO_COUNT) \
+ SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_INFO_COUNT) \
+ CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_INFO_COUNT, "notifications") \
} \
ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)
float name; \
void DecNotif_##name() \
{ \
- CHECK_FIELD_AND_COUNT(name, NOTIF_NOTIFY_COUNT) \
- CHECK_MAX_NOTIFICATIONS(name, NOTIF_NOTIFY_COUNT) \
+ SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_NOTIFY_COUNT) \
+ CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_NOTIFY_COUNT, "notifications") \
} \
ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)
float cpid; \
void DecNotif_##name() \
{ \
- CHECK_FIELD_AND_COUNT(name, NOTIF_CENTER_COUNT) \
- CHECK_FIELD_AND_COUNT(cpid, NOTIF_CPID_COUNT) \
- CHECK_MAX_NOTIFICATIONS(name, NOTIF_CENTER_COUNT) \
+ SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CENTER_COUNT) \
+ SET_FIELD_COUNT(cpid, NOTIF_FIRST, NOTIF_CPID_COUNT) \
+ CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_CENTER_COUNT, "notifications") \
} \
ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)
float name; \
void DecNotif_##name() \
{ \
- CHECK_FIELD_AND_COUNT(name, NOTIF_WEAPON_COUNT) \
- CHECK_MAX_NOTIFICATIONS(name, NOTIF_WEAPON_COUNT) \
+ SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_WEAPON_COUNT) \
+ CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_WEAPON_COUNT, "notifications") \
} \
ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)