]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/all.qh
Improve registry API by adding REGISTRY_MAX and REGISTRY_COUNT macros
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / all.qh
index 58a34477a543e67e10521b0584b24faeb3d9c64d..ee0e1918e4b9194c3d5f75b510d864095476b81e 100644 (file)
@@ -47,15 +47,17 @@ REGISTRY_CHECK(Turrets)
        /**/
 
 #define TR_CONFIG(class, turname, fld, T)     _TR_CONFIG(class, fld, T, turname)
-#define TR_CONFIG_BEGIN(class) METHOD(class, tr_config, void(class this)) {
-       #ifdef SVQC
+#ifdef SVQC
+       #define TR_CONFIG_BEGIN(class) METHOD(class, tr_config, void(class this)) {
                #define _TR_CONFIG(class, fld, T, turname) if (#turname == this.netname) TUR_CONFIG_WRITE_CVARS(turname, fld, T);
-       #else
+       #define TR_CONFIG_END() }
+#else
+       #define TR_CONFIG_BEGIN(class)
                #define _TR_CONFIG(class, fld, T, turname)
-       #endif
-#define TR_CONFIG_END() }
+       #define TR_CONFIG_END()
+#endif
 
-GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
+GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt", false)
 {
     switch(request)
     {
@@ -110,7 +112,7 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
 
 
 const int TUR_FIRST = 1;
-#define TUR_LAST (Turrets_COUNT - 1)
+#define TUR_LAST (REGISTRY_COUNT(Turrets) - 1)
 
 #define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst)