From bb6df35bf27e2249aa37644ce47e0bd681343a9f Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 27 May 2024 12:45:49 +0200 Subject: [PATCH] moved wallif to parsecolor from general parse --- util.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/util.cpp b/util.cpp index 87442923..12047f09 100644 --- a/util.cpp +++ b/util.cpp @@ -339,13 +339,6 @@ cld exp_parser::parse(int prio) { cld no = parsepar(); res = abs(cond) < 1e-8 ? yes : no; } - else if(eat("wallif(")) { - cld val0 = parse(0); - force_eat(","); - cld val1 = parsepar(); - if(real(extra_params["p"]) >= 3.5) res = val0; - else res = val1; - } else if(eat("let(")) { string name = next_token(); force_eat("="); @@ -555,6 +548,15 @@ color_t exp_parser::parsecolor(int prio) { force_eat(")"); return part_to_col(parts); } + if(eat("wallif(")) { + ld val0 = rparse(); + force_eat(","); + color_t res = parsecolor(); + force_eat(")"); + res &= 0xFFFFFF; + if(val0 <= 0) res |= 0x1000000; + return res; + } if(eat("rgb(")) { array parts; parts[3] = rparse(); force_eat(",");