Changeset - r14265:b11aa4333107
[Not reviewed]
master
0 1 0
alberth - 15 years ago 2010-01-16 15:24:00
alberth@openttd.org
(svn r18827) -Fix: Center main window using smallmap widget edge coordinates.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/smallmap_gui.cpp
Show inline comments
 
@@ -953,11 +953,12 @@ public:
 
				 */
 
				_left_button_clicked = false;
 

	
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
 
				Point pt = RemapCoords(this->scroll_x, this->scroll_y, 0);
 
				Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 
				w->viewport->follow_vehicle = INVALID_VEHICLE;
 
				w->viewport->dest_scrollpos_x = pt.x + ((_cursor.pos.x - this->left + 2) << 4) - (w->viewport->virtual_width >> 1);
 
				w->viewport->dest_scrollpos_y = pt.y + ((_cursor.pos.y - this->top - 16) << 4) - (w->viewport->virtual_height >> 1);
 
				w->viewport->dest_scrollpos_x = pt.x + ((_cursor.pos.x - this->left + wid->pos_x) << 4) - (w->viewport->virtual_width  >> 1);
 
				w->viewport->dest_scrollpos_y = pt.y + ((_cursor.pos.y - this->top  - wid->pos_y) << 4) - (w->viewport->virtual_height >> 1);
 

	
 
				this->SetDirty();
 
			} break;
0 comments (0 inline, 0 general)