Mercurial > hg > openttd
changeset 13312:535328199062 draft
(svn r17821) -Codechange: make more mathods of SmallMapWindow private
author | smatz <smatz@openttd.org> |
---|---|
date | Tue, 20 Oct 2009 18:15:42 +0000 |
parents | 0f3dd8ac5336 |
children | c41b3f705c2e |
files | src/smallmap_gui.cpp |
diffstat | 1 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -545,8 +545,7 @@ GfxFillRect(x2 - 3, y, x2, y2, 69); } -class SmallMapWindow : public Window -{ +class SmallMapWindow : public Window { enum SmallMapType { SMT_CONTOUR, SMT_VEHICLES, @@ -638,7 +637,6 @@ } while (xc++, yc++, dst = blitter->MoveTo(dst, pitch, 0), --reps != 0); } -public: /** * Draws the small map. * @@ -836,17 +834,6 @@ _cur_dpi = old_dpi; } - void SmallMapCenterOnCurrentPos() - { - ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; - - int x = ((vp->virtual_width - (this->widget[SM_WIDGET_MAP].right - this->widget[SM_WIDGET_MAP].left) * TILE_SIZE) / 2 + vp->virtual_left) / 4; - int y = ((vp->virtual_height - (this->widget[SM_WIDGET_MAP].bottom - this->widget[SM_WIDGET_MAP].top ) * TILE_SIZE) / 2 + vp->virtual_top ) / 2 - TILE_SIZE * 2; - this->scroll_x = (y - x) & ~0xF; - this->scroll_y = (x + y) & ~0xF; - this->SetDirty(); - } - void ResizeLegend() { Widget *legend = &this->widget[SM_WIDGET_LEGEND]; @@ -876,6 +863,7 @@ } } +public: SmallMapWindow(const WindowDesc *desc, int window_number) : Window(desc, window_number), refresh(FORCE_REFRESH_PERIOD) { this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR); @@ -1116,6 +1104,17 @@ { if (delta.x != 0 && this->map_type == SMT_INDUSTRY) this->ResizeLegend(); } + + void SmallMapCenterOnCurrentPos() + { + ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; + + int x = ((vp->virtual_width - (this->widget[SM_WIDGET_MAP].right - this->widget[SM_WIDGET_MAP].left) * TILE_SIZE) / 2 + vp->virtual_left) / 4; + int y = ((vp->virtual_height - (this->widget[SM_WIDGET_MAP].bottom - this->widget[SM_WIDGET_MAP].top ) * TILE_SIZE) / 2 + vp->virtual_top ) / 2 - TILE_SIZE * 2; + this->scroll_x = (y - x) & ~0xF; + this->scroll_y = (x + y) & ~0xF; + this->SetDirty(); + } }; SmallMapWindow::SmallMapType SmallMapWindow::map_type = SMT_CONTOUR;