diff options
author | rubidium <rubidium@openttd.org> | 2009-09-02 08:58:20 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-09-02 08:58:20 +0000 |
commit | 5cb22df0f56420759e727b9e9fd16e379a358fb2 (patch) | |
tree | 23e18970c93398f1879757bed924b5be3a861ac7 /src/window.cpp | |
parent | 900aedf270319b5fbcd3373dfa268a5a5c1cfc78 (diff) | |
download | openttd-5cb22df0f56420759e727b9e9fd16e379a358fb2.tar.xz |
(svn r17375) -Codechange: remove last direct usage of scrollbar variables
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/window.cpp b/src/window.cpp index af0c4e024..9ce9f105d 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -452,12 +452,9 @@ static void DispatchMouseWheelEvent(Window *w, int widget, int wheel) if (w->nested_array != NULL && (uint)widget < w->nested_array_size) sb = w->nested_array[widget]->FindScrollbar(w); - if (sb != NULL && sb->count > sb->cap) { - int pos = Clamp(sb->pos + wheel, 0, sb->count - sb->cap); - if (pos != sb->pos) { - sb->pos = pos; - w->SetDirty(); - } + if (sb != NULL && sb->GetCount() > sb->GetCapacity()) { + sb->UpdatePosition(wheel); + w->SetDirty(); } } @@ -1886,9 +1883,9 @@ static bool HandleScrollbarScrolling() } /* Find the item we want to move to and make sure it's inside bounds. */ - int pos = min(max(0, i + _scrollbar_start_pos) * sb->count / _scrollbar_size, max(0, sb->count - sb->cap)); - if (pos != sb->pos) { - sb->pos = pos; + int pos = min(max(0, i + _scrollbar_start_pos) * sb->GetCount() / _scrollbar_size, max(0, sb->GetCount() - sb->GetCapacity())); + if (pos != sb->GetPosition()) { + sb->SetPosition(pos); w->SetDirty(); } return false; |