From 072041db06fa78bec0a4d45c7ef473764d89769f Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 11 Jan 2024 15:23:05 +0100 Subject: [PATCH] savemem:: make sure it is not the same altmap --- savemem.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/savemem.cpp b/savemem.cpp index 08c3ba6f..829ac3dc 100644 --- a/savemem.cpp +++ b/savemem.cpp @@ -116,8 +116,12 @@ EX void save_memory() { } } - while(celldist(at->c7) > d-LIM) at = at->move(0); - + while(celldist(at->c7) > d-LIM && at != orig) at = at->move(0); + + // make sure it is not the same altmap + auto atalt = at->alt; if(atalt) atalt = atalt->alt; + while(atalt && at != orig && at->alt && at->alt->alt == atalt) at = at->move(0); + // go back to such a point X that all the heptagons adjacent to the current 'at' // are the children of X. This X becomes the new 'at' if(true) {