]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/all.qh
Merge branch 'master' into Mario/movetype_push
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / all.qh
index 58a34477a543e67e10521b0584b24faeb3d9c64d..e44c5d9b544d67b9c717580127fdb18f3cb1a14b 100644 (file)
@@ -6,8 +6,7 @@
 #include "turret.qh"
 
 REGISTRY(Turrets, BITS(5))
-#define Turrets_from(i) _Turrets_from(i, TUR_Null)
-#define get_turretinfo(i) Turrets_from(i)
+#define get_turretinfo(i) REGISTRY_GET(Turrets, i)
 REGISTER_REGISTRY(Turrets)
 REGISTRY_CHECK(Turrets)
 
@@ -47,15 +46,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)
     {
@@ -99,10 +100,10 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
         default:
         case CMD_REQUEST_USAGE:
         {
-            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]");
-            LOG_INFO("  Where 'filename' is the file to write (default is turrets_dump.cfg),");
-            LOG_INFO("  if supplied with '-' output to console as well as default,");
-            LOG_INFO("  if left blank, it will only write to default.");
+            LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]");
+            LOG_HELP("  Where 'filename' is the file to write (default is turrets_dump.cfg),");
+            LOG_HELP("  if supplied with '-' output to console as well as default,");
+            LOG_HELP("  if left blank, it will only write to default.");
             return;
         }
     }
@@ -110,10 +111,11 @@ 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)
 
 REGISTER_TURRET(Null, NEW(Turret));
+REGISTRY_DEFINE_GET(Turrets, TUR_Null)
 
 #include "turret/_mod.qh"