@@ -21,12 +21,13 @@
#include "window_func.h"
#include "date_func.h"
#include "gfx_func.h"
#include "sortlist_type.h"
#include "core/geometry_func.hpp"
#include "math.h"
#include "currency.h"
#include "table/strings.h"
#include "table/sprites.h"
/* Bitmasks of company and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_companies;
@@ -1351,14 +1352,30 @@ struct PerformanceRatingDetailWindow : W
SetDParam(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. */
uint max = 999999999; // nine 9s
* 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
* raise significantly. We need to compensate for that since {{CURRCOMPACT}}
* is used, which can produce quite short renderings of very large
* values. Otherwise the calculated width could be too narrow.
* Note that it doesn't work if there was a currency with an exchange
* rate greater than max.
* When the currency rate is more than 1000, the 999 999 k becomes at
* least 999 999 M which roughly is equally long. Furthermore if the
* exchange rate is that high, 999 999 k is usually not enough anymore
* to show the different currency numbers. */
if (_currency->rate < 1000) max /= _currency->rate;
SetDParam(0, max);
SetDParam(1, max);
uint score_detail_width = GetStringBoundingBox(STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY).width;
size->width = 7 + score_info_width + 5 + this->bar_width + 5 + score_detail_width + 7;
uint left = 7;
@@ -380,13 +380,13 @@ struct GameOptionsWindow : Window {
virtual void OnDropdownSelect(int widget, int index)
{
switch (widget) {
case GOW_CURRENCY_DROPDOWN: // Currency
if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency();
this->opt->locale.currency = index;
MarkWholeScreenDirty();
ReInitAllWindows();
break;
case GOW_DISTANCE_DROPDOWN: // Measuring units
this->opt->locale.units = index;
Status change: