summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-04-03 19:32:14 +0000
committerterkhen <terkhen@openttd.org>2010-04-03 19:32:14 +0000
commit794828209ba556ea2baf39f64945da6d48605e53 (patch)
tree97def082a10804d03e53d7e5bf65a3c4a69e805b /src
parentefeb2998957efc564f3bf4d5c38f7b67a15bf755 (diff)
downloadopenttd-794828209ba556ea2baf39f64945da6d48605e53.tar.xz
(svn r19550) -Fix (r19543): Scale graphs without taking into account excluded data.
Diffstat (limited to 'src')
-rw-r--r--src/graph_gui.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index fc30b928f..501c752c4 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -200,15 +200,16 @@ protected:
OverflowSafeInt64 cost[GRAPH_MAX_DATASETS][GRAPH_NUM_MONTHS]; ///< Stored costs for the last #GRAPH_NUM_MONTHS months
/**
- * Get the highest value of the graph's data. Excluded data is taken into account too, to prevent the graph
- * from changing its size when enabling / disabling data.
- * @return Highest value of the graph.
+ * Get the highest value of the graph's data. Excluded data is ignored to allow showing smaller values in
+ * better detail when disabling higher ones.
+ * @return Highest value of the graph (ignoring disabled data).
*/
int64 GetHighestValue() const
{
OverflowSafeInt64 highest_value = 0;
for (int i = 0; i < this->num_dataset; i++) {
+ if (HasBit(this->excluded_data, i)) continue;
for (int j = 0; j < this->num_on_x_axis; j++) {
OverflowSafeInt64 datapoint = this->cost[i][j];