1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-24 05:17:17 +00:00

fixed a freeze when drawing offscreen grid lines

This commit is contained in:
Zeno Rogue 2020-01-19 11:49:35 +01:00
parent e925f6e93c
commit 4b7739e80d

View File

@ -3590,13 +3590,17 @@ bool celldrawer::cell_clipped() {
EX ld precise_width = .5; EX ld precise_width = .5;
int grid_depth = 0;
EX void gridline(const transmatrix& V1, const hyperpoint h1, const transmatrix& V2, const hyperpoint h2, color_t col, int prec) { EX void gridline(const transmatrix& V1, const hyperpoint h1, const transmatrix& V2, const hyperpoint h2, color_t col, int prec) {
ld d = hdist(V1*h1, V2*h2); ld d = hdist(V1*h1, V2*h2);
while(d > precise_width && d < 100) { while(d > precise_width && d < 100 && grid_depth < 10) {
if(!eqmatrix(V1, V2, 1e-6)) { gridline(V1, h1, V1, inverse(V1) * V2 * h2, col, prec); return; } if(!eqmatrix(V1, V2, 1e-6)) { gridline(V1, h1, V1, inverse(V1) * V2 * h2, col, prec); return; }
hyperpoint h = midz(h1, h2); hyperpoint h = midz(h1, h2);
grid_depth++;
gridline(V1, h1, V1, h, col, prec); gridline(V1, h1, V1, h, col, prec);
gridline(V1, h, V1, h2, col, prec); gridline(V1, h, V1, h2, col, prec);
grid_depth--;
return; return;
} }
#if MAXMDIM >= 4 #if MAXMDIM >= 4