|
@@ -495,25 +495,25 @@ public:
|
|
|
SetDParam(1, month + STR_MONTH_ABBREV_JAN + 2);
|
|
|
SetDParam(2, year);
|
|
|
x_label_width = max(x_label_width, GetStringBoundingBox(month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH).width);
|
|
|
|
|
|
month += 3;
|
|
|
if (month >= 12) {
|
|
|
month = 0;
|
|
|
year++;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
/* Draw the label under the data point rather than on the grid line. */
|
|
|
SetDParam(0, this->x_values_start + this->num_on_x_axis * this->x_values_increment);
|
|
|
SetDParamMaxValue(0, this->x_values_start + this->num_on_x_axis * this->x_values_increment);
|
|
|
x_label_width = GetStringBoundingBox(STR_GRAPH_Y_LABEL_NUMBER).width;
|
|
|
}
|
|
|
|
|
|
SetDParam(0, this->format_str_y_axis);
|
|
|
SetDParam(1, INT64_MAX);
|
|
|
uint y_label_width = GetStringBoundingBox(STR_GRAPH_Y_LABEL).width;
|
|
|
|
|
|
size->width = max<uint>(size->width, 5 + y_label_width + this->num_on_x_axis * (x_label_width + 5) + 9);
|
|
|
size->height = max<uint>(size->height, 5 + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->month != 0xFF ? 3 : 1)) * FONT_HEIGHT_SMALL + 4);
|
|
|
size->height = max<uint>(size->height, size->width / 3);
|
|
|
}
|
|
|
|
|
@@ -1313,28 +1313,28 @@ struct PerformanceRatingDetailWindow : W
|
|
|
|
|
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case WID_PRD_SCORE_FIRST:
|
|
|
this->bar_height = FONT_HEIGHT_NORMAL + 4;
|
|
|
size->height = this->bar_height + 2 * WD_MATRIX_TOP;
|
|
|
|
|
|
uint score_info_width = 0;
|
|
|
for (uint i = SCORE_BEGIN; i < SCORE_END; i++) {
|
|
|
score_info_width = max(score_info_width, GetStringBoundingBox(STR_PERFORMANCE_DETAIL_VEHICLES + i).width);
|
|
|
}
|
|
|
SetDParam(0, 1000);
|
|
|
SetDParamMaxValue(0, 1000);
|
|
|
score_info_width += GetStringBoundingBox(STR_BLACK_COMMA).width + WD_FRAMERECT_LEFT;
|
|
|
|
|
|
SetDParam(0, 100);
|
|
|
SetDParamMaxValue(0, 100);
|
|
|
this->bar_width = GetStringBoundingBox(STR_PERFORMANCE_DETAIL_PERCENT).width + 20; // Wide bars!
|
|
|
|
|
|
/* At this number we are roughly at the max; it can become wider,
|
|
|
* but then you need at 1000 times more money. At that time you're
|
|
|
* not that interested anymore in the last few digits anyway.
|
|
|
* The 500 is because 999 999 500 to 999 999 999 are rounded to
|
|
|
* 1 000 M, and not 999 999 k. Use negative numbers to account for
|
|
|
* the negative income/amount of money etc. as well. */
|
|
|
int max = -(999999999 - 500);
|
|
|
|
|
|
/* Scale max for the display currency. Prior to rendering the value
|
|
|
* is converted into the display currency, which may cause it to
|