]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/command/rpn.qc
Merge remote-tracking branch 'origin/mrbougo/killspree_bugfix'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / command / rpn.qc
index a5a68f62f129b416b21877cf2d9f48fce2fa2115..5cca2db1ce666145fb7f339925daacaf3ce8f756 100644 (file)
@@ -1,3 +1,8 @@
+// ========================================
+//  RPN command code, written by divVerent
+//  Last updated: December 28th, 2011
+// ========================================
+
 string rpn_pop() 
 {
        if(rpn_sp > 0) {
@@ -50,9 +55,9 @@ void GenericCommand_rpn(float request, float argc, string command)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       float i, j, f, n, f2, f3, rpnpos;
-                       vector rgb;
-                       string s, s2, c, rpncmd;
+                       float i, j, f, f2, f3, rpnpos;
+                       //vector rgb;
+                       string s, s2, rpncmd;
                        
                        if(!rpn_db)
                        {
@@ -63,9 +68,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)
@@ -234,9 +236,9 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                        i = stof(db_get(rpn_db, "stack.pointer"));
                                                        db_put(rpn_db, "stack.pointer", ftos(i+1));
                                                        db_put(rpn_db, strcat("stack.", ftos(i)), s);
+                                                       if(!i)
+                                                               db_put(rpn_db, "stack.pos", "0");
                                                }
-                                               if(!i)
-                                                       db_put(rpn_db, "stack.pos", "0");
                                        } else if(rpncmd == "dbpop") {
                                                i = stof(db_get(rpn_db, "stack.pointer"));
                                                if(i)
@@ -519,7 +521,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");
@@ -554,4 +556,4 @@ void GenericCommand_rpn(float request, float argc, string command)
                        return;
                }
        }
-}
\ No newline at end of file
+}