Mercurial > hg > openttd
changeset 15912:115913c318e0 draft
(svn r20596) -Fix [FS#4066]: crash when the tooltip is wider than the window is
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 22 Aug 2010 20:25:45 +0000 |
parents | 6d73a9e19477 |
children | 2ff5302eebee |
files | src/misc_gui.cpp |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -852,7 +852,7 @@ * 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; }