From 1eee4340943c7ce1650fb64c58771b45e9816cb6 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 1 Mar 2019 04:12:22 +0100 Subject: [PATCH] 3d: Euclidean uses constant COORDMAX instead of magic 1000 --- euclid.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/euclid.cpp b/euclid.cpp index c10ce3db..02ea1628 100644 --- a/euclid.cpp +++ b/euclid.cpp @@ -471,6 +471,8 @@ namespace euclid3 { typedef long long coord; + static const long long COORDMAX = (1<<16); + struct hrmap_euclid3 : hrmap { map spacemap; map ispacemap; @@ -502,8 +504,8 @@ namespace euclid3 { } heptagon *createStep(heptagon *parent, int d) { - int at = ispacemap[parent]; - coord shifttable[6] = { +1, +1000, +1000000, -1, -1000, -1000000 }; + coord at = ispacemap[parent]; + const coord shifttable[6] = { +1, +COORDMAX, +COORDMAX*COORDMAX, -1, -COORDMAX, -COORDMAX*COORDMAX }; return build(parent, d, at + shifttable[d]); } }; @@ -521,10 +523,10 @@ namespace euclid3 { } int getcoord(coord x, int a) { - for(int k=0; k500) x -= 1000; - if(x<-500) x += 1000; + for(int k=0; kCOORDMAX/2) x -= COORDMAX; + if(x<-COORDMAX/2) x += COORDMAX; return x; }