diff options
author | frosch <frosch@openttd.org> | 2010-08-12 08:37:01 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-08-12 08:37:01 +0000 |
commit | 71ca58c2bb1b72a088acec5b70423a43512ec195 (patch) | |
tree | b0e875a8626ce26d7fed7597328409f2cb937dbe /src/window.cpp | |
parent | 10339c60c0e53ccc90f0cc379763be6582d87bf2 (diff) | |
download | openttd-71ca58c2bb1b72a088acec5b70423a43512ec195.tar.xz |
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
Note: All windows get individual members with the same names, which are initialised via Window::GetScrollbar(). This caching is not required at all, but simplifies conversion.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/window.cpp b/src/window.cpp index c20bc49f4..1261a66d0 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -139,9 +139,9 @@ const Scrollbar *Window::GetScrollbar(uint widnum) const { const NWidgetLeaf *wid = this->GetWidget<NWidgetLeaf>(widnum); switch (wid->type) { - case WWT_HSCROLLBAR: return &this->hscroll; - case WWT_SCROLLBAR: return &this->vscroll; - case WWT_SCROLL2BAR: return &this->vscroll2; + case WWT_HSCROLLBAR: return &this->old_hscroll; + case WWT_SCROLLBAR: return &this->old_vscroll; + case WWT_SCROLL2BAR: return &this->old_vscroll2; default: NOT_REACHED(); } } @@ -155,9 +155,9 @@ Scrollbar *Window::GetScrollbar(uint widnum) { NWidgetLeaf *wid = this->GetWidget<NWidgetLeaf>(widnum); switch (wid->type) { - case WWT_HSCROLLBAR: return &this->hscroll; - case WWT_SCROLLBAR: return &this->vscroll; - case WWT_SCROLL2BAR: return &this->vscroll2; + case WWT_HSCROLLBAR: return &this->old_hscroll; + case WWT_SCROLLBAR: return &this->old_vscroll; + case WWT_SCROLL2BAR: return &this->old_vscroll2; default: NOT_REACHED(); } } @@ -1349,7 +1349,7 @@ void Window::InitNested(const WindowDesc *desc, WindowNumber window_number) } /** Empty constructor, initialization has been moved to #InitNested() called from the constructor of the derived class. */ -Window::Window() : hscroll(false), vscroll(true), vscroll2(true) +Window::Window() : old_hscroll(false), old_vscroll(true), old_vscroll2(true) { } @@ -1885,14 +1885,14 @@ static EventState HandleScrollbarScrolling() bool rtl = false; if (w->flags4 & WF_HSCROLL) { - sb = &w->hscroll; + sb = &w->old_hscroll; i = _cursor.pos.x - _cursorpos_drag_start.x; rtl = _dynlang.text_dir == TD_RTL; } else if (w->flags4 & WF_SCROLL2) { - sb = &w->vscroll2; + sb = &w->old_vscroll2; i = _cursor.pos.y - _cursorpos_drag_start.y; } else { - sb = &w->vscroll; + sb = &w->old_vscroll; i = _cursor.pos.y - _cursorpos_drag_start.y; } |