]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
GetProgramCommandPrefix() -- allows me to have enhanced usage and such
authorSamual <samual@xonotic.org>
Wed, 28 Dec 2011 01:55:50 +0000 (20:55 -0500)
committerSamual <samual@xonotic.org>
Wed, 28 Dec 2011 01:55:50 +0000 (20:55 -0500)
descriptions within the common commands

qcsrc/common/command/generic.qc
qcsrc/common/command/generic.qh
qcsrc/common/util.qc

index a260c0fa791386168ffcde49718cf90464f6a7f5..85849b3290791efceaef793d219acb9444d30567 100644 (file)
@@ -3,6 +3,19 @@
 //  Last updated: December 28th, 2011
 // =========================================================
 
+string GetProgamCommandPrefix()
+{
+       #ifdef SVQC
+       return "sv_cmd";
+       #endif
+       #ifdef CSQC
+       return "cl_cmd";
+       #endif
+       #ifdef MENUQC
+       return "menu_cmd";
+       #endif
+}
+
 #define NUM_MARKUPS    41
 float markup_init;
 string markup_from[NUM_MARKUPS];
@@ -141,7 +154,7 @@ void GenericCommand_addtolist(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd \n");
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(caller), " ")));
                        print("  No arguments required.\n");
                        return;
                }
@@ -163,7 +176,7 @@ void GenericCommand_(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd \n");
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(caller), " ")));
                        print("  No arguments required.\n");
                        return;
                }
index ee7097a4c72096cc8bae703045c0e63f82236158..1bfd3b439f542660b9807fdb0fde27a39c0d9792 100644 (file)
@@ -1,2 +1,2 @@
-// empty for now
-float GenericCommand(string command); // returns true if handled, false if not. Note: It tokenizes its input, so be careful!
\ No newline at end of file
+float GenericCommand(string command); // returns true if handled, false if not. Note: It tokenizes its input, so be careful!
+string GetProgamCommandPrefix(); // returns command prefix specific for each program it is compiled in
\ No newline at end of file
index 69fde0f99d368d17901b2b5cae2634896bae6424..5e7845bbc4f3c42d80cb06a5e006df8af2330c17 100644 (file)
@@ -2162,6 +2162,7 @@ entity ReadCSQCEntity()
        return findfloat(world, entnum, f);
 }
 #endif
+
 float shutdown_running;
 #ifdef SVQC
 void SV_Shutdown()
@@ -2183,4 +2184,4 @@ void m_shutdown()
                Shutdown();
        }
        cvar_settemp_restore(); // this must be done LAST, but in any case
-}
\ No newline at end of file
+}