From 6c42322e57944159ca34c8f5a78cdef1f23e75e5 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 3 Oct 2013 17:09:00 +0200 Subject: [PATCH] fix eval and when commands. Now this works: rpn /i 91 def /k 2 def "/\"/pop 1\" \"/\\\"//k k 1 add def dup eval\\\" \\\"/pop 0\\\" i k mod 0 > when eval\" k k mul i > when eval" dup eval --- qcsrc/common/command/rpn.qc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/qcsrc/common/command/rpn.qc b/qcsrc/common/command/rpn.qc index 4fc918c4a..374d07df1 100644 --- a/qcsrc/common/command/rpn.qc +++ b/qcsrc/common/command/rpn.qc @@ -222,12 +222,12 @@ void GenericCommand_rpn(float request, float argc, string command) rpn_setf(bound(f3, f2, f)); } else if(rpncmd == "when") { f = rpn_popf(); - f2 = rpn_popf(); - f3 = rpn_getf(); + s = rpn_pop(); + s2 = rpn_get(); if(f) - rpn_setf(f3); + rpn_set(s2); else - rpn_setf(f2); + rpn_set(s); } else if(rpncmd == ">" || rpncmd == "gt") { f = rpn_popf(); rpn_setf(rpn_getf() > f); @@ -537,7 +537,8 @@ void GenericCommand_rpn(float request, float argc, string command) rpn_set(sprintf(s, rpn_get())); } else if(rpncmd == "eval") { s = rpn_pop(); - tokenize_console(strcat(s, substring(command, argv_end_index(rpnpos), -1))); + command = strcat(s, substring(command, argv_end_index(rpnpos), -1)); + argc = tokenize_console(command); rpnpos = -1; } else { rpn_push(cvar_string(rpncmd)); -- 2.39.2