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.distance = 0;
|
||||
isnonbitrunc = nonbitrunc;
|
||||
if(syntetic)
|
||||
synt::initialize(&h);
|
||||
else if(binarytiling) {
|
||||
if(binarytiling) {
|
||||
#if DEBUG_BINARY_TILING
|
||||
binary::xcode.clear();
|
||||
binary::rxcode.clear();
|
||||
@ -876,7 +874,7 @@ cell*& euclideanAtCreate(int vec) {
|
||||
void initcells() {
|
||||
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(euclid) currentmap = new hrmap_euclidean;
|
||||
else if(sphere) currentmap = new hrmap_spherical;
|
||||
@ -957,7 +955,7 @@ void clearfrom(heptagon *at) {
|
||||
at->cdata = NULL;
|
||||
}
|
||||
}
|
||||
int edges = S7;
|
||||
int edges = at->degree();
|
||||
if(binarytiling) edges = at->c7->type;
|
||||
for(int i=0; i<edges; i++) if(at->move(i)) {
|
||||
if(at->move(i)->alt != &deletion_marker)
|
||||
|
48
syntetic.cpp
48
syntetic.cpp
@ -270,13 +270,28 @@ map<heptagon*, vector<pair<heptagon*, transmatrix> > > altmap;
|
||||
|
||||
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;
|
||||
id_of(h) = 0;
|
||||
h->c7 = newCell(isize(adjacent[0]), h);
|
||||
hrmap_syntetic() {
|
||||
origin = new heptagon;
|
||||
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;
|
||||
|
||||
parent_index_of(origin) = 0;
|
||||
id_of(origin) = 0;
|
||||
origin->c7 = newCell(isize(adjacent[0]), origin);
|
||||
|
||||
heptagon *alt = NULL;
|
||||
|
||||
@ -291,19 +306,34 @@ void initialize(heptagon *h) {
|
||||
alt->c7 = NULL;
|
||||
alt->alt = alt;
|
||||
alt->cdata = NULL;
|
||||
newAltMap(alt);
|
||||
current_altmap = newAltMap(alt);
|
||||
}
|
||||
|
||||
transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id;
|
||||
syntetic_gmatrix[h] = make_pair(alt, T);
|
||||
altmap[alt].emplace_back(h, T);
|
||||
syntetic_gmatrix[origin] = make_pair(alt, T);
|
||||
altmap[alt].emplace_back(origin, T);
|
||||
|
||||
base_distlimit = 0;
|
||||
celllister cl(h->c7, 1000, 200, NULL);
|
||||
celllister cl(origin->c7, 1000, 200, NULL);
|
||||
base_distlimit = cl.dists.back();
|
||||
if(sphere) base_distlimit = 15;
|
||||
}
|
||||
|
||||
~hrmap_syntetic() {
|
||||
clearfrom(origin);
|
||||
altmap.clear();
|
||||
syntetic_gmatrix.clear();
|
||||
if(current_altmap) {
|
||||
dynamicval<eGeometry> g(geometry, gNormal);
|
||||
delete current_altmap;
|
||||
current_altmap = NULL;
|
||||
}
|
||||
}
|
||||
void verify() { }
|
||||
};
|
||||
|
||||
hrmap *new_map() { return new hrmap_syntetic; }
|
||||
|
||||
transmatrix adjcell_matrix(heptagon *h, int d);
|
||||
|
||||
heptagon *build_child(heptagon *parent, int d, int id, int pindex) {
|
||||
|
Loading…
Reference in New Issue
Block a user