1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

ls:: fixed Caribbean in ideal Voronoi

This commit is contained in:
Zeno Rogue 2023-12-22 11:30:09 +01:00
parent 364a563423
commit 79527688cf

View File

@ -529,13 +529,18 @@ EX void generateTreasureIsland(cell *c) {
for(int i=0; i<c->type; i++) { for(int i=0; i<c->type; i++) {
cell *c2 = createMov(c, i); cell *c2 = createMov(c, i);
if(!eubinary) currentmap->extend_altmap(c2->master); if(!eubinary) currentmap->extend_altmap(c2->master);
if(greater_alt(c, c2)) { auto ok = [&] (cell *c2) {
if(ls::hv_structure() && get_voronoi_winner(c2).first != get_voronoi_winner(c).first) return false;
return true;
};
if(ok(c2) && greater_alt(c, c2)) {
ctab.push_back(c2); ctab.push_back(c2);
qlo = i; qhi = i; qlo = i; qhi = i;
while(true && isize(ctab) < c->type) { while(true && isize(ctab) < c->type) {
qlo--; qlo--;
c2 = c->cmodmove(qlo); c2 = c->cmodmove(qlo);
if(!have_alt(c2)) break; if(!have_alt(c2)) break;
if(!ok(c2)) break;
if(celldistAlt(c2) >= celldistAlt(c)) break; if(celldistAlt(c2) >= celldistAlt(c)) break;
ctab.push_back(c2); ctab.push_back(c2);
} }
@ -543,6 +548,7 @@ EX void generateTreasureIsland(cell *c) {
qhi++; qhi++;
c2 = c->cmodmove(qhi); c2 = c->cmodmove(qhi);
if(!have_alt(c2)) break; if(!have_alt(c2)) break;
if(!ok(c2)) break;
if(celldistAlt(c2) >= celldistAlt(c)) break; if(celldistAlt(c2) >= celldistAlt(c)) break;
ctab.push_back(c2); ctab.push_back(c2);
} }
@ -556,6 +562,7 @@ EX void generateTreasureIsland(cell *c) {
return; return;
} }
cell* c2 = c->cmodmove((qlo+qhi)/2); cell* c2 = c->cmodmove((qlo+qhi)/2);
if(ls::voronoi_structure() && c2->land != laCaribbean) c2->land = laCaribbean;
generateTreasureIsland(c2); generateTreasureIsland(c2);
if(!src) { if(!src) {
c->wall = c2->wall; c->wall = c2->wall;