summaryrefslogtreecommitdiff
path: root/src/misc_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-22 20:25:45 +0000
committerrubidium <rubidium@openttd.org>2010-08-22 20:25:45 +0000
commit95d37c8615b897a3c69df8419cbe5648e0f28a37 (patch)
tree91a86a13f4d2febef32c1ad4267f5a6a4f80f4b8 /src/misc_gui.cpp
parent4b0fa883f14e98c24d33dfb9cc9d651478fdb7f7 (diff)
downloadopenttd-95d37c8615b897a3c69df8419cbe5648e0f28a37.tar.xz
(svn r20596) -Fix [FS#4066]: crash when the tooltip is wider than the window is
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r--src/misc_gui.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 3c31ddc0e..422902265 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -852,7 +852,7 @@ struct TooltipsWindow : public Window
* go below window, flip it so it is shown above the cursor */
pt.y = Clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, scr_top, scr_bot);
if (pt.y + sm_height > scr_bot) pt.y = min(_cursor.pos.y + _cursor.offs.y - 5, scr_bot) - sm_height;
- pt.x = Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
+ pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
return pt;
}