diff options
author | rubidium <rubidium@openttd.org> | 2009-09-02 06:34:40 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-09-02 06:34:40 +0000 |
commit | b06e026f97012a82618317600520c429c1c1b013 (patch) | |
tree | 6e674489e19ead7db782cf72b4cc9d48ad4df243 /src/window.cpp | |
parent | b13eccb105aa90ffc6dc136dbec58961adc58abf (diff) | |
download | openttd-b06e026f97012a82618317600520c429c1c1b013.tar.xz |
(svn r17365) -Codechange: introduce wrapper functions to update the position, capacity and count of scroll bars. This to (eventually) prevent the scrollbar overflowing outside of the window
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/window.cpp b/src/window.cpp index f513a48aa..69d7b707b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2635,10 +2635,7 @@ int PositionMainToolbar(Window *w) */ void SetVScrollCount(Window *w, int num) { - w->vscroll.count = num; - num -= w->vscroll.cap; - if (num < 0) num = 0; - if (num < w->vscroll.pos) w->vscroll.pos = num; + w->vscroll.SetCount(num); } /** @@ -2650,10 +2647,7 @@ void SetVScrollCount(Window *w, int num) */ void SetVScroll2Count(Window *w, int num) { - w->vscroll2.count = num; - num -= w->vscroll2.cap; - if (num < 0) num = 0; - if (num < w->vscroll2.pos) w->vscroll2.pos = num; + w->vscroll2.SetCount(num); } /** @@ -2665,10 +2659,7 @@ void SetVScroll2Count(Window *w, int num) */ void SetHScrollCount(Window *w, int num) { - w->hscroll.count = num; - num -= w->hscroll.cap; - if (num < 0) num = 0; - if (num < w->hscroll.pos) w->hscroll.pos = num; + w->hscroll.SetCount(num); } |