]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix wrong filename in the dumpnotifs command; put the filename in a constant in all...
authorterencehill <piuntn@gmail.com>
Mon, 1 Mar 2021 20:01:05 +0000 (21:01 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 1 Mar 2021 20:01:05 +0000 (21:01 +0100)
qcsrc/common/effects/effectinfo.qc
qcsrc/common/notifications/all.qh
qcsrc/common/turrets/all.qh
qcsrc/common/weapons/all.qh

index f4b0dbabcf37f3ac844bfa7627da22e5dbf51705..d6da6c4aa7d71fdb0f685992b80a879a06a65cde 100644 (file)
@@ -287,17 +287,19 @@ void effectinfo_dump(int fh, bool alsoprint)
     #undef WRITE
 }
 
-GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt", false)
+#define DEFAULT_FILENAME "effectinfo_dump.txt"
+// NOTE: dumpeffectinfo, dumpnotifs, dumpturrets and dumpweapons use similar code
+GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo into " DEFAULT_FILENAME, false)
 {
     switch (request) {
         case CMD_REQUEST_COMMAND: {
             string filename = argv(1);
                        bool alsoprint = false;
             if (filename == "") {
-                filename = "effectinfo_dump.txt";
+                filename = DEFAULT_FILENAME;
                 alsoprint = false;
             } else if (filename == "-") {
-                filename = "effectinfo_dump.txt";
+                filename = DEFAULT_FILENAME;
                 alsoprint = true;
             }
             int fh = fopen(filename, FILE_WRITE);
@@ -314,13 +316,14 @@ GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt", fa
         default:
         case CMD_REQUEST_USAGE: {
             LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [<filename>]");
-            LOG_HELP("  Where <filename> is the file to write (default is effectinfo_dump.txt),");
+            LOG_HELPF("  Where <filename> is the file to write (default is %s),", DEFAULT_FILENAME);
             LOG_HELP("  if supplied with '-' output to console as well as default,");
             LOG_HELP("  if left blank, it will only write to default.");
             return;
         }
     }
 }
+#undef DEFAULT_FILENAME
 
 
 REGISTRY(EffectInfos, BITS(9))
index e5df019579e20a77225b46ffc06859a2b9b22d79..0c23677ca903c1b35a675fb6e2b475c9d79fab76 100644 (file)
@@ -160,7 +160,9 @@ void Create_Notification_Entity_Choice(entity notif,
 
 void Dump_Notifications(int fh, bool alsoprint);
 
-GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt", false)
+#define DEFAULT_FILENAME "notifications_dump.cfg"
+// NOTE: dumpeffectinfo, dumpnotifs, dumpturrets and dumpweapons use similar code
+GENERIC_COMMAND(dumpnotifs, "Dump all notifications into " DEFAULT_FILENAME, false)
 {
        switch (request)
        {
@@ -171,12 +173,12 @@ GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt"
                        bool alsoprint = false;
                        if (filename == "")
                        {
-                               filename = "notifications_dump.cfg";
+                               filename = DEFAULT_FILENAME;
                                alsoprint = false;
                        }
                        else if (filename == "-")
                        {
-                               filename = "notifications_dump.cfg";
+                               filename = DEFAULT_FILENAME;
                                alsoprint = true;
                        }
                        int fh = fopen(filename, FILE_WRITE);
@@ -199,13 +201,14 @@ GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt"
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [<filename>]");
-                       LOG_HELP("  Where <filename> is the file to write (default is notifications_dump.cfg),");
+                       LOG_HELPF("  Where <filename> is the file to write (default is %s),", DEFAULT_FILENAME);
                        LOG_HELP("  if supplied with '-' output to console as well as default,");
                        LOG_HELP("  if left blank, it will only write to default.");
                        return;
                }
        }
 }
+#undef DEFAULT_FILENAME
 
 #ifdef NOTIFICATIONS_DEBUG
 bool autocvar_notification_debug = false;
index 9304bf0252692689083945ddfe87f0d59b9d06f5..ea3b0e31e801b677edeb149ef7ec477ff7ab9a9b 100644 (file)
@@ -56,7 +56,9 @@ REGISTRY_CHECK(Turrets)
        #define TR_CONFIG_END()
 #endif
 
-GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt", false)
+#define DEFAULT_FILENAME "turrets_dump.cfg"
+// NOTE: dumpeffectinfo, dumpnotifs, dumpturrets and dumpweapons use similar code
+GENERIC_COMMAND(dumpturrets, "Dump all turrets into " DEFAULT_FILENAME, false)
 {
     switch(request)
     {
@@ -69,12 +71,12 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt", false)
 
             if(filename == "")
             {
-                filename = "turrets_dump.cfg";
+                filename = DEFAULT_FILENAME;
                 tur_config_alsoprint = false;
             }
             else if(filename == "-")
             {
-                filename = "turrets_dump.cfg";
+                filename = DEFAULT_FILENAME;
                 tur_config_alsoprint = true;
             }
             tur_config_file = fopen(filename, FILE_WRITE);
@@ -101,13 +103,14 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt", false)
         case CMD_REQUEST_USAGE:
         {
             LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [<filename>]");
-            LOG_HELP("  Where <filename> is the file to write (default is turrets_dump.cfg),");
+            LOG_HELPF("  Where <filename> is the file to write (default is %s),", DEFAULT_FILENAME);
             LOG_HELP("  if supplied with '-' output to console as well as default,");
             LOG_HELP("  if left blank, it will only write to default.");
             return;
         }
     }
 }
+#undef DEFAULT_FILENAME
 
 
 const int TUR_FIRST = 1;
index 6b3f7577f6fde976716c9376b1e41ba3625e437b..88a79224febab5f53524de1c39bd006e6d173caf 100644 (file)
@@ -38,7 +38,9 @@ STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, it.m_pickup = NEW(WeaponPicku
 #define WepSet_FromWeapon(it) ((it).m_wepset)
 WepSet _WepSet_FromWeapon(int i);
 
-GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt", false) // WEAPONTODO: make this work with other progs than just server
+#define DEFAULT_FILENAME "weapons_dump.cfg"
+// NOTE: dumpeffectinfo, dumpnotifs, dumpturrets and dumpweapons use similar code
+GENERIC_COMMAND(dumpweapons, "Dump all turrets into " DEFAULT_FILENAME, false) // WEAPONTODO: make this work with other progs than just server
 {
     switch(request)
     {
@@ -51,12 +53,12 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt", false) //
 
             if(filename == "")
             {
-                filename = "weapons_dump.cfg";
+                filename = DEFAULT_FILENAME;
                 wep_config_alsoprint = false;
             }
             else if(filename == "-")
             {
-                filename = "weapons_dump.cfg";
+                filename = DEFAULT_FILENAME;
                 wep_config_alsoprint = true;
             }
             wep_config_file = fopen(filename, FILE_WRITE);
@@ -83,13 +85,14 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt", false) //
         case CMD_REQUEST_USAGE:
         {
             LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpweapons [<filename>]");
-            LOG_HELP("  Where <filename> is the file to write (default is weapons_dump.cfg),");
+            LOG_HELPF("  Where <filename> is the file to write (default is %s),", DEFAULT_FILENAME);
             LOG_HELP("  if supplied with '-' output to console as well as default,");
             LOG_HELP("  if left blank, it will only write to default.");
             return;
         }
     }
 }
+#undef DEFAULT_FILENAME
 
 #ifdef SVQC
 entity W_PROP_reloader;