diff --git a/bigstuff.cpp b/bigstuff.cpp index 2803e572..b9e5c567 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -100,7 +100,7 @@ bool grailWasFound(cell *c) { return c->master->alt->alt->emeraldval & GRAIL_FOUND; } -void generateAlts(heptagon *h, int levs) { +void generateAlts(heptagon *h, int levs, bool link_cdata) { if(!h->alt) return; preventbarriers(h->c7); for(int i=0; ic7->mov[i]); @@ -142,8 +142,8 @@ void generateAlts(heptagon *h, int levs) { continue; } ho->alt = hm; - hm->cdata = (cdata*) ho; - if(levs) generateAlts(ho, levs-1); + if(link_cdata) hm->cdata = (cdata*) ho; + if(levs) generateAlts(ho, levs-1, link_cdata); } } diff --git a/cell.cpp b/cell.cpp index 22ead80a..98a09042 100644 --- a/cell.cpp +++ b/cell.cpp @@ -592,8 +592,8 @@ struct hrmap_quotient : hrmap { vector allh; - hrmap_quotient() { - + hrmap_quotient() { + if(quotient == 2) { connections = currfp.connections; } @@ -643,7 +643,7 @@ struct hrmap_quotient : hrmap { } for(int i=0; iemeraldval = allh[i]->alt->emeraldval; allh[i]->zebraval = allh[i]->alt->zebraval; allh[i]->fiftyval = allh[i]->alt->fiftyval; @@ -840,19 +840,24 @@ void clearHexes(heptagon *at) { at->cdata = NULL; } if(at->c7) { - if(!nonbitrunc) for(int i=0; ic7->mov[i]); + } clearcell(at->c7); } } +void unlink_cdata(heptagon *h) { + if(h->alt && h->c7) { + if(h->alt->cdata == (cdata*) h) + h->alt->cdata = NULL; + } + } + void clearfrom(heptagon *at) { queue q; + unlink_cdata(at); q.push(at); - if(at->alt && at->c7) { - printf("disconnect %p -> %p (from real)\n", at, at->alt); - at->alt->cdata = NULL; - } at->alt = &deletion_marker; //int maxq = 0; while(!q.empty()) { @@ -874,7 +879,7 @@ void clearfrom(heptagon *at) { for(int i=0; imove[i]) { if(at->move[i]->alt != &deletion_marker) q.push(at->move[i]); - if(at->move[i]->alt && at->move[i]->c7) at->move[i]->alt->cdata = NULL; + unlink_cdata(at->move[i]); at->move[i]->alt = &deletion_marker; DEBMEM ( printf("!mov %p [%p]\n", at->move[i], at->move[i]->move[at->spin(i)]); ) if(at->move[i]->move[at->spin(i)] != NULL && diff --git a/hyper.h b/hyper.h index 5c845cdd..99c9e6c0 100644 --- a/hyper.h +++ b/hyper.h @@ -324,7 +324,7 @@ bool destroyHalfvine(cell *c, eWall newwall = waNone, int tval = 6); void buildCrossroads2(cell *c); bool isHaunted(eLand l); heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special=0); -void generateAlts(heptagon *h, int levs = S3-3); +void generateAlts(heptagon *h, int levs = S3-3, bool link_cdata = true); void setdist(cell *c, int d, cell *from); void checkOnYendorPath(); void killThePlayerAt(eMonster m, cell *c, flagtype flags);