Changeset - r26596:f82fece14cbc
[Not reviewed]
master
0 1 0
PeterN - 19 months ago 2022-11-17 09:10:47
peter1138@openttd.org
Fix: Crash if error message window is too wide for screen. (#10172)

This doesn't seem new, just easier to trigger with new scaling.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/error_gui.cpp
Show inline comments
 
@@ -245,8 +245,8 @@ public:
 
			pt.y = UnScaleByZoom(pt.y - vp->virtual_top, vp->zoom) + vp->top;
 
			pt.y = (pt.y < (_screen.height >> 1)) ? scr_bot - sm_height : scr_top;
 
		} else {
 
			pt.x = Clamp(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (sm_width / 2),  0, _screen.width  - sm_width);
 
			pt.y = Clamp(UnScaleByZoom(pt.y - vp->virtual_top,  vp->zoom) + vp->top  - (sm_height / 2), scr_top, scr_bot - sm_height);
 
			pt.x = std::min(std::max(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (sm_width / 2), 0), _screen.width - sm_width);
 
			pt.y = std::min(std::max(UnScaleByZoom(pt.y - vp->virtual_top,  vp->zoom) + vp->top  - (sm_height / 2), scr_top), scr_bot - sm_height);
 
		}
 
		return pt;
 
	}
0 comments (0 inline, 0 general)