1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-07-05 19:43:17 +00:00
This commit is contained in:
Zeno Rogue 2024-05-24 20:58:32 +02:00
commit f2d8b4d95e
2 changed files with 168 additions and 159 deletions

View File

@ -675,14 +675,23 @@ EX eLand getNewLand(eLand old) {
if(ls::horodisk_structure() && tortoise::seek()) LIKELY tab[cnt++] = laTortoise;
int attempts = 0;
eLand n = old;
while(incompatible(n, old) || !isLandIngame(n)) {
n = tab[hrand(cnt)];
int idx = 0;
while (idx < cnt) {
eLand n = tab[idx];
if (incompatible(n, old) || !isLandIngame(n))
tab[idx] = tab[--cnt];
else
idx++;
}
if (!cnt) {
addMessage("No eligible land candidates!");
return old;
}
eLand n = tab[hrand(cnt)];
if (weirdhyperbolic && specialland == laCrossroads4 && isCrossroads(n))
n = laCrossroads4;
attempts++; if(attempts == 2000) break;
}
return n;
}