1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

fixed a bug with cleaning quotient spaces

This commit is contained in:
Zeno Rogue 2018-02-08 22:27:48 +01:00
parent 2a59ff7ab2
commit b693c3ca58
3 changed files with 18 additions and 13 deletions

View File

@ -100,7 +100,7 @@ bool grailWasFound(cell *c) {
return c->master->alt->alt->emeraldval & GRAIL_FOUND; 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; if(!h->alt) return;
preventbarriers(h->c7); preventbarriers(h->c7);
for(int i=0; i<S7; i++) preventbarriers(h->c7->mov[i]); for(int i=0; i<S7; i++) preventbarriers(h->c7->mov[i]);
@ -142,8 +142,8 @@ void generateAlts(heptagon *h, int levs) {
continue; continue;
} }
ho->alt = hm; ho->alt = hm;
hm->cdata = (cdata*) ho; if(link_cdata) hm->cdata = (cdata*) ho;
if(levs) generateAlts(ho, levs-1); if(levs) generateAlts(ho, levs-1, link_cdata);
} }
} }

View File

@ -643,7 +643,7 @@ struct hrmap_quotient : hrmap {
} }
for(int i=0; i<TOT; i++) { for(int i=0; i<TOT; i++) {
generateAlts(allh[i]); generateAlts(allh[i], S3-3, false);
allh[i]->emeraldval = allh[i]->alt->emeraldval; allh[i]->emeraldval = allh[i]->alt->emeraldval;
allh[i]->zebraval = allh[i]->alt->zebraval; allh[i]->zebraval = allh[i]->alt->zebraval;
allh[i]->fiftyval = allh[i]->alt->fiftyval; allh[i]->fiftyval = allh[i]->alt->fiftyval;
@ -840,19 +840,24 @@ void clearHexes(heptagon *at) {
at->cdata = NULL; at->cdata = NULL;
} }
if(at->c7) { if(at->c7) {
if(!nonbitrunc) for(int i=0; i<S7; i++) if(!nonbitrunc) for(int i=0; i<S7; i++) {
clearcell(at->c7->mov[i]); clearcell(at->c7->mov[i]);
}
clearcell(at->c7); 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) { void clearfrom(heptagon *at) {
queue<heptagon*> q; queue<heptagon*> q;
unlink_cdata(at);
q.push(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; at->alt = &deletion_marker;
//int maxq = 0; //int maxq = 0;
while(!q.empty()) { while(!q.empty()) {
@ -874,7 +879,7 @@ void clearfrom(heptagon *at) {
for(int i=0; i<S7; i++) if(at->move[i]) { for(int i=0; i<S7; i++) if(at->move[i]) {
if(at->move[i]->alt != &deletion_marker) if(at->move[i]->alt != &deletion_marker)
q.push(at->move[i]); 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; at->move[i]->alt = &deletion_marker;
DEBMEM ( printf("!mov %p [%p]\n", at->move[i], at->move[i]->move[at->spin(i)]); ) 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 && if(at->move[i]->move[at->spin(i)] != NULL &&

View File

@ -324,7 +324,7 @@ bool destroyHalfvine(cell *c, eWall newwall = waNone, int tval = 6);
void buildCrossroads2(cell *c); void buildCrossroads2(cell *c);
bool isHaunted(eLand l); bool isHaunted(eLand l);
heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special=0); 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 setdist(cell *c, int d, cell *from);
void checkOnYendorPath(); void checkOnYendorPath();
void killThePlayerAt(eMonster m, cell *c, flagtype flags); void killThePlayerAt(eMonster m, cell *c, flagtype flags);