summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-07-16 18:31:33 +0000
committeralberth <alberth@openttd.org>2009-07-16 18:31:33 +0000
commitb6889daf8d11b083358a26eea3f633942e2e50e4 (patch)
treebbafb542c5f45ff5cdf36b414759ef09791c6309
parent539480e84543f35cfd10bb150e6a4aa105a55efb (diff)
downloadopenttd-b6889daf8d11b083358a26eea3f633942e2e50e4.tar.xz
(svn r16848) -Fix: Trying to reduce a nested widget window further than the smallest alowed size should not crash the game.
-rw-r--r--src/window.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 39fdaa2e7..86b774364 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1478,8 +1478,8 @@ void ResizeWindow(Window *w, int delta_x, int delta_y)
w->SetDirty();
if (w->nested_root != NULL) {
- uint new_xinc = max(0u, (w->nested_root->resize_x == 0) ? 0 : (w->nested_root->current_x - w->nested_root->smallest_x) + delta_x);
- uint new_yinc = max(0u, (w->nested_root->resize_y == 0) ? 0 : (w->nested_root->current_y - w->nested_root->smallest_y) + delta_y);
+ uint new_xinc = max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x);
+ uint new_yinc = max(0, (w->nested_root->resize_y == 0) ? 0 : (int)(w->nested_root->current_y - w->nested_root->smallest_y) + delta_y);
assert(w->nested_root->resize_x == 0 || new_xinc % w->nested_root->resize_x == 0);
assert(w->nested_root->resize_y == 0 || new_yinc % w->nested_root->resize_y == 0);