File diff r13425:301cfe36afd4 → r13426:509a5e9dc661
src/misc_gui.cpp
Show inline comments
 
@@ -590,15 +590,15 @@ public:
 
		}
 

	
 
		/* Find the screen part between the main toolbar at the top, and the statusbar at the bottom.
 
		 * Add a fixed distance 20 to make it less cluttered.
 
		 */
 
		const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
 
		int scr_top = w->top + w->height + 20;
 
		int scr_top = ((w != NULL) ? w->top + w->height : 0) + 20;
 
		w = FindWindowById(WC_STATUS_BAR, 0);
 
		int scr_bot = w->top - 20;
 
		int scr_bot = ((w != NULL) ? w->top : _screen.height) - 20;
 

	
 
		Point pt = RemapCoords2(this->position.x, this->position.y);
 
		const ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
 
		if (this->detailed_msg != STR_ERROR_OWNED_BY || GetDParamX(this->decode_params, 2) >= MAX_COMPANIES) {
 
			/* move x pos to opposite corner */
 
			pt.x = UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left;
 
@@ -807,15 +807,15 @@ struct TooltipsWindow : public Window
 
	virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
 
	{
 
		/* Find the screen part between the main toolbar at the top, and the statusbar at the bottom.
 
		 * Add a fixed distance 2 so the tooltip floats free from both bars.
 
		 */
 
		const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
 
		int scr_top = w->top + w->height + 2;
 
		int scr_top = ((w != NULL) ? w->top + w->height : 0) + 2;
 
		w = FindWindowById(WC_STATUS_BAR, 0);
 
		int scr_bot = w->top - 2;
 
		int scr_bot = ((w != NULL) ? w->top : _screen.height) - 2;
 

	
 
		Point pt;
 

	
 
		/* Correctly position the tooltip position, watch out for window and cursor size
 
		 * Clamp value to below main toolbar and above statusbar. If tooltip would
 
		 * go below window, flip it so it is shown above the cursor */