summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-18 20:28:55 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-18 20:28:55 +0000
commit40ec9bb1235a2231f0c883baaae73e106c67f1cf (patch)
tree2027e243ebfeb15fcba1eea0c4c11b0160c3ed12
parenta87ff2dc8836d41e45dabe510072e2c2997a4d9a (diff)
downloadopenttd-40ec9bb1235a2231f0c883baaae73e106c67f1cf.tar.xz
(svn r3217) Fix issue with resizing stepped windows introduced in revision 3181.
-rw-r--r--window.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/window.c b/window.c
index 151b02fd1..79540e860 100644
--- a/window.c
+++ b/window.c
@@ -1017,10 +1017,12 @@ static bool HandleWindowDragging(void)
x = _cursor.pos.x - _drag_delta.x;
y = _cursor.pos.y - _drag_delta.y;
- /* X and Y has to go by step.. calculate it */
- if (w->resize.step_width > 1) x = x - (x % w->resize.step_width);
+ /* X and Y has to go by step.. calculate it.
+ * The cast to int is necessary else x/y are implicitly casted to
+ * unsigned int, which won't work. */
+ if (w->resize.step_width > 1) x -= x % (int)w->resize.step_width;
- if (w->resize.step_height > 1) y = y - (y % w->resize.step_height);
+ if (w->resize.step_height > 1) y -= y % (int)w->resize.step_height;
/* Check if we don't go below the minimum set size */
if ((int)w->width + x < (int)w->resize.width)