changeset 20174:be1b73d328e6 draft

(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
author rubidium <rubidium@openttd.org>
date Mon, 25 Mar 2013 20:59:59 +0000
parents 4ea6dc477f8c
children c9cf10bb3715
files src/widget.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1470,7 +1470,8 @@
 	 * 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);