mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-17 18:54:48 +00:00
flocking:: prevent crash in follow=2 when no boids found
This commit is contained in:
parent
7449a48198
commit
c66fbe9ea0
@ -283,12 +283,16 @@ namespace flocking {
|
|||||||
// are taken), and normalize the result to project it back to the hyperboloid
|
// are taken), and normalize the result to project it back to the hyperboloid
|
||||||
// (the same method is commonly used on the sphere AFAIK)
|
// (the same method is commonly used on the sphere AFAIK)
|
||||||
hyperpoint h = Hypc;
|
hyperpoint h = Hypc;
|
||||||
|
bool ok = false;
|
||||||
for(int i=0; i<N; i++) if(gmatrix.count(vdata[i].m->base)) {
|
for(int i=0; i<N; i++) if(gmatrix.count(vdata[i].m->base)) {
|
||||||
|
ok = true;
|
||||||
vdata[i].m->pat = gmatrix[vdata[i].m->base] * vdata[i].m->at;
|
vdata[i].m->pat = gmatrix[vdata[i].m->base] * vdata[i].m->at;
|
||||||
h += tC0(vdata[i].m->pat);
|
h += tC0(vdata[i].m->pat);
|
||||||
}
|
}
|
||||||
|
if(ok) {
|
||||||
h = normalize(h);
|
h = normalize(h);
|
||||||
View = gpushxto0(h) * View;
|
View = inverse(actual_view_transform) * gpushxto0(h) * actual_view_transform * View;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
optimizeview();
|
optimizeview();
|
||||||
|
Loading…
Reference in New Issue
Block a user