.void(entity this) impulse_handle;
#if defined(CSQC)
-#define IMPULSE_ALIAS(alias, id) localcmd("\nalias " #alias " \"" id "\"\n")
+#define IMPULSE_ALIAS(alias, id) localcmd("\nalias " #alias " \"", id ,"\"\n")
#else
#define IMPULSE_ALIAS(alias, id)
#endif
IMPULSE_ALIAS(alias, "impulse " #n); \
}
+#define LEGACY_IMPULSE_ID(alias, id) LEGACY_IMPULSE(alias, id, sprintf("impulse %d", IMP_##alias.impulse))
+
#define LEGACY_IMPULSE(alias, id, new) \
- STATIC_INIT(legacy_##alias) { IMPULSE_ALIAS(alias, new); } \
+ STATIC_INIT(legacy_##alias) { \
+ string s = new; \
+ if (s == #alias) LOG_FATALF("LEGACY_IMPULSE: would define a recursive alias for '%s', use LEGACY_IMPULSE_ID instead", s); \
+ IMPULSE_ALIAS(alias, s); \
+ } \
SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); }
#define X(slot, imp) \
LEGACY_IMPULSE(reload, 20, "weapon_reload")
REGISTER_IMPULSE(use, 21)
-LEGACY_IMPULSE(use, 21, "use")
+LEGACY_IMPULSE_ID(use, 21)
REGISTER_IMPULSE(waypoint_personal_here, 30)
LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")