|
@@ -268,25 +268,25 @@ struct GameOptionsWindow : Window {
|
|
|
/* Find the biggest description for the default size. */
|
|
|
for (int i = 0; i < BaseMusic::GetNumSets(); i++) {
|
|
|
uint invalid_files = BaseMusic::GetSet(i)->GetNumInvalid();
|
|
|
if (invalid_files == 0) continue;
|
|
|
|
|
|
SetDParam(0, invalid_files);
|
|
|
*size = maxdim(*size, GetStringBoundingBox(STR_GAME_OPTIONS_BASE_MUSIC_STATUS));
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case GOW_CURRENCY_DROPDOWN: // Setup currencies dropdown
|
|
|
ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->locale.currency, GOW_CURRENCY_DROPDOWN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
|
|
|
break;
|
|
|
|
|
|
case GOW_DISTANCE_DROPDOWN: // Setup distance unit dropdown
|
|
|
ShowDropDownMenu(this, _units_dropdown, this->opt->locale.units, GOW_DISTANCE_DROPDOWN, 0, 0);
|
|
|
break;
|
|
|
|
|
|
case GOW_ROADSIDE_DROPDOWN: { // Setup road-side dropdown
|
|
|
int i = 0;
|
|
@@ -616,25 +616,25 @@ public:
|
|
|
StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
|
|
|
for (int32 value = sdb->min; (uint32)value <= sdb->max; value += sdb->interval) {
|
|
|
SetDParam(0, sdb->str + value);
|
|
|
*size = maxdim(*size, GetStringBoundingBox(str));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
{
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
if (widget >= GDW_OPTIONS_START) {
|
|
|
widget -= GDW_OPTIONS_START;
|
|
|
if ((widget % 3) == 2) return;
|
|
|
|
|
|
/* Don't allow clients to make any changes */
|
|
|
if (_networking && !_network_server) return;
|
|
|
|
|
|
uint i;
|
|
|
const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i) + (widget / 3);
|
|
|
const SettingDescBase *sdb = &sd->desc;
|
|
|
|
|
@@ -1530,25 +1530,25 @@ struct GameSettingsWindow : Window {
|
|
|
{
|
|
|
if (widget != SETTINGSEL_OPTIONSPANEL) return;
|
|
|
|
|
|
_settings_main_page.Draw(settings_ptr, r.left + SETTINGTREE_LEFT_OFFSET, r.right - SETTINGTREE_RIGHT_OFFSET, r.top + SETTINGTREE_TOP_OFFSET,
|
|
|
this->vscroll.GetPosition(), this->vscroll.GetPosition() + this->vscroll.GetCapacity());
|
|
|
}
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
{
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
if (widget != SETTINGSEL_OPTIONSPANEL) return;
|
|
|
|
|
|
int y = pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y - SETTINGTREE_TOP_OFFSET; // Shift y coordinate
|
|
|
if (y < 0) return; // Clicked above first entry
|
|
|
|
|
|
byte btn = this->vscroll.GetPosition() + y / this->resize.step_height; // Compute which setting is selected
|
|
|
if (y % this->resize.step_height > this->resize.step_height - 2) return; // Clicked too low at the setting
|
|
|
|
|
|
uint cur_row = 0;
|
|
|
SettingEntry *pe = _settings_main_page.FindEntry(btn, &cur_row);
|
|
|
|
|
@@ -1817,25 +1817,25 @@ struct CustomCurrencyWindow : Window {
|
|
|
SetDParam(0, 1);
|
|
|
SetDParam(1, INT32_MAX);
|
|
|
*size = GetStringBoundingBox(STR_CURRENCY_EXCHANGE_RATE);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
{
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
int line = 0;
|
|
|
int len = 0;
|
|
|
StringID str = 0;
|
|
|
CharSetFilter afilter = CS_ALPHANUMERAL;
|
|
|
|
|
|
switch (widget) {
|
|
|
case CUSTCURR_RATE_DOWN:
|
|
|
if (_custom_currency.rate > 1) _custom_currency.rate--;
|
|
|
if (_custom_currency.rate == 1) this->DisableWidget(CUSTCURR_RATE_DOWN);
|
|
|
this->EnableWidget(CUSTCURR_RATE_UP);
|
|
|
break;
|