1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-02-02 20:29:17 +00:00

handlers for createStep and newmap

This commit is contained in:
Zeno Rogue 2018-11-30 14:37:59 +01:00
parent ce996c82fe
commit bf7bb61d35
4 changed files with 11 additions and 3 deletions

View File

@ -1165,11 +1165,15 @@ euc_pointer euclideanAtCreate(int vec) {
return ep; return ep;
} }
hookset<hrmap*()> *hooks_newmap;
// initializer (also inits origin from heptagon.cpp) // initializer (also inits origin from heptagon.cpp)
void initcells() { void initcells() {
DEBB(DF_INIT, (debugfile,"initcells\n")); 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(fulltorus) currentmap = new hrmap_torus;
else if(euclid) currentmap = new hrmap_euclidean; else if(euclid) currentmap = new hrmap_euclidean;
else if(sphere) currentmap = new hrmap_spherical; else if(sphere) currentmap = new hrmap_spherical;

View File

@ -1660,7 +1660,7 @@ vector<eLand> randlands = {
static const int qNONOR = qNONORIENTABLE; static const int qNONOR = qNONORIENTABLE;
geometryinfo ginf[gGUARD] = { vector<geometryinfo> ginf = {
{"standard", "HR", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::bitruncated}, {"standard", "HR", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::bitruncated},
{"Euclidean", "euclid", 6, 3, 0, gcEuclid, 0, {{7, FORBIDDEN}}, 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}, {"spherical", "sphere", 5, 3, 0, gcSphere, 0, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated},

View File

@ -235,7 +235,7 @@ static const int FORBIDDEN = -1;
extern eGeometry geometry; extern eGeometry geometry;
extern eVariation variation; extern eVariation variation;
extern geometryinfo ginf[gGUARD]; extern std::vector<geometryinfo> ginf;
extern monstertype minf[motypes]; extern monstertype minf[motypes];
extern itemtype iinf[ittypes]; extern itemtype iinf[ittypes];

View File

@ -198,8 +198,12 @@ extern int hrand(int);
// a structure used to walk on the heptagonal tesselation // a structure used to walk on the heptagonal tesselation
// (remembers not only the heptagon, but also direction) // (remembers not only the heptagon, but also direction)
hookset<void(heptagon*, int)> *hooks_createStep;
heptagon *createStep(heptagon *h, int d) { heptagon *createStep(heptagon *h, int d) {
d = h->c.fix(d); d = h->c.fix(d);
if(!h->move(d))
callhooks(hooks_createStep, h, d);
if(!h->move(d) && binarytiling) if(!h->move(d) && binarytiling)
return binary::createStep(h, d); return binary::createStep(h, d);
if(!h->move(d) && archimedean) { if(!h->move(d) && archimedean) {