1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-26 15:12:48 +00:00

RogueViz SAG now works in bounded spaces

This commit is contained in:
Zeno Rogue 2018-02-08 22:28:07 +01:00
parent b693c3ca58
commit 754c4177ca

View File

@ -506,7 +506,7 @@ namespace sag {
int snakedist(int i, int j) {
if(i < insnaketab && j < insnaketab) return sdist[i][j];
if(euclid || sphere) return celldistance(snakecells[i], snakecells[j]);
if(bounded) return celldistance(snakecells[i], snakecells[j]);
int i0 = i, i1 = i, j0 = j, j1 = j;
int cost = 0;
// intersect
@ -520,8 +520,7 @@ namespace sag {
}
void initSnake(int n) {
if(sphere && nonbitrunc) n = 12;
else if(sphere) n = 32;
if(bounded) n = size(currentmap->allcells());
numsnake = n;
snakecells.resize(numsnake);
snakefirst.resize(numsnake);
@ -529,6 +528,13 @@ namespace sag {
snakenode.resize(numsnake);
lpbak.resize(numsnake);
wpbak.resize(numsnake);
if(bounded) {
for(int i=0; i<n; i++) {
cellwalker cw(currentmap->allcells()[i], 0);
setsnake(cw, i);
}
}
else {
cellwalker cw = cwt;
setsnake(cw, 0);
cwstep(cw);
@ -544,6 +550,7 @@ namespace sag {
if(i == numsnake) break;
setsnake(cw, i); cwspin(cw, 1);
}
}
int stab = min(numsnake, MAXSNAKETAB);
for(int i=0; i<stab; i++)
for(int j=0; j<stab; j++)