From ad930802316ff8048455faea00ee87d903335813 Mon Sep 17 00:00:00 2001 From: Samual Date: Tue, 27 Dec 2011 20:55:50 -0500 Subject: [PATCH] GetProgramCommandPrefix() -- allows me to have enhanced usage and such descriptions within the common commands --- qcsrc/common/command/generic.qc | 17 +++++++++++++++-- qcsrc/common/command/generic.qh | 4 ++-- qcsrc/common/util.qc | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index a260c0fa7..85849b329 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -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; } diff --git a/qcsrc/common/command/generic.qh b/qcsrc/common/command/generic.qh index ee7097a4c..1bfd3b439 100644 --- a/qcsrc/common/command/generic.qh +++ b/qcsrc/common/command/generic.qh @@ -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 diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 69fde0f99..5e7845bbc 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -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 +} -- 2.39.2