From 49e92f4288f5eb3f0b5a2274b979e1d04a0b3638 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 19 Aug 2021 01:27:26 +0200 Subject: [PATCH] addstep, protected cw+wstep --- rulegen.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rulegen.cpp b/rulegen.cpp index a5f4718d..212b2019 100644 --- a/rulegen.cpp +++ b/rulegen.cpp @@ -123,6 +123,12 @@ EX void ufindc(tcell*& c) { EX tcell *first_tcell = nullptr; +twalker addstep(twalker x) { + x.cpeek(); + ufind(x); + return x + wstep; + } + void connect_and_check(twalker p1, twalker p2); void unify(twalker pw1, twalker pw2); @@ -771,7 +777,7 @@ void treewalk(twalker& cw, int delta) { int d = get_parent_dir(cw.at); if(cw.spin == d) cw += wstep; else { - auto cw1 = cw+wstep; + auto cw1 = addstep(cw); get_parent_dir(cw1.at); ufind(cw1); if(get_parent_dir(cw1.at) == cw1.spin) cw += wstep;