From 4287ddf883f6ce45c8f99a0bc52f212594d14640 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 28 Jan 2020 10:20:39 +0100 Subject: [PATCH] default_levs() as a function --- bigstuff.cpp | 8 ++++++++ cell.cpp | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index ef324d9a..f03b200d 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -133,6 +133,14 @@ EX bool grailWasFound(cell *c) { return c->master->alt->alt->emeraldval & GRAIL_FOUND; } +EX int default_levs() { + if(IRREGULAR) + return 1; + if(S3 >= OINF) + return 1; + return S3-3; + } + void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { if(hybri) { PIU ( generateAlts(h, levs, link_cdata) ); } if(!h->alt) return; diff --git a/cell.cpp b/cell.cpp index 99e50614..daf9150f 100644 --- a/cell.cpp +++ b/cell.cpp @@ -11,6 +11,8 @@ namespace hr { #if HDR +extern int default_levs(); + struct hrmap { virtual heptagon *getOrigin() { return NULL; } virtual cell *gamestart() { return getOrigin()->c7; } @@ -18,7 +20,7 @@ struct hrmap { virtual vector& allcells(); virtual void verify() { } virtual void link_alt(const cellwalker& hs) { } - virtual void generateAlts(heptagon *h, int levs = IRREGULAR ? 1 : S3 >= OINF ? 1 : S3-3, bool link_cdata = true); + virtual void generateAlts(heptagon *h, int levs = default_levs(), bool link_cdata = true); heptagon *may_create_step(heptagon *h, int direction) { if(h->move(direction)) return h->move(direction); return create_step(h, direction);