From bf7bb61d35eb7d6ac03b798a664331717cd6cc4d Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 30 Nov 2018 14:37:59 +0100 Subject: [PATCH] handlers for createStep and newmap --- cell.cpp | 6 +++++- classes.cpp | 2 +- classes.h | 2 +- heptagon.cpp | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cell.cpp b/cell.cpp index dd73d460..bae931ca 100644 --- a/cell.cpp +++ b/cell.cpp @@ -1165,11 +1165,15 @@ euc_pointer euclideanAtCreate(int vec) { return ep; } +hookset *hooks_newmap; + // initializer (also inits origin from heptagon.cpp) void initcells() { DEBB(DF_INIT, (debugfile,"initcells\n")); - if(archimedean) currentmap = arcm::new_map(); + hrmap* res = callhandlers((hrmap*)nullptr, hooks_newmap); + if(res) currentmap = res; + else if(archimedean) currentmap = arcm::new_map(); else if(fulltorus) currentmap = new hrmap_torus; else if(euclid) currentmap = new hrmap_euclidean; else if(sphere) currentmap = new hrmap_spherical; diff --git a/classes.cpp b/classes.cpp index 670cad42..f686fdda 100644 --- a/classes.cpp +++ b/classes.cpp @@ -1660,7 +1660,7 @@ vector randlands = { static const int qNONOR = qNONORIENTABLE; -geometryinfo ginf[gGUARD] = { +vector ginf = { {"standard", "HR", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::bitruncated}, {"Euclidean", "euclid", 6, 3, 0, gcEuclid, 0, {{7, FORBIDDEN}}, eVariation::bitruncated}, {"spherical", "sphere", 5, 3, 0, gcSphere, 0, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, diff --git a/classes.h b/classes.h index 72141c29..c7074d7e 100644 --- a/classes.h +++ b/classes.h @@ -235,7 +235,7 @@ static const int FORBIDDEN = -1; extern eGeometry geometry; extern eVariation variation; -extern geometryinfo ginf[gGUARD]; +extern std::vector ginf; extern monstertype minf[motypes]; extern itemtype iinf[ittypes]; diff --git a/heptagon.cpp b/heptagon.cpp index bc83db16..c316b319 100644 --- a/heptagon.cpp +++ b/heptagon.cpp @@ -198,8 +198,12 @@ extern int hrand(int); // a structure used to walk on the heptagonal tesselation // (remembers not only the heptagon, but also direction) +hookset *hooks_createStep; + heptagon *createStep(heptagon *h, int d) { d = h->c.fix(d); + if(!h->move(d)) + callhooks(hooks_createStep, h, d); if(!h->move(d) && binarytiling) return binary::createStep(h, d); if(!h->move(d) && archimedean) {