hud_panelent.panel_showflags = showflags; \
HUD_PANEL_NUM++; \
} \
- ACCUMULATE_FUNCTION(RegisterHUD_Panels, RegisterHUD_Panel_##NAME);
+ ACCUMULATE_FUNCTION(RegisterHUD_Panels, RegisterHUD_Panel_##NAME)
HUD_PANELS(HUD_PANEL)
#undef HUD_PANEL
if (msg_death_by != NO_MSG) \
deathent.death_msgmurder = msg_multi_notifs[msg_death_by - 1]; \
} \
- ACCUMULATE_FUNCTION(RegisterDeathtypes, RegisterDeathtype_##name);
+ ACCUMULATE_FUNCTION(RegisterDeathtypes, RegisterDeathtype_##name)
DEATHTYPES
#undef DEATHTYPE
}
// NOW we actually activate the declarations
-ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First);
+ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First)
EFFECT(0, Null, string_null)
#include "effects.inc"
-ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done);
+ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done)
#endif
[[accumulate]] void RegisterCallbacks() { CALLBACK_##name = NEW(Callback, func); }
#define MUTATOR_HOOKFUNCTION(...) \
- OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__)
+ EVAL(OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__))
#define MUTATOR_HOOKFUNCTION_1(name) \
_MUTATOR_CALLBACK(name, HOOKFUNCTION_##name) \
{
// check supplied type and name for errors
string checkargs = "";
- #define CHECKARG_TYPENAME(type) case MSG_##type##: \
+ #define CHECKARG_TYPENAME(type) case MSG_##type: \
{ if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
{ checkargs = sprintf("Improper name: %d!", net_name); } break; }
switch(net_type)
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define MSG_INFO_NOTIF(default,name,strnum,flnum,args,hudargs,icon,normal,gentle) \
NOTIF_ADD_AUTOCVAR(name, default) \
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
.string nent_iconargs;
#define MULTIICON_INFO(default,name,strnum,flnum,args,hudargs,iconargs,icon,normal,gentle) \
NO_MSG); /* optionb */ \
msg_info_notifs[name - 1].nent_iconargs = iconargs; \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define MSG_CENTER_NOTIF(default,name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
NOTIF_ADD_AUTOCVAR(name, default) \
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define MSG_MULTI_NOTIF(default,name,anncename,infoname,centername) \
NOTIF_ADD_AUTOCVAR(name, default) \
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define ACVNN(name) autocvar_notification_##name
optiona, /* optiona */ \
optionb); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
void RegisterNotifications_First()
{
}
// NOW we actually activate the declarations
-ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_First);
+ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_First)
#include "notifications.inc"
-ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done);
+ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done)
#endif
#include "all.qh"
#undef REGISTER_TURRET
-ACCUMULATE_FUNCTION(RegisterTurrets, register_turrets_done);
+ACCUMULATE_FUNCTION(RegisterTurrets, register_turrets_done)
#endif
#define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body)
#ifdef GMQCC
- #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+ #define EVAL(...) __VA_ARGS__
+
+ #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+ #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
#else
- #define OVERLOAD_(F,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n
- #define OVERLOAD(F, ...) OVERLOAD_(F,__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)(__VA_ARGS__)
+ #define EMPTY()
+ #define DEFER(id) id EMPTY()
+
+ #define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__)))
+ #define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__)))
+ #define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__)))
+ #define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__)))
+ #define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__)))
+ #define EVAL5(...) __VA_ARGS__
+
+ #define OVERLOAD___(F,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n
+ #define OVERLOAD__(F, ...) OVERLOAD___(F,##__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
+ #define OVERLOAD_(...) DEFER(OVERLOAD__(__VA_ARGS__))
+ #define OVERLOAD(F, ...) OVERLOAD_(F,##__VA_ARGS__)(__VA_ARGS__)
#endif
#define LAMBDA(...) { __VA_ARGS__ ; }
-#define MAP(f, ...) OVERLOAD(MAP, f, __VA_ARGS__)
+#define MAP(f, ...) EVAL(OVERLOAD(MAP, f, __VA_ARGS__))
#define MAP_2(f, it) f(it)
#define MAP_3(f, it, ...) f(it)MAP_2(f, __VA_ARGS__)
#define MAP_4(f, it, ...) f(it)MAP_3(f, __VA_ARGS__)
#undef WEP_ADD_CVAR
#undef WEP_ADD_PROP
void register_weapons_done();
-ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done);
+ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done)
#endif
type autocvar_##var
#define AUTOCVAR_6(file, archive, var, type, default, desc) \
AUTOCVAR_5(file, archive, var, type, desc) = default
-#define _AUTOCVAR(...) OVERLOAD(AUTOCVAR, __FILE__, __VA_ARGS__)
+#define _AUTOCVAR(...) EVAL(OVERLOAD(AUTOCVAR, __FILE__, __VA_ARGS__))
#define AUTOCVAR_SAVE(...) _AUTOCVAR(true, __VA_ARGS__)
#define AUTOCVAR(...) _AUTOCVAR(false, __VA_ARGS__)
-#define entityclass(...) OVERLOAD(entityclass, __VA_ARGS__)
+#define entityclass(...) EVAL(OVERLOAD(entityclass, __VA_ARGS__))
#define entityclass_1(name) entityclass_2(name, Object)
#ifndef QCC_SUPPORT_ENTITYCLASS
#define entityclass_2(name, base) typedef entity name
// The parameter is used across [[accumulate]] functions
// Macros to hide this implementation detail:
+#ifdef GMQCC
#define NEW(cname, ...) \
OVERLOAD(spawn##cname, new(cname), ##__VA_ARGS__)
#define CONSTRUCT(cname, ...) \
OVERLOAD(spawn##cname, this, ##__VA_ARGS__)
+#else
+#define NEW_(cname, ...) \
+ OVERLOAD_(spawn##cname, __VA_ARGS__)
+#define NEW(cname, ...) \
+ NEW_(cname, new(cname), ##__VA_ARGS__)(new(cname), ##__VA_ARGS__)
+
+#define CONSTRUCT_(cname, ...) \
+ OVERLOAD_(spawn##cname, __VA_ARGS__)
+#define CONSTRUCT(cname, ...) \
+ CONSTRUCT_(cname, this, ##__VA_ARGS__)(this, ##__VA_ARGS__)
+#endif
#define CONSTRUCTOR(cname, ...) \
cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) { return = this; } \
ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
- ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, NEW(SettingSource)))
+ ATTRIB(XonoticGameSettingsTab, source, DataSource, NEW(SettingSource))
+ ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, this.source))
ATTRIB(XonoticGameSettingsTab, currentPanel, entity, NEW(XonoticTab))
ATTRIB(XonoticGameSettingsTab, currentItem, entity, NULL)
METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this))