]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Commands: move dump commands to their respective systems
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 9 Oct 2015 11:33:48 +0000 (22:33 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 9 Oct 2015 11:33:48 +0000 (22:33 +1100)
qcsrc/common/command/all.qh
qcsrc/common/command/generic.qc
qcsrc/common/effects/effectinfo.qc
qcsrc/common/items/all.qh
qcsrc/common/notifications.qh
qcsrc/common/turrets/all.qh
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/config.qh

index 253dc857b598cc8f2d9f77e6282b99fccf0ac193..756b36d5987ad3debe1b873d951845d6670bc163 100644 (file)
@@ -14,6 +14,10 @@ REGISTRY_SORT(GENERIC_COMMANDS, m_name, 0)
     REGISTER(RegisterGENERIC_COMMANDS, CMD_G, GENERIC_COMMANDS, id, m_id, NEW(genericcommand_##id)); \
        METHOD(genericcommand_##id, m_invokecmd, void(int request, int arguments, string command))
 
+STATIC_INIT(GENERIC_COMMANDS_aliases) {
+       FOREACH(GENERIC_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu"))));
+}
+
 #include "generic.qh"
 #include "markup.qh"
 #include "rpn.qh"
index 0c6380cfa18567e61d3273aaefcc335051ee1dad..6649950ddedf8d46dab5578cc37badc12422d25d 100644 (file)
@@ -184,7 +184,7 @@ void GenericCommand_qc_curl(float request, float argc)
        }
 }
 
-void GenericCommand_dumpcommands(float request)
+GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to *_cmd_dump.txt")
 {
        switch(request)
        {
@@ -239,224 +239,6 @@ void GenericCommand_dumpcommands(float request)
        }
 }
 
-#ifndef MENUQC
-void effectinfo_dump(int fh, bool alsoprint);
-#endif
-void GenericCommand_dumpeffectinfo(float request)
-{
-    switch (request) {
-        case CMD_REQUEST_COMMAND: {
-            #ifndef MENUQC
-            string filename = argv(1);
-                       bool alsoprint = false;
-            if (filename == "") {
-                filename = "effectinfo_dump.txt";
-                alsoprint = false;
-            } else if (filename == "-") {
-                filename = "effectinfo_dump.txt";
-                alsoprint = true;
-            }
-            int fh = fopen(filename, FILE_WRITE);
-            if (fh >= 0) {
-               effectinfo_dump(fh, alsoprint);
-                LOG_INFOF("Dumping effectinfo... File located at ^2data/data/%s^7.\n", filename);
-                               LOG_INFOF("Reload with ^2cl_particles_reloadeffects data/%s^7.\n", filename);
-                fclose(fh);
-            } else {
-                LOG_WARNINGF("Could not open file '%s'!\n", filename);
-            }
-            #else
-            LOG_INFO(_("Effectinfo dump command only works with cl_cmd and sv_cmd.\n"));
-            #endif
-            return;
-        }
-        default:
-        case CMD_REQUEST_USAGE: {
-            LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]"));
-            LOG_INFO("  Where 'filename' is the file to write (default is effectinfo_dump.txt),\n");
-            LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-            LOG_INFO("  if left blank, it will only write to default.\n");
-            return;
-        }
-    }
-}
-STATIC_INIT(dumpeffectinfo) { localcmd("alias dumpeffectinfo \"qc_cmd_svcl dumpeffectinfo ${* ?}\"\n"); }
-
-void GenericCommand_dumpitems(float request)
-{
-       switch(request)
-       {
-               case CMD_REQUEST_COMMAND:
-               {
-                       Dump_Items();
-                       return;
-               }
-
-               default:
-               case CMD_REQUEST_USAGE:
-               {
-                       LOG_INFOF("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
-                       return;
-               }
-       }
-}
-
-void GenericCommand_dumpnotifs(float request)
-{
-       switch(request)
-       {
-               case CMD_REQUEST_COMMAND:
-               {
-                       #ifndef MENUQC
-                       float fh, alsoprint = false;
-                       string filename = argv(1);
-
-                       if(filename == "")
-                       {
-                               filename = "notifications_dump.cfg";
-                               alsoprint = false;
-                       }
-                       else if(filename == "-")
-                       {
-                               filename = "notifications_dump.cfg";
-                               alsoprint = true;
-                       }
-                       fh = fopen(filename, FILE_WRITE);
-
-                       if(fh >= 0)
-                       {
-                               Dump_Notifications(fh, alsoprint);
-                               LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.\n", filename);
-                               fclose(fh);
-                       }
-                       else
-                       {
-                               LOG_INFOF("^1Error: ^7Could not open file '%s'!\n", filename);
-                       }
-                       #else
-                       LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd.\n"));
-                       #endif
-                       return;
-               }
-
-               default:
-               case CMD_REQUEST_USAGE:
-               {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]"));
-                       LOG_INFO("  Where 'filename' is the file to write (default is notifications_dump.cfg),\n");
-                       LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-                       LOG_INFO("  if left blank, it will only write to default.\n");
-                       return;
-               }
-       }
-}
-
-void GenericCommand_dumpweapons(float request) // WEAPONTODO: make this work with other progs than just server
-{
-       switch(request)
-       {
-               case CMD_REQUEST_COMMAND:
-               {
-                       #ifdef SVQC
-                       wep_config_file = -1;
-                       wep_config_alsoprint = -1;
-                       string filename = argv(1);
-
-                       if(filename == "")
-                       {
-                               filename = "weapons_dump.cfg";
-                               wep_config_alsoprint = false;
-                       }
-                       else if(filename == "-")
-                       {
-                               filename = "weapons_dump.cfg";
-                               wep_config_alsoprint = true;
-                       }
-                       wep_config_file = fopen(filename, FILE_WRITE);
-
-                       if(wep_config_file >= 0)
-                       {
-                               Dump_Weapon_Settings();
-                               LOG_INFO(sprintf("Dumping weapons... File located in ^2data/data/%s^7.\n", filename));
-                               fclose(wep_config_file);
-                               wep_config_file = -1;
-                               wep_config_alsoprint = -1;
-                       }
-                       else
-                       {
-                               LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
-                       }
-                       #else
-                       LOG_INFO(_("Weapons dump command only works with sv_cmd.\n"));
-                       #endif
-                       return;
-               }
-
-               default:
-               case CMD_REQUEST_USAGE:
-               {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]"));
-                       LOG_INFO("  Where 'filename' is the file to write (default is weapons_dump.cfg),\n");
-                       LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-                       LOG_INFO("  if left blank, it will only write to default.\n");
-                       return;
-               }
-       }
-}
-
-void GenericCommand_dumpturrets(float request)
-{
-       switch(request)
-       {
-               case CMD_REQUEST_COMMAND:
-               {
-                       #ifdef SVQC
-                       tur_config_file = -1;
-                       tur_config_alsoprint = -1;
-                       string filename = argv(1);
-
-                       if(filename == "")
-                       {
-                               filename = "turrets_dump.cfg";
-                               tur_config_alsoprint = FALSE;
-                       }
-                       else if(filename == "-")
-                       {
-                               filename = "turrets_dump.cfg";
-                               tur_config_alsoprint = TRUE;
-                       }
-                       tur_config_file = fopen(filename, FILE_WRITE);
-
-                       if(tur_config_file >= 0)
-                       {
-                               Dump_Turret_Settings();
-                               LOG_INFO(sprintf("Dumping turrets... File located in ^2data/data/%s^7.\n", filename));
-                               fclose(tur_config_file);
-                               tur_config_file = -1;
-                               tur_config_alsoprint = -1;
-                       }
-                       else
-                       {
-                               LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
-                       }
-                       #else
-                       LOG_INFO(_("Turrets dump command only works with sv_cmd.\n"));
-                       #endif
-                       return;
-               }
-
-               default:
-               case CMD_REQUEST_USAGE:
-               {
-                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"));
-                       LOG_INFO("  Where 'filename' is the file to write (default is turrets_dump.cfg),\n");
-                       LOG_INFO("  if supplied with '-' output to console as well as default,\n");
-                       LOG_INFO("  if left blank, it will only write to default.\n");
-                       return;
-               }
-       }
-}
-
 void GenericCommand_maplist(float request, float argc)
 {
        switch(request)
@@ -758,12 +540,6 @@ void GenericCommand_(float request)
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
 GENERIC_COMMAND(addtolist, "Add a string to a cvar") { GenericCommand_addtolist(request, arguments); }
-GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to *_cmd_dump.txt") { GenericCommand_dumpcommands(request); }
-GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt") { GenericCommand_dumpeffectinfo(request); }
-GENERIC_COMMAND(dumpitems, "Dump all items to the console") { GenericCommand_dumpitems(request); }
-GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt") { GenericCommand_dumpnotifs(request); }
-GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt") { GenericCommand_dumpturrets(request); }
-GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") { GenericCommand_dumpweapons(request); }
 GENERIC_COMMAND(maplist, "Automatic control of maplist") { GenericCommand_maplist(request, arguments); }
 GENERIC_COMMAND(nextframe, "Execute the given command next frame of this VM") { GenericCommand_nextframe(request, arguments, command); }
 GENERIC_COMMAND(qc_curl, "Queries a URL") { GenericCommand_qc_curl(request, arguments); }
index 731903b6353e7413c3d51db8970138fea9ee734d..deff4dc1563ba74d61d0ba3f7abf912a1d3466d1 100644 (file)
@@ -283,6 +283,41 @@ void effectinfo_dump(int fh, bool alsoprint)
     #undef WRITE
 }
 
+GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
+{
+    switch (request) {
+        case CMD_REQUEST_COMMAND: {
+            string filename = argv(1);
+                       bool alsoprint = false;
+            if (filename == "") {
+                filename = "effectinfo_dump.txt";
+                alsoprint = false;
+            } else if (filename == "-") {
+                filename = "effectinfo_dump.txt";
+                alsoprint = true;
+            }
+            int fh = fopen(filename, FILE_WRITE);
+            if (fh >= 0) {
+               effectinfo_dump(fh, alsoprint);
+                LOG_INFOF("Dumping effectinfo... File located at ^2data/data/%s^7.\n", filename);
+                               LOG_INFOF("Reload with ^2cl_particles_reloadeffects data/%s^7.\n", filename);
+                fclose(fh);
+            } else {
+                LOG_WARNINGF("Could not open file '%s'!\n", filename);
+            }
+            return;
+        }
+        default:
+        case CMD_REQUEST_USAGE: {
+            LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]"));
+            LOG_INFO("  Where 'filename' is the file to write (default is effectinfo_dump.txt),\n");
+            LOG_INFO("  if supplied with '-' output to console as well as default,\n");
+            LOG_INFO("  if left blank, it will only write to default.\n");
+            return;
+        }
+    }
+}
+
 
 REGISTRY(EffectInfos, BIT(9))
 REGISTER_REGISTRY(RegisterEffectInfos)
index 672ed707cd0c3bf271d98fd713ba3f44177ae32a..92c77579abb21d5aba62bad2efc30f792c978f99 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef ITEMS_ALL_H
 #define ITEMS_ALL_H
 
+#include "../command/all.qh"
+
 #include "item.qh"
 
 REGISTRY(Items, BIT(5))
@@ -10,6 +12,20 @@ REGISTER_REGISTRY(RegisterItems)
 
 void Dump_Items();
 
+GENERIC_COMMAND(dumpitems, "Dump all items to the console") {
+    switch (request) {
+        case CMD_REQUEST_COMMAND: {
+            Dump_Items();
+            return;
+        }
+        default:
+        case CMD_REQUEST_USAGE: {
+            LOG_INFOF("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
+            return;
+        }
+    }
+}
+
 #ifndef MENUQC
 string Item_Model(string item_mdl);
 #endif
index 01d6cbe5538e2207c295c08906ca543aa8c40acf..043ec38b92acdd04e0b95819e7d5acfc8aa47421 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef NOTIFICATIONS_H
 #define NOTIFICATIONS_H
 
+#include "command/all.qh"
+
 #include "constants.qh"
 #include "teams.qh"
 #include "util.qh"
@@ -83,6 +85,57 @@ void Create_Notification_Entity(
 
 void Dump_Notifications(float fh, float alsoprint);
 
+
+GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt")
+{
+       switch(request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       #ifndef MENUQC
+                       float fh, alsoprint = false;
+                       string filename = argv(1);
+
+                       if(filename == "")
+                       {
+                               filename = "notifications_dump.cfg";
+                               alsoprint = false;
+                       }
+                       else if(filename == "-")
+                       {
+                               filename = "notifications_dump.cfg";
+                               alsoprint = true;
+                       }
+                       fh = fopen(filename, FILE_WRITE);
+
+                       if(fh >= 0)
+                       {
+                               Dump_Notifications(fh, alsoprint);
+                               LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.\n", filename);
+                               fclose(fh);
+                       }
+                       else
+                       {
+                               LOG_INFOF("^1Error: ^7Could not open file '%s'!\n", filename);
+                       }
+                       #else
+                       LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd.\n"));
+                       #endif
+                       return;
+               }
+
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]"));
+                       LOG_INFO("  Where 'filename' is the file to write (default is notifications_dump.cfg),\n");
+                       LOG_INFO("  if supplied with '-' output to console as well as default,\n");
+                       LOG_INFO("  if left blank, it will only write to default.\n");
+                       return;
+               }
+       }
+}
+
 #ifdef NOTIFICATIONS_DEBUG
 void Debug_Notification(string input);
 #endif
index 2b9a87d421ae67d446f4f0a21758493d1c3c1a02..3f9eba4f37d4e942aac5ccdd160dfb226dee42de 100644 (file)
@@ -1,10 +1,69 @@
 #ifndef TURRETS_ALL_H
 #define TURRETS_ALL_H
 
+#include "../command/all.qh"
+#include "config.qh"
+
 #include "turret.qh"
 
 REGISTRY(Turrets, BIT(5))
 REGISTER_REGISTRY(RegisterTurrets)
+
+
+GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
+{
+    switch(request)
+    {
+        case CMD_REQUEST_COMMAND:
+        {
+            #ifdef SVQC
+            tur_config_file = -1;
+            tur_config_alsoprint = -1;
+            string filename = argv(1);
+
+            if(filename == "")
+            {
+                filename = "turrets_dump.cfg";
+                tur_config_alsoprint = FALSE;
+            }
+            else if(filename == "-")
+            {
+                filename = "turrets_dump.cfg";
+                tur_config_alsoprint = TRUE;
+            }
+            tur_config_file = fopen(filename, FILE_WRITE);
+
+            if(tur_config_file >= 0)
+            {
+                Dump_Turret_Settings();
+                LOG_INFO(sprintf("Dumping turrets... File located in ^2data/data/%s^7.\n", filename));
+                fclose(tur_config_file);
+                tur_config_file = -1;
+                tur_config_alsoprint = -1;
+            }
+            else
+            {
+                LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+            }
+            #else
+            LOG_INFO(_("Turrets dump command only works with sv_cmd.\n"));
+            #endif
+            return;
+        }
+
+        default:
+        case CMD_REQUEST_USAGE:
+        {
+            LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"));
+            LOG_INFO("  Where 'filename' is the file to write (default is turrets_dump.cfg),\n");
+            LOG_INFO("  if supplied with '-' output to console as well as default,\n");
+            LOG_INFO("  if left blank, it will only write to default.\n");
+            return;
+        }
+    }
+}
+
+
 const int TUR_FIRST = 1;
 #define TUR_LAST (Turrets_COUNT - 1)
 
index c96061fe615c00833f0d0524d2f6868bda021d9f..7bf6715f5dea4a0d29adf30773ccd728ed0dbfe6 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef WEAPONS_ALL_H
 #define WEAPONS_ALL_H
 
+#include "../command/all.qh"
+#include "config.qh"
+
 // weapon sets
 typedef vector WepSet;
 #define WEPSET(id) WepSet_FromWeapon(WEP_##id.m_id)
@@ -34,9 +37,63 @@ REGISTRY(Weapons, 72) // Increase as needed. Can be up to 72.
 REGISTER_REGISTRY(RegisterWeapons)
 entity get_weaponinfo(int id);
 
+
+GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPONTODO: make this work with other progs than just server
+{
+    switch(request)
+    {
+        case CMD_REQUEST_COMMAND:
+        {
+            #ifdef SVQC
+            wep_config_file = -1;
+            wep_config_alsoprint = -1;
+            string filename = argv(1);
+
+            if(filename == "")
+            {
+                filename = "weapons_dump.cfg";
+                wep_config_alsoprint = false;
+            }
+            else if(filename == "-")
+            {
+                filename = "weapons_dump.cfg";
+                wep_config_alsoprint = true;
+            }
+            wep_config_file = fopen(filename, FILE_WRITE);
+
+            if(wep_config_file >= 0)
+            {
+                Dump_Weapon_Settings();
+                LOG_INFO(sprintf("Dumping weapons... File located in ^2data/data/%s^7.\n", filename));
+                fclose(wep_config_file);
+                wep_config_file = -1;
+                wep_config_alsoprint = -1;
+            }
+            else
+            {
+                LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+            }
+            #else
+            LOG_INFO(_("Weapons dump command only works with sv_cmd.\n"));
+            #endif
+            return;
+        }
+
+        default:
+        case CMD_REQUEST_USAGE:
+        {
+            LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]"));
+            LOG_INFO("  Where 'filename' is the file to write (default is weapons_dump.cfg),\n");
+            LOG_INFO("  if supplied with '-' output to console as well as default,\n");
+            LOG_INFO("  if left blank, it will only write to default.\n");
+            return;
+        }
+    }
+}
+
 #define REGISTER_WEAPON(id, inst) \
-       /* WepSet WEPSET_##id; */ \
-       REGISTER(RegisterWeapons, WEP, Weapons, id, m_id, inst)
+    /* WepSet WEPSET_##id; */ \
+    REGISTER(RegisterWeapons, WEP, Weapons, id, m_id, inst)
 
 // create cvars for weapon settings
 #define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
@@ -44,15 +101,15 @@ entity get_weaponinfo(int id);
 #define WEP_ADD_CVAR_PRI(wepname,name) WEP_ADD_CVAR_NONE(wepname, primary_##name)
 #define WEP_ADD_CVAR_SEC(wepname,name) WEP_ADD_CVAR_NONE(wepname, secondary_##name)
 #define WEP_ADD_CVAR_BOTH(wepname,name) \
-       WEP_ADD_CVAR_PRI(wepname, name) \
-       WEP_ADD_CVAR_SEC(wepname, name)
+    WEP_ADD_CVAR_PRI(wepname, name) \
+    WEP_ADD_CVAR_SEC(wepname, name)
 
 #define WEP_ADD_CVAR(wepid,wepname,mode,name) WEP_ADD_CVAR_##mode(wepname, name)
 
 // create properties for weapon settings
 #define WEP_ADD_PROP(wepid,wepname,type,prop,name) \
-       .type prop; \
-       [[last]] type autocvar_g_balance_##wepname##_##name;
+    .type prop; \
+    [[last]] type autocvar_g_balance_##wepname##_##name;
 
 // read cvars from weapon settings
 #define WEP_CVAR(wepname,name) autocvar_g_balance_##wepname##_##name
@@ -75,11 +132,11 @@ REGISTER_WEAPON(Null, NEW(Weapon));
 
 entity get_weaponinfo(int id)
 {
-       if (id >= WEP_FIRST && id <= WEP_LAST) {
-               Weapon w = Weapons[id];
-               if (w) return w;
-       }
-       return WEP_Null;
+    if (id >= WEP_FIRST && id <= WEP_LAST) {
+        Weapon w = Weapons[id];
+        if (w) return w;
+    }
+    return WEP_Null;
 }
 
 // TODO: remove after 0.8.2. Retains impulse number compatibility because 0.8.1 clients don't reload the weapons.cfg
@@ -93,28 +150,28 @@ REGISTRY_SORT(Weapons, netname, WEP_HARDCODED_IMPULSES + 1)
 
 STATIC_INIT(register_weapons_done)
 {
-       for (int i = 0; i < Weapons_COUNT; ++i) {
-               Weapon it = Weapons[i];
-               it.m_id = i;
-               WepSet set = WepSet_FromWeapon(it.m_id);
-               WEPSET_ALL |= set;
-               if ((it.spawnflags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= set;
-               it.weapon = it.m_id;
-               it.weapons = set;
-               #ifdef CSQC
-               it.wr_init(it);
-               #endif
-               int imp = WEP_IMPULSE_BEGIN + it.m_id - 1;
-               if (imp <= WEP_IMPULSE_END)
-                       localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp));
-               else
-                       LOG_TRACEF(_("Impulse limit exceeded, weapon will not be directly accessible: %s\n"), it.netname);
-       }
-       weaponorder_byid = "";
-       for (int i = Weapons_MAX - 1; i >= 1; --i)
-               if (Weapons[i])
-                       weaponorder_byid = strcat(weaponorder_byid, " ", ftos(i));
-       weaponorder_byid = strzone(substring(weaponorder_byid, 1, strlen(weaponorder_byid) - 1));
+    for (int i = 0; i < Weapons_COUNT; ++i) {
+        Weapon it = Weapons[i];
+        it.m_id = i;
+        WepSet set = WepSet_FromWeapon(it.m_id);
+        WEPSET_ALL |= set;
+        if ((it.spawnflags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= set;
+        it.weapon = it.m_id;
+        it.weapons = set;
+        #ifdef CSQC
+        it.wr_init(it);
+        #endif
+        int imp = WEP_IMPULSE_BEGIN + it.m_id - 1;
+        if (imp <= WEP_IMPULSE_END)
+            localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp));
+        else
+            LOG_TRACEF(_("Impulse limit exceeded, weapon will not be directly accessible: %s\n"), it.netname);
+    }
+    weaponorder_byid = "";
+    for (int i = Weapons_MAX - 1; i >= 1; --i)
+        if (Weapons[i])
+            weaponorder_byid = strcat(weaponorder_byid, " ", ftos(i));
+    weaponorder_byid = strzone(substring(weaponorder_byid, 1, strlen(weaponorder_byid) - 1));
 }
 
 #endif
index 410dbdfadeb8b1f7fe79e4eeacf63bdf1a7e14d0..c50c1e544041fc2a8960b214371c3df27c1d9a14 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef WEAPONS_CONFIG_H
 #define WEAPONS_CONFIG_H
 
+#ifdef SVQC
 // ==========================
 //  Balance Config Generator
 // ==========================
@@ -47,3 +48,4 @@ string wep_config_queue[MAX_WEP_CONFIG];
 
 #define WEP_CONFIG_WRITE_PROPS(wepid,wepname,type,prop,name) WEP_CONFIG_WRITE_PROPS_##type(wepname,name)
 #endif
+#endif