Changeset - r23926:701bf7bc2f0a
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 5 years ago 2019-11-06 22:47:12
j.g.rennison@gmail.com
Fix: Out of bounds tile access in ErrmsgWindow::OnInitialPosition

This fixes part A of #7619, but not part B.

Vehicle::x_pos and Vehicle::y_pos are not required to be within the map bounds.

See also: GetTileHeightBelowAircraft()
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/error_gui.cpp
Show inline comments
 
@@ -221,13 +221,13 @@ public:
 
		/* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom.
 
		 * Add a fixed distance 20 to make it less cluttered.
 
		 */
 
		int scr_top = GetMainViewTop() + 20;
 
		int scr_bot = GetMainViewBottom() - 20;
 

	
 
		Point pt = RemapCoords2(this->position.x, this->position.y);
 
		Point pt = RemapCoords(this->position.x, this->position.y, GetSlopePixelZOutsideMap(this->position.x, this->position.y));
 
		const ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
 
		if (this->face == INVALID_COMPANY) {
 
			/* move x pos to opposite corner */
 
			pt.x = UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left;
 
			pt.x = (pt.x < (_screen.width >> 1)) ? _screen.width - sm_width - 20 : 20; // Stay 20 pixels away from the edge of the screen.
 

	
0 comments (0 inline, 0 general)