shithub: puzzles

Download patch

ref: 5c48a594628a98f6edb5ac0fa1f0ea1b14fa27b7
parent: 698921762430413c329e346c7ec7b87c7b422cdc
author: Jacob Nevins <jacobn@chiark.greenend.org.uk>
date: Mon Jul 4 07:21:50 EDT 2005

Fix bounds checking for Flip cursor control.

[originally from svn r6050]

--- a/flip.c
+++ b/flip.c
@@ -928,8 +928,8 @@
         default: assert(!"shouldn't get here");
         }
         ui->cx += dx; ui->cy += dy;
-        ui->cx = min(max(ui->cx, 0), state->w);
-        ui->cy = min(max(ui->cy, 0), state->h);
+        ui->cx = min(max(ui->cx, 0), state->w - 1);
+        ui->cy = min(max(ui->cy, 0), state->h - 1);
         ui->cdraw = 1;
         nullret = "";
     }