From: Rudolf Polzer Date: Thu, 3 Oct 2013 15:09:00 +0000 (+0200) Subject: fix eval and when commands. Now this works: X-Git-Tag: xonotic-v0.8.0~307 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6c42322e57944159ca34c8f5a78cdef1f23e75e5;p=xonotic%2Fxonotic-data.pk3dir.git 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 --- 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));