X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fimpulses%2Fall.qh;h=e5a2b7b6019a6bb7309908b51989426b208bdca7;hp=6780ac16d0fa1ddd83c766319d05f2d9289b2c01;hb=991de5e6922cd3c283de56c3249624f0f1bfe767;hpb=edf01df130d0d1877461561178b8833a9ab6051c diff --git a/qcsrc/common/impulses/all.qh b/qcsrc/common/impulses/all.qh index 6780ac16d0..e5a2b7b601 100644 --- a/qcsrc/common/impulses/all.qh +++ b/qcsrc/common/impulses/all.qh @@ -1,5 +1,4 @@ -#ifndef IMPULSES_ALL_H -#define IMPULSES_ALL_H +#pragma once REGISTRY(IMPULSES, 255) REGISTER_REGISTRY(IMPULSES) @@ -28,10 +27,17 @@ REGISTRY_CHECK(IMPULSES) #define LEGACY_IMPULSE_ID(alias, id) LEGACY_IMPULSE(alias, id, sprintf("impulse %d", IMP_##alias.impulse)) +void _impCheck(string s, string alias) +{ + // this is inside a function to avoid expanding it on compilation everytime + if (s == alias) + LOG_FATALF("LEGACY_IMPULSE: would define a recursive alias for '%s', use LEGACY_IMPULSE_ID instead", s); +} + #define LEGACY_IMPULSE(alias, id, 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); \ + _impCheck(s, #alias); \ IMPULSE_ALIAS(alias, s); \ } \ SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); } @@ -187,20 +193,6 @@ LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal") REGISTER_IMPULSE(waypoint_clear, 48) LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear") -REGISTER_IMPULSE(navwaypoint_spawn, 103) -LEGACY_IMPULSE(g_waypointeditor_spawn, 103, "navwaypoint_spawn") - -REGISTER_IMPULSE(navwaypoint_remove, 104) -LEGACY_IMPULSE(g_waypointeditor_remove, 104, "navwaypoint_remove") - -REGISTER_IMPULSE(navwaypoint_relink, 105) -LEGACY_IMPULSE(g_waypointeditor_relinkall, 105, "navwaypoint_relink") - -REGISTER_IMPULSE(navwaypoint_save, 106) -LEGACY_IMPULSE(g_waypointeditor_saveall, 106, "navwaypoint_save") - -REGISTER_IMPULSE(navwaypoint_unreachable, 107) -LEGACY_IMPULSE(g_waypointeditor_unreachable, 107, "navwaypoint_unreachable") #define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n) #define _CHIMPULSE(id, n) \ @@ -216,5 +208,3 @@ CHIMPULSE(SPEEDRUN, 141) CHIMPULSE(CLONE_STANDING, 142) CHIMPULSE(TELEPORT, 143) CHIMPULSE(R00T, 148) - -#endif