mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 07:30:26 +00:00
generate_random_path fixed in 3D
This commit is contained in:
parent
c588837375
commit
c89b97b244
@ -933,7 +933,7 @@ EX pathgen generate_random_path(cellwalker start, int length, bool for_yendor, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(trees_known()) {
|
else if(trees_known() && WDIM == 2) {
|
||||||
auto sdist = [start] (cell *c) { return celldistance(start.at, c); };
|
auto sdist = [start] (cell *c) { return celldistance(start.at, c); };
|
||||||
if(i == 0) {
|
if(i == 0) {
|
||||||
t = type_in(expansion, randomdir ? start.at : start.cpeek(), sdist);
|
t = type_in(expansion, randomdir ? start.at : start.cpeek(), sdist);
|
||||||
@ -969,17 +969,17 @@ EX pathgen generate_random_path(cellwalker start, int length, bool for_yendor, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if(WDIM == 3) {
|
else if(WDIM == 3) {
|
||||||
int d = celldistance(p.path[0], ycw.at);
|
cell *prev = p.path[max(i-3, 0)];
|
||||||
vector<cell*> next;
|
int d = celldistance(prev, ycw.at);
|
||||||
forCellCM(c, ycw.at) if(celldistance(p.path[0], c) > d) next.push_back(c);
|
vector<int> next;
|
||||||
|
forCellIdCM(c, i, ycw.at) if(celldistance(prev, c) > d) next.push_back(i);
|
||||||
if(!isize(next)) {
|
if(!isize(next)) {
|
||||||
printf("error: no more cells");
|
println(hlog, "error: no more cells for i=", i);
|
||||||
ycw.at = ycw.at->move(hrand(ycw.at->type));
|
ycw.spin = hrand(ycw.at->type);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ycw.at = next[hrand(isize(next))];
|
ycw.spin = hrand_elt(next);
|
||||||
}
|
}
|
||||||
p.path[i+1] = ycw.at;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user