X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fglhanoi.c;h=8bc9a1c909422a2d4a7f84e7febc9bb78cc32675;hp=ef10c20ec7b1d594e2002c893de1604970e7946c;hb=c494fd2e6b3b25582375d62e40f4f5cc984ca424;hpb=07faf451b99879183ed7e909e43a0e065be1ee7f diff --git a/hacks/glx/glhanoi.c b/hacks/glx/glhanoi.c index ef10c20e..8bc9a1c9 100644 --- a/hacks/glx/glhanoi.c +++ b/hacks/glx/glhanoi.c @@ -1312,6 +1312,11 @@ ENTRYPOINT void init_glhanoi(ModeInfo * mi) if (glhanoi->numberOfDisks <= 1) glhanoi->numberOfDisks = 3 + (int) BELLRAND(9); + /* magicnumber is a bitfield, so we can't have more than 31 discs + on a system with 4-byte ints. */ + if (glhanoi->numberOfDisks >= 8 * sizeof(int)) + glhanoi->numberOfDisks = (8 * sizeof(int)) - 1; + glhanoi->maxDiskIdx = glhanoi->numberOfDisks - 1; glhanoi->wire = MI_IS_WIREFRAME(mi); glhanoi->light = light;