mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-03 17:27:03 +00:00
hrmap_binary no longer inherits from hrmap_hyperbolic (Liskov substitution fail)
This commit is contained in:
parent
9f6f3232b5
commit
4e534261f0
@ -181,17 +181,29 @@ EX namespace binary {
|
||||
}
|
||||
#endif
|
||||
|
||||
struct hrmap_binary : hrmap_hyperbolic {
|
||||
struct hrmap_binary : hrmap {
|
||||
|
||||
heptagon *origin;
|
||||
std::mt19937 directions_generator;
|
||||
|
||||
hrmap_binary(heptagon *o) : hrmap_hyperbolic(o) { set_seed(); }
|
||||
hrmap_binary(heptagon *o) : origin(o) { set_seed(); }
|
||||
|
||||
void set_seed() { directions_generator.seed(137137137); }
|
||||
|
||||
int nextdir(int choices) { return directions_generator() % choices; }
|
||||
|
||||
hrmap_binary() : hrmap_hyperbolic() { set_seed(); }
|
||||
hrmap_binary() {
|
||||
set_seed();
|
||||
origin = hyperbolic_origin();
|
||||
#if DEBUG_BINARY_TILING
|
||||
binary::xcode.clear();
|
||||
binary::rxcode.clear();
|
||||
binary::xcode[&h] = (1 << 16);
|
||||
binary::rxcode[1<<16] = &h;
|
||||
#endif
|
||||
origin->zebraval = 0;
|
||||
origin->emeraldval = 0;
|
||||
}
|
||||
|
||||
heptagon *create_step(heptagon *parent, int d) override {
|
||||
auto h = parent;
|
||||
|
35
cell.cpp
35
cell.cpp
@ -109,12 +109,8 @@ EX vector<hrmap*> allmaps;
|
||||
EX hrmap *newAltMap(heptagon *o) { return new hrmap_hyperbolic(o); }
|
||||
// --- hyperbolic geometry ---
|
||||
|
||||
hrmap_hyperbolic::hrmap_hyperbolic(heptagon *o) { origin = o; }
|
||||
|
||||
hrmap_hyperbolic::hrmap_hyperbolic() {
|
||||
// printf("Creating hyperbolic map: %p\n", this);
|
||||
int odegree = geometry == gBinaryTiling ? 6 : S7;
|
||||
origin = tailored_alloc<heptagon> (odegree);
|
||||
heptagon* hyperbolic_origin() {
|
||||
heptagon *origin = tailored_alloc<heptagon> (odegree);
|
||||
heptagon& h = *origin;
|
||||
h.s = hsOrigin;
|
||||
h.emeraldval = a46 ? 0 : 98;
|
||||
@ -125,28 +121,15 @@ hrmap_hyperbolic::hrmap_hyperbolic() {
|
||||
h.cdata = NULL;
|
||||
h.alt = NULL;
|
||||
h.distance = 0;
|
||||
mvar = variation;
|
||||
if(0);
|
||||
#if CAP_BT
|
||||
else if(binarytiling) {
|
||||
#if DEBUG_BINARY_TILING
|
||||
binary::xcode.clear();
|
||||
binary::rxcode.clear();
|
||||
binary::xcode[&h] = (1 << 16);
|
||||
binary::rxcode[1<<16] = &h;
|
||||
#endif
|
||||
h.zebraval = 0, h.emeraldval = 0,
|
||||
h.c7 = newCell(odegree, origin);
|
||||
}
|
||||
#endif
|
||||
#if CAP_IRR
|
||||
else if(IRREGULAR)
|
||||
irr::link_start(origin);
|
||||
#endif
|
||||
else
|
||||
h.c7 = newCell(S7, origin);
|
||||
if(IRREGULAR) irr::link_start(origin);
|
||||
h.c7 = newCell(geometry == gBinaryTiling ? 6 : S7, origin);
|
||||
return origin;
|
||||
}
|
||||
|
||||
hrmap_hyperbolic::hrmap_hyperbolic(heptagon *o) { origin = o; }
|
||||
|
||||
hrmap_hyperbolic::hrmap_hyperbolic() { origin = hyperbolic_origin(); }
|
||||
|
||||
/** very similar to createMove in heptagon.cpp */
|
||||
EX cell *createMov(cell *c, int d) {
|
||||
if(d<0 || d>= c->type) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user