summaryrefslogtreecommitdiff
path: root/src/widget.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-03-25 20:59:59 +0000
committerrubidium <rubidium@openttd.org>2013-03-25 20:59:59 +0000
commitbdaf082fc2f55fb3a410d60403edf113c5fb4946 (patch)
treee1749df057a132352b9c95cb7e6a7dd6cde4c69d /src/widget.cpp
parent4b3ead97c51e37f79659b08de03053e4d2f62a78 (diff)
downloadopenttd-bdaf082fc2f55fb3a410d60403edf113c5fb4946.tar.xz
(svn r25123) -Fix: when the count for a scrollbar was 0, the inter distance was subtracted too much causing a scrollbar with a negative size
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index cebff2e89..72612a48e 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1470,7 +1470,8 @@ void NWidgetMatrix::SetCount(int count)
* and post spacing "offsets". */
count = CeilDiv(count, this->sb->IsVertical() ? this->widgets_x : this->widgets_y);
count *= (this->sb->IsVertical() ? this->head->smallest_y : this->head->smallest_x) + this->pip_inter;
- count += -this->pip_inter + this->pip_pre + this->pip_post; // We counted an inter too much in the multiplication above
+ if (count > 0) count -= this->pip_inter; // We counted an inter too much in the multiplication above
+ count += this->pip_pre + this->pip_post;
this->sb->SetCount(count);
this->sb->SetCapacity(this->sb->IsVertical() ? this->current_y : this->current_x);
this->sb->SetStepSize(this->sb->IsVertical() ? this->widget_h : this->widget_w);