mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-03 12:49:17 +00:00
proper hrmap_* for syntetic; fixed a bug when deleting
This commit is contained in:
parent
d094417cf6
commit
c42940684c
8
cell.cpp
8
cell.cpp
@ -65,9 +65,7 @@ hrmap_hyperbolic::hrmap_hyperbolic() {
|
|||||||
h.alt = NULL;
|
h.alt = NULL;
|
||||||
h.distance = 0;
|
h.distance = 0;
|
||||||
isnonbitrunc = nonbitrunc;
|
isnonbitrunc = nonbitrunc;
|
||||||
if(syntetic)
|
if(binarytiling) {
|
||||||
synt::initialize(&h);
|
|
||||||
else if(binarytiling) {
|
|
||||||
#if DEBUG_BINARY_TILING
|
#if DEBUG_BINARY_TILING
|
||||||
binary::xcode.clear();
|
binary::xcode.clear();
|
||||||
binary::rxcode.clear();
|
binary::rxcode.clear();
|
||||||
@ -876,7 +874,7 @@ cell*& euclideanAtCreate(int vec) {
|
|||||||
void initcells() {
|
void initcells() {
|
||||||
DEBB(DF_INIT, (debugfile,"initcells\n"));
|
DEBB(DF_INIT, (debugfile,"initcells\n"));
|
||||||
|
|
||||||
if(syntetic) currentmap = new hrmap_hyperbolic;
|
if(syntetic) currentmap = synt::new_map();
|
||||||
else if(torus) currentmap = new hrmap_torus;
|
else if(torus) 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;
|
||||||
@ -957,7 +955,7 @@ void clearfrom(heptagon *at) {
|
|||||||
at->cdata = NULL;
|
at->cdata = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int edges = S7;
|
int edges = at->degree();
|
||||||
if(binarytiling) edges = at->c7->type;
|
if(binarytiling) edges = at->c7->type;
|
||||||
for(int i=0; i<edges; i++) if(at->move(i)) {
|
for(int i=0; i<edges; i++) if(at->move(i)) {
|
||||||
if(at->move(i)->alt != &deletion_marker)
|
if(at->move(i)->alt != &deletion_marker)
|
||||||
|
82
syntetic.cpp
82
syntetic.cpp
@ -270,40 +270,70 @@ map<heptagon*, vector<pair<heptagon*, transmatrix> > > altmap;
|
|||||||
|
|
||||||
map<heptagon*, pair<heptagon*, transmatrix>> syntetic_gmatrix;
|
map<heptagon*, pair<heptagon*, transmatrix>> syntetic_gmatrix;
|
||||||
|
|
||||||
void initialize(heptagon *h) {
|
hrmap *current_altmap;
|
||||||
|
|
||||||
/* initialize the root */
|
struct hrmap_syntetic : hrmap {
|
||||||
|
heptagon *origin;
|
||||||
|
heptagon *getOrigin() { return origin; }
|
||||||
|
|
||||||
parent_index_of(h) = 0;
|
hrmap_syntetic() {
|
||||||
id_of(h) = 0;
|
origin = new heptagon;
|
||||||
h->c7 = newCell(isize(adjacent[0]), h);
|
origin->s = hsOrigin;
|
||||||
|
origin->emeraldval = 0;
|
||||||
|
origin->zebraval = 0;
|
||||||
|
origin->fiftyval = 0;
|
||||||
|
origin->fieldval = 0;
|
||||||
|
origin->rval0 = origin->rval1 = 0;
|
||||||
|
origin->cdata = NULL;
|
||||||
|
origin->c.clear();
|
||||||
|
origin->alt = NULL;
|
||||||
|
origin->distance = 0;
|
||||||
|
|
||||||
heptagon *alt = NULL;
|
parent_index_of(origin) = 0;
|
||||||
|
id_of(origin) = 0;
|
||||||
|
origin->c7 = newCell(isize(adjacent[0]), origin);
|
||||||
|
|
||||||
if(hyperbolic) {
|
heptagon *alt = NULL;
|
||||||
dynamicval<eGeometry> g(geometry, gNormal);
|
|
||||||
alt = new heptagon;
|
if(hyperbolic) {
|
||||||
alt->s = hsOrigin;
|
dynamicval<eGeometry> g(geometry, gNormal);
|
||||||
alt->emeraldval = 0;
|
alt = new heptagon;
|
||||||
alt->zebraval = 0;
|
alt->s = hsOrigin;
|
||||||
alt->c.clear();
|
alt->emeraldval = 0;
|
||||||
alt->distance = 0;
|
alt->zebraval = 0;
|
||||||
alt->c7 = NULL;
|
alt->c.clear();
|
||||||
alt->alt = alt;
|
alt->distance = 0;
|
||||||
alt->cdata = NULL;
|
alt->c7 = NULL;
|
||||||
newAltMap(alt);
|
alt->alt = alt;
|
||||||
|
alt->cdata = NULL;
|
||||||
|
current_altmap = newAltMap(alt);
|
||||||
|
}
|
||||||
|
|
||||||
|
transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id;
|
||||||
|
syntetic_gmatrix[origin] = make_pair(alt, T);
|
||||||
|
altmap[alt].emplace_back(origin, T);
|
||||||
|
|
||||||
|
base_distlimit = 0;
|
||||||
|
celllister cl(origin->c7, 1000, 200, NULL);
|
||||||
|
base_distlimit = cl.dists.back();
|
||||||
|
if(sphere) base_distlimit = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id;
|
~hrmap_syntetic() {
|
||||||
syntetic_gmatrix[h] = make_pair(alt, T);
|
clearfrom(origin);
|
||||||
altmap[alt].emplace_back(h, T);
|
altmap.clear();
|
||||||
|
syntetic_gmatrix.clear();
|
||||||
base_distlimit = 0;
|
if(current_altmap) {
|
||||||
celllister cl(h->c7, 1000, 200, NULL);
|
dynamicval<eGeometry> g(geometry, gNormal);
|
||||||
base_distlimit = cl.dists.back();
|
delete current_altmap;
|
||||||
if(sphere) base_distlimit = 15;
|
current_altmap = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void verify() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hrmap *new_map() { return new hrmap_syntetic; }
|
||||||
|
|
||||||
transmatrix adjcell_matrix(heptagon *h, int d);
|
transmatrix adjcell_matrix(heptagon *h, int d);
|
||||||
|
|
||||||
heptagon *build_child(heptagon *parent, int d, int id, int pindex) {
|
heptagon *build_child(heptagon *parent, int d, int id, int pindex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user