shithub: puzzles

Download patch

ref: f0ec00fb4cfc11b82ceb8adb54dc3460102448ac
parent: c8855bff31b26017cfdaced4d9fa5691858be31a
author: Simon Tatham <anakin@pobox.com>
date: Thu Nov 10 06:57:15 EST 2005

Correct w/h mixup in grid edge checks.

[originally from svn r6452]

--- a/bridges.c
+++ b/bridges.c
@@ -1800,11 +1800,11 @@
     echeck = 0;
     for (x = 0; x < params->w; x++) {
         if (INDEX(tobuild, gridi, x, 0))           echeck |= 1;
-        if (INDEX(tobuild, gridi, x, params->w-1)) echeck |= 2;
+        if (INDEX(tobuild, gridi, x, params->h-1)) echeck |= 2;
     }
     for (y = 0; y < params->h; y++) {
         if (INDEX(tobuild, gridi, 0,           y)) echeck |= 4;
-        if (INDEX(tobuild, gridi, params->h-1, y)) echeck |= 8;
+        if (INDEX(tobuild, gridi, params->w-1, y)) echeck |= 8;
     }
     if (echeck != 15) {
         debug(("Generated grid doesn't fill to sides, retrying.\n"));