From 1dd6eddead6c5005c3bd99d732b44fa3275ff21a Mon Sep 17 00:00:00 2001 From: "Adam P. Goucher" Date: Wed, 25 Oct 2017 11:11:00 +0100 Subject: [PATCH] Major bugfix --- bitworld.h | 2 +- pattern2.h | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bitworld.h b/bitworld.h index 18809ae..ef124b8 100644 --- a/bitworld.h +++ b/bitworld.h @@ -1,6 +1,6 @@ #pragma once -#define LIFELIB_VERSION "ll1.21" +#define LIFELIB_VERSION "ll1.22" #include "bitbounds.h" #include diff --git a/pattern2.h b/pattern2.h index 93e6ac2..ece8297 100644 --- a/pattern2.h +++ b/pattern2.h @@ -231,33 +231,34 @@ namespace apg { // Set operations (mutable): - pattern& operator&=(const pattern &other) { - hnode = lab->boolean_universe(hnode, coerce(other), 0); + void changehnode(hypernode hn) { + hnode = hn; lab->sethandle(ihandle, hnode); + this->dt = 0; this->minp = 0; this->dx = 0; this->dy = 0; + } + + pattern& operator&=(const pattern &other) { + changehnode(lab->boolean_universe(hnode, coerce(other), 0)); return *this; } pattern& operator|=(const pattern &other) { - hnode = lab->boolean_universe(hnode, coerce(other), 1); - lab->sethandle(ihandle, hnode); + changehnode(lab->boolean_universe(hnode, coerce(other), 1)); return *this; } pattern& operator^=(const pattern &other) { - hnode = lab->boolean_universe(hnode, coerce(other), 2); - lab->sethandle(ihandle, hnode); + changehnode(lab->boolean_universe(hnode, coerce(other), 2)); return *this; } pattern& operator-=(const pattern &other) { - hnode = lab->boolean_universe(hnode, coerce(other), 3); - lab->sethandle(ihandle, hnode); + changehnode(lab->boolean_universe(hnode, coerce(other), 3)); return *this; } pattern& operator+=(const pattern &other) { - hnode = lab->boolean_universe(hnode, coerce(other), 1); - lab->sethandle(ihandle, hnode); + changehnode(lab->boolean_universe(hnode, coerce(other), 1)); return *this; } -- 2.18.1