]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make it compilable :D
authorSamual <samual@xonotic.org>
Wed, 28 Dec 2011 16:54:19 +0000 (11:54 -0500)
committerSamual <samual@xonotic.org>
Wed, 28 Dec 2011 16:54:19 +0000 (11:54 -0500)
qcsrc/client/progs.src
qcsrc/common/command/generic.qc
qcsrc/common/command/generic.qh
qcsrc/common/command/rpn.qc
qcsrc/common/command/shared_defs.qh
qcsrc/dpdefs/menudefs.qc
qcsrc/menu/progs.src
qcsrc/server/progs.src

index cc11918985544a42e9c3f3a59268d07a02924594..d869d663bb85d394a946c25c7dae7e4130ffb097 100644 (file)
@@ -18,6 +18,7 @@ Defs.qc
 ../common/items.qh
 ../common/explosion_equation.qh
 ../common/mapinfo.qh
+../common/command/rpn.qh
 ../common/command/generic.qh
 ../common/command/shared_defs.qh
 
@@ -88,6 +89,7 @@ bgmscript.qc
 noise.qc
 
 ../common/util.qc
+../common/command/rpn.qc
 ../common/command/generic.qc
 ../common/mapinfo.qc
 ../common/items.qc
index 856f29bc8d6d8e8fa8326ff4af2173fc53957f7a..d90a3f7fe9e55b41c2747bbeaed1319d7cb9dd34 100644 (file)
@@ -3,7 +3,8 @@
 //  Last updated: December 28th, 2011
 // =========================================================
 
-string GetProgamCommandPrefix()
+// used by generic commands for better help/usage information
+string GetProgramCommandPrefix(void)
 {
        #ifdef SVQC
        return "sv_cmd";
@@ -127,35 +128,40 @@ string GameCommand_Markup(string s2)
        return s;
 }
 
-void GenericCommand_addtolist(float request)
+void GenericCommand_addtolist(float request, float argc)
 {
        switch(request)
        {
                case CMD_REQUEST_COMMAND:
                {
+                       float i;
+                       
                        if(argc >= 2)
                        {
-                               s = argv(1);
-                               s2 = argv(2);
-                               if(cvar_string(s) == "")
-                                       cvar_set(s, s2);
-                               else 
+                               if(cvar_string(argv(1)) == "") // cvar was empty
                                {
-                                       n = tokenizebyseparator(cvar_string(s), " ");
-                                       for(i = 0; i < n; ++i)
-                                               if(argv(i) == s2)
+                                       cvar_set(argv(1), argv(2));
+                               }
+                               else // add it to the end of the list if the list doesn't already have it
+                               {
+                                       argc = tokenizebyseparator(cvar_string(argv(1)), " ");
+                                       for(i = 0; i < argc; ++i)
+                                               if(argv(i) == argv(2))
                                                        return; // already in list
-                                       cvar_set(s, strcat(s2, " ", cvar_string(s)));
+                                                       
+                                       cvar_set(argv(1), strcat(argv(2), " ", cvar_string(argv(1))));
                                }
+                               return;
                        }
-                       return;
                }
                        
                default:
+                       // todo
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(caller), " ")));
-                       print("  No arguments required.\n");
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable [value]"));
+                       print("  Where 'variable' is what to add to the list,\n");
+                       print("  and 'value' is any extra optional paramaters to add with quotes.");
                        return;
                }
        }
@@ -239,7 +245,7 @@ void GenericCommand_maplist(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(caller), " maplist command [map]"))); // todo
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist command [map]")); // todo
                        print("  No arguments required.\n");
                        return;
                }
@@ -267,7 +273,7 @@ void GenericCommand_settemp(float request, float argc)
                        print("Incorrect parameters for ^2settemp^7\n");
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(caller), " settemp \"cvar\" \"arguments\"\n"));
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp \"cvar\" \"arguments\"\n"));
                        print("  Where 'cvar' is the cvar you want to temporarily set with 'arguments'.\n");
                        return;
                }
@@ -293,7 +299,7 @@ void GenericCommand_settemp_restore(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(caller), " settemp_restore\n"));
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp_restore\n"));
                        print("  No arguments required.\n");
                        return;
                }
@@ -315,7 +321,7 @@ void GenericCommand_(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(caller), " ")));
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " ")));
                        print("  No arguments required.\n");
                        return;
                }
@@ -378,6 +384,9 @@ float GenericCommand_macro_usage(float argc)
 float GenericCommand(string command)
 {
        float argc = tokenize_console(command);
+       float n, j, f, i;
+       string s, s2, c;
+       vector rgb;
 
        // Guide for working with argc arguments by example:
        // argc:   1    - 2      - 3     - 4
@@ -396,9 +405,9 @@ float GenericCommand(string command)
                        return TRUE;
                }
        } 
-       else if(GenericCommand_macro_command(argc)) // continue as usual and scan for normal commands
+       else if(GenericCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
        {
-               return TRUE; // handled by one of the above LocalCommand_* functions
+               return TRUE; // handled by one of the above GenericCommand_* functions
        }
        else if(argc >= 3 && argv(0) == "red")
        {
index 1bfd3b439f542660b9807fdb0fde27a39c0d9792..d6abcea03a980b5d0ab4a51c48e7fb903060a663 100644 (file)
@@ -1,2 +1,4 @@
 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
+
+// returns command prefix specific for each program it is compiled in
+string GetProgramCommandPrefix(void); 
\ No newline at end of file
index a5a68f62f129b416b21877cf2d9f48fce2fa2115..5a50577a12c17dcee10cde6e702891e043b61af8 100644 (file)
@@ -63,9 +63,6 @@ void GenericCommand_rpn(float request, float argc, string command)
                        
                        if(argc >= 2)
                        {
-                               float rpnpos;
-                               string rpncmd;
-                               float f2, f3;
                                rpn_sp = 0;
                                rpn_error = FALSE;
                                for(rpnpos = 1; rpnpos < argc; ++rpnpos)
@@ -519,7 +516,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print("  rpn EXPRESSION... - a RPN calculator.\n");
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " rpn EXPRESSION...\n"));
                        print("    Operator description (x: string, s: set, f: float):\n");
                        print("    x pop ----------------------------->     : removes the top\n");
                        print("    x dup -----------------------------> x x : duplicates the top\n");
index 777608b880bdfcf765114635561ee7cdf31a06ce..f06ee3239d67f3ddfccd7ad32545027a3addebf0 100644 (file)
@@ -5,4 +5,4 @@
 
 // identifiers for subfunction requests by the command code structure
 #define CMD_REQUEST_COMMAND 1
-#define CMD_REQUEST_USAGE 2
+#define CMD_REQUEST_USAGE 2
\ No newline at end of file
index 8fc5f56f01bfea64bb3fd3b009428dc050e3b598..cf15840a85ab7fcf403b5d4fa3daa0249b40562d 100644 (file)
@@ -431,6 +431,15 @@ float(float bufhandle, string str, float order) bufstr_add = #448;
 void(float bufhandle, float string_index) bufstr_free = #449;
 void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
 
+//DP_QC_STRING_CASE_FUNCTIONS
+//idea: Dresk
+//darkplaces implementation: LordHavoc / Dresk
+//builtin definitions:
+string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
+string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
+//description:
+//provides simple string uppercase and lowercase functions
+
 //DP_QC_CVAR_DESCRIPTION
 //idea: divVerent
 //DarkPlaces implementation: divVerent
index 84b65e12f3f30fc2a6ac2250406fe6e392707f4d..0af6bebe5566538c31d32821194acf1405dfadf9 100644 (file)
@@ -15,6 +15,7 @@ oo/base.h
 ../common/mapinfo.qh
 ../common/campaign_common.qh
 ../common/items.qh
+../common/command/rpn.qh
 ../common/command/generic.qh
 ../common/command/shared_defs.qh
 
@@ -30,6 +31,7 @@ oo/implementation.h
        classes.c
 
 ../common/util.qc
+../common/command/rpn.qc
 ../common/command/generic.qc
 command/menu_cmd.qc
 menu.qc
index d99b078914064985910b36b9334620b100fd5303..0280a7f8a81e1062c1ec0ff3d03c60176cf49054 100644 (file)
@@ -17,6 +17,7 @@ sys-post.qh
 ../common/items.qh
 ../common/explosion_equation.qh
 ../common/urllib.qh
+../common/command/rpn.qh
 ../common/command/generic.qh
 ../common/command/shared_defs.qh
 
@@ -146,6 +147,7 @@ campaign.qc
 ../common/campaign_setup.qc
 ../common/urllib.qc
 
+../common/command/rpn.qc
 ../common/command/generic.qc
 command/common.qc
 command/ipban.qc