47 static const StringID _driveside_dropdown[] = {
48 STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT,
49 STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT,
53 static const StringID _autosave_dropdown[] = {
54 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF,
55 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH,
56 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_3_MONTHS,
57 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_6_MONTHS,
58 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_12_MONTHS,
62 static const StringID _gui_zoom_dropdown[] = {
63 STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_NORMAL,
64 STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_2X_ZOOM,
65 STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_4X_ZOOM,
93 if (town_name <
_nb_orig_names)
return STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + town_name;
119 static DropDownList *BuiltSetDropDownList(
int *selected_index)
121 int n = T::GetNumSets();
122 *selected_index = T::GetIndexOfUsedSet();
125 for (
int i = 0; i < n; i++) {
133 template <
class TBaseSet>
140 const char *textfile = this->baseset->GetTextfile(file_type);
159 template <
class TBaseSet>
173 this->reload =
false;
217 const StringID *items = _driveside_dropdown;
237 int enabled_item = (_game_mode == GM_MENU ||
Town::GetNumItems() == 0) ? -1 : *selected_index;
246 int newgrf_size = list->
Length();
248 if (newgrf_size > 0) {
255 *list->
Append() =
new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, enabled_item != i && enabled_item >= 0);
264 const StringID *items = _autosave_dropdown;
294 const StringID *items = _gui_zoom_dropdown;
302 list = BuiltSetDropDownList<BaseGraphics>(selected_index);
306 list = BuiltSetDropDownList<BaseSounds>(selected_index);
310 list = BuiltSetDropDownList<BaseMusic>(selected_index);
365 size->height =
max(size->height, (uint)
GetStringHeight(STR_BLACK_RAW_STRING, size->width));
371 for (
int i = 0; i < BaseGraphics::GetNumSets(); i++) {
373 if (invalid_files == 0)
continue;
384 size->height =
max(size->height, (uint)
GetStringHeight(STR_BLACK_RAW_STRING, size->width));
392 size->height =
max(size->height, (uint)
GetStringHeight(STR_BLACK_RAW_STRING, size->width));
398 for (
int i = 0; i < BaseMusic::GetNumSets(); i++) {
400 if (invalid_files == 0)
continue;
414 int width = (*it)->Width();
415 string_dim.width = width + padding.width;
416 string_dim.height = (*it)->Height(width) + padding.height;
417 *size =
maxdim(*size, string_dim);
448 if (!ToggleFullScreen(!_fullscreen)) {
476 if (_game_mode == GM_MENU) {
477 const char *name = T::GetSet(index)->name;
543 this->SetMediaSet<BaseGraphics>(index);
547 this->SetMediaSet<BaseSounds>(index);
551 this->SetMediaSet<BaseMusic>(index);
563 if (!gui_scope)
return;
569 for (
TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
580 static const NWidgetPart _nested_game_options_widgets[] = {
595 NWidget(
WWT_DROPDOWN, COLOUR_GREY,
WID_GO_RESOLUTION_DROPDOWN),
SetMinimalSize(150, 12),
SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_RESOLUTION_TOOLTIP),
SetFill(1, 0),
SetPadding(0, 0, 3, 0),
625 NWidget(
WWT_TEXT, COLOUR_GREY,
WID_GO_BASE_GRF_DESCRIPTION),
SetMinimalSize(330, 0),
SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP),
SetFill(1, 0),
SetPadding(6, 0, 6, 0),
638 NWidget(
WWT_TEXT, COLOUR_GREY,
WID_GO_BASE_SFX_DESCRIPTION),
SetMinimalSize(330, 0),
SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP),
SetFill(1, 0),
SetPadding(6, 0, 6, 0),
651 NWidget(
WWT_TEXT, COLOUR_GREY,
WID_GO_BASE_MUSIC_DESCRIPTION),
SetMinimalSize(330, 0),
SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP),
SetFill(1, 0),
SetPadding(6, 0, 6, 0),
665 _nested_game_options_widgets,
lengthof(_nested_game_options_widgets)
720 virtual void FoldAll() {}
721 virtual void UnFoldAll() {}
729 virtual uint Length()
const = 0;
730 virtual void GetFoldingState(
bool &all_folded,
bool &all_unfolded)
const {}
733 virtual uint GetMaxHelpHeight(
int maxw) {
return 0; }
741 virtual bool UpdateFilterState(
SettingFilter &filter,
bool force_visible) = 0;
743 virtual uint
Draw(
GameSettings *settings_ptr,
int left,
int right,
int y, uint first_row, uint max_row,
BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0)
const;
746 virtual void DrawSetting(
GameSettings *settings_ptr,
int left,
int right,
int y,
bool highlight)
const = 0;
758 virtual uint
Length()
const;
784 typedef std::vector<BaseSettingEntry*> EntryVector;
794 void Init(byte level = 0);
806 uint
Draw(
GameSettings *settings_ptr,
int left,
int right,
int y, uint first_row, uint max_row,
BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0)
const;
820 virtual uint
Length()
const;
821 virtual void GetFoldingState(
bool &all_folded,
bool &all_unfolded)
const;
828 virtual uint
Draw(
GameSettings *settings_ptr,
int left,
int right,
int y, uint first_row, uint max_row,
BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0)
const;
854 if (
this == item)
return true;
867 if (row_num == *cur_row)
return this;
904 if (cur_row >= max_row)
return cur_row;
907 int offset = rtl ? -4 : 4;
908 int level_width = rtl ? -LEVEL_WIDTH :
LEVEL_WIDTH;
910 int x = rtl ? right : left;
911 if (cur_row >= first_row) {
913 y += (cur_row - first_row) * SETTING_HEIGHT;
916 for (uint lvl = 0; lvl < this->
level; lvl++) {
917 if (!
HasBit(parent_last, lvl)) GfxDrawLine(x + offset, y, x + offset, y + SETTING_HEIGHT - 1, colour);
921 int halfway_y = y + SETTING_HEIGHT / 2;
923 GfxDrawLine(x + offset, y, x + offset, bottom_y, colour);
925 GfxDrawLine(x + offset, halfway_y, x + level_width - offset, halfway_y, colour);
928 this->DrawSetting(settings_ptr, rtl ? left : x, rtl ? x : right, y,
this == selected);
994 if (mode ==
RM_ALL)
return true;
1003 const void *var = ResolveVariableAddress(settings_ptr, sd);
1026 return current_value != filter_value;
1039 bool visible =
true;
1093 SetDParam(first_param++, value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
1119 const void *var = ResolveVariableAddress(settings_ptr, sd);
1131 SetDParam(0, highlight ? STR_ORANGE_STRING1_WHITE : STR_ORANGE_STRING1_LTBLUE);
1156 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1164 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1172 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1184 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1185 (*it)->GetFoldingState(all_folded, all_unfolded);
1197 bool visible =
false;
1198 bool first_visible =
true;
1199 for (EntryVector::reverse_iterator it = this->
entries.rbegin(); it != this->
entries.rend(); ++it) {
1200 visible |= (*it)->UpdateFilterState(filter, force_visible);
1201 (*it)->SetLastField(first_visible);
1202 if (visible && first_visible) first_visible =
false;
1216 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1217 if ((*it)->IsVisible(item))
return true;
1226 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1227 length += (*it)->Length();
1241 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1242 pe = (*it)->
FindEntry(row_num, cur_row);
1258 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1259 biggest =
max(biggest, (*it)->GetMaxHelpHeight(maxw));
1281 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1282 cur_row = (*it)->Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
1283 if (cur_row >= max_row) {
1298 this->title =
title;
1340 all_unfolded =
false;
1380 if (
this == item)
return true;
1381 if (this->
folded)
return false;
1390 if (this->
folded)
return 1;
1404 if (row_num == *cur_row)
return this;
1406 if (this->
folded)
return NULL;
1428 if (cur_row >= max_row)
return cur_row;
1430 cur_row =
BaseSettingEntry::Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
1434 assert(this->
level < 8 *
sizeof(parent_last));
1438 cur_row =
SettingsContainer::Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
1455 DrawSprite((this->
folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? right - _circle_size.width : left, y + (SETTING_HEIGHT - _circle_size.height) / 2);
1456 DrawString(rtl ? left : left + _circle_size.width + 2, rtl ? right - _circle_size.width - 2 : right, y + (SETTING_HEIGHT -
FONT_HEIGHT_NORMAL) / 2, this->title);
1471 localisation->Add(
new SettingEntry(
"locale.units_velocity"));
1472 localisation->Add(
new SettingEntry(
"locale.units_power"));
1473 localisation->Add(
new SettingEntry(
"locale.units_weight"));
1474 localisation->Add(
new SettingEntry(
"locale.units_volume"));
1475 localisation->Add(
new SettingEntry(
"locale.units_force"));
1476 localisation->Add(
new SettingEntry(
"locale.units_height"));
1477 localisation->Add(
new SettingEntry(
"gui.date_format_in_default_names"));
1484 graphics->Add(
new SettingEntry(
"gui.smallmap_land_colour"));
1485 graphics->Add(
new SettingEntry(
"gui.graph_line_thickness"));
1500 SettingsPage *
interface = main->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE));
1502 SettingsPage *general = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_GENERAL));
1507 general->Add(
new SettingEntry(
"gui.window_snap_radius"));
1508 general->Add(
new SettingEntry(
"gui.window_soft_limit"));
1509 general->Add(
new SettingEntry(
"gui.right_mouse_wnd_close"));
1512 SettingsPage *viewports = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_VIEWPORTS));
1514 viewports->Add(
new SettingEntry(
"gui.auto_scrolling"));
1515 viewports->Add(
new SettingEntry(
"gui.reverse_scroll"));
1517 viewports->Add(
new SettingEntry(
"gui.left_mouse_btn_scrolling"));
1521 viewports->Add(
new SettingEntry(
"gui.scrollwheel_scrolling"));
1522 viewports->Add(
new SettingEntry(
"gui.scrollwheel_multiplier"));
1525 viewports->Add(
new SettingEntry(
"gui.right_mouse_btn_emulation"));
1527 viewports->Add(
new SettingEntry(
"gui.population_in_label"));
1529 viewports->Add(
new SettingEntry(
"construction.train_signal_side"));
1530 viewports->Add(
new SettingEntry(
"gui.measure_tooltip"));
1531 viewports->Add(
new SettingEntry(
"gui.loading_indicators"));
1532 viewports->Add(
new SettingEntry(
"gui.show_track_reservation"));
1535 SettingsPage *construction = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION));
1537 construction->Add(
new SettingEntry(
"gui.link_terraform_toolbar"));
1538 construction->Add(
new SettingEntry(
"gui.enable_signal_gui"));
1539 construction->Add(
new SettingEntry(
"gui.persistent_buildingtools"));
1541 construction->Add(
new SettingEntry(
"gui.default_rail_type"));
1542 construction->Add(
new SettingEntry(
"gui.disable_unsuitable_building"));
1548 interface->Add(
new SettingEntry(
"gui.prefer_teamchat"));
1549 interface->Add(
new SettingEntry(
"gui.advanced_vehicle_list"));
1550 interface->Add(
new SettingEntry(
"gui.timetable_in_ticks"));
1551 interface->Add(
new SettingEntry(
"gui.timetable_arrival_departure"));
1552 interface->Add(
new SettingEntry(
"gui.expenses_layout"));
1555 SettingsPage *advisors = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ADVISORS));
1557 advisors->Add(
new SettingEntry(
"gui.coloured_news_year"));
1558 advisors->Add(
new SettingEntry(
"news_display.general"));
1559 advisors->Add(
new SettingEntry(
"news_display.new_vehicles"));
1560 advisors->Add(
new SettingEntry(
"news_display.accident"));
1561 advisors->Add(
new SettingEntry(
"news_display.company_info"));
1562 advisors->Add(
new SettingEntry(
"news_display.acceptance"));
1563 advisors->Add(
new SettingEntry(
"news_display.arrival_player"));
1564 advisors->Add(
new SettingEntry(
"news_display.arrival_other"));
1565 advisors->Add(
new SettingEntry(
"news_display.advice"));
1566 advisors->Add(
new SettingEntry(
"gui.order_review_system"));
1567 advisors->Add(
new SettingEntry(
"gui.vehicle_income_warn"));
1568 advisors->Add(
new SettingEntry(
"gui.lost_vehicle_warn"));
1570 advisors->Add(
new SettingEntry(
"news_display.economy"));
1571 advisors->Add(
new SettingEntry(
"news_display.subsidies"));
1574 advisors->Add(
new SettingEntry(
"news_display.production_player"));
1575 advisors->Add(
new SettingEntry(
"news_display.production_other"));
1576 advisors->Add(
new SettingEntry(
"news_display.production_nobody"));
1579 SettingsPage *company = main->Add(
new SettingsPage(STR_CONFIG_SETTING_COMPANY));
1581 company->Add(
new SettingEntry(
"gui.semaphore_build_before"));
1582 company->Add(
new SettingEntry(
"gui.default_signal_type"));
1583 company->Add(
new SettingEntry(
"gui.cycle_signal_types"));
1584 company->Add(
new SettingEntry(
"gui.drag_signals_fixed_distance"));
1587 company->Add(
new SettingEntry(
"company.engine_renew"));
1588 company->Add(
new SettingEntry(
"company.engine_renew_months"));
1589 company->Add(
new SettingEntry(
"company.engine_renew_money"));
1590 company->Add(
new SettingEntry(
"vehicle.servint_ispercent"));
1591 company->Add(
new SettingEntry(
"vehicle.servint_trains"));
1592 company->Add(
new SettingEntry(
"vehicle.servint_roadveh"));
1593 company->Add(
new SettingEntry(
"vehicle.servint_ships"));
1594 company->Add(
new SettingEntry(
"vehicle.servint_aircraft"));
1597 SettingsPage *accounting = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
1599 accounting->Add(
new SettingEntry(
"economy.inflation"));
1600 accounting->Add(
new SettingEntry(
"difficulty.initial_interest"));
1601 accounting->Add(
new SettingEntry(
"difficulty.max_loan"));
1602 accounting->Add(
new SettingEntry(
"difficulty.subsidy_multiplier"));
1603 accounting->Add(
new SettingEntry(
"economy.feeder_payment_share"));
1604 accounting->Add(
new SettingEntry(
"economy.infrastructure_maintenance"));
1605 accounting->Add(
new SettingEntry(
"difficulty.vehicle_costs"));
1606 accounting->Add(
new SettingEntry(
"difficulty.construction_cost"));
1609 SettingsPage *vehicles = main->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES));
1611 SettingsPage *physics = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_PHYSICS));
1613 physics->Add(
new SettingEntry(
"vehicle.train_acceleration_model"));
1614 physics->Add(
new SettingEntry(
"vehicle.train_slope_steepness"));
1615 physics->Add(
new SettingEntry(
"vehicle.wagon_speed_limits"));
1616 physics->Add(
new SettingEntry(
"vehicle.freight_trains"));
1617 physics->Add(
new SettingEntry(
"vehicle.roadveh_acceleration_model"));
1618 physics->Add(
new SettingEntry(
"vehicle.roadveh_slope_steepness"));
1619 physics->Add(
new SettingEntry(
"vehicle.smoke_amount"));
1623 SettingsPage *routing = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
1625 routing->Add(
new SettingEntry(
"pf.pathfinder_for_trains"));
1626 routing->Add(
new SettingEntry(
"difficulty.line_reverse_mode"));
1627 routing->Add(
new SettingEntry(
"pf.reverse_at_signals"));
1629 routing->Add(
new SettingEntry(
"pf.pathfinder_for_roadvehs"));
1630 routing->Add(
new SettingEntry(
"pf.pathfinder_for_ships"));
1633 vehicles->Add(
new SettingEntry(
"order.no_servicing_if_no_breakdowns"));
1634 vehicles->Add(
new SettingEntry(
"order.serviceathelipad"));
1637 SettingsPage *limitations = main->Add(
new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
1639 limitations->Add(
new SettingEntry(
"construction.command_pause_level"));
1640 limitations->Add(
new SettingEntry(
"construction.autoslope"));
1641 limitations->Add(
new SettingEntry(
"construction.extra_dynamite"));
1642 limitations->Add(
new SettingEntry(
"construction.max_heightlevel"));
1643 limitations->Add(
new SettingEntry(
"construction.max_bridge_length"));
1644 limitations->Add(
new SettingEntry(
"construction.max_bridge_height"));
1645 limitations->Add(
new SettingEntry(
"construction.max_tunnel_length"));
1646 limitations->Add(
new SettingEntry(
"station.never_expire_airports"));
1647 limitations->Add(
new SettingEntry(
"vehicle.never_expire_vehicles"));
1648 limitations->Add(
new SettingEntry(
"vehicle.max_trains"));
1649 limitations->Add(
new SettingEntry(
"vehicle.max_roadveh"));
1650 limitations->Add(
new SettingEntry(
"vehicle.max_aircraft"));
1651 limitations->Add(
new SettingEntry(
"vehicle.max_ships"));
1652 limitations->Add(
new SettingEntry(
"vehicle.max_train_length"));
1653 limitations->Add(
new SettingEntry(
"station.station_spread"));
1654 limitations->Add(
new SettingEntry(
"station.distant_join_stations"));
1655 limitations->Add(
new SettingEntry(
"construction.road_stop_on_town_road"));
1656 limitations->Add(
new SettingEntry(
"construction.road_stop_on_competitor_road"));
1657 limitations->Add(
new SettingEntry(
"vehicle.disable_elrails"));
1660 SettingsPage *disasters = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCIDENTS));
1662 disasters->Add(
new SettingEntry(
"difficulty.disasters"));
1663 disasters->Add(
new SettingEntry(
"difficulty.economy"));
1664 disasters->Add(
new SettingEntry(
"difficulty.vehicle_breakdowns"));
1665 disasters->Add(
new SettingEntry(
"vehicle.plane_crashes"));
1668 SettingsPage *genworld = main->Add(
new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
1670 genworld->Add(
new SettingEntry(
"game_creation.landscape"));
1671 genworld->Add(
new SettingEntry(
"game_creation.land_generator"));
1672 genworld->Add(
new SettingEntry(
"difficulty.terrain_type"));
1673 genworld->Add(
new SettingEntry(
"game_creation.tgen_smoothness"));
1674 genworld->Add(
new SettingEntry(
"game_creation.variety"));
1675 genworld->Add(
new SettingEntry(
"game_creation.snow_line_height"));
1676 genworld->Add(
new SettingEntry(
"game_creation.amount_of_rivers"));
1677 genworld->Add(
new SettingEntry(
"game_creation.tree_placer"));
1679 genworld->Add(
new SettingEntry(
"economy.larger_towns"));
1680 genworld->Add(
new SettingEntry(
"economy.initial_city_size"));
1681 genworld->Add(
new SettingEntry(
"economy.town_layout"));
1682 genworld->Add(
new SettingEntry(
"difficulty.industry_density"));
1683 genworld->Add(
new SettingEntry(
"gui.pause_on_newgame"));
1686 SettingsPage *environment = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT));
1688 SettingsPage *authorities = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES));
1690 authorities->Add(
new SettingEntry(
"difficulty.town_council_tolerance"));
1692 authorities->Add(
new SettingEntry(
"economy.exclusive_rights"));
1693 authorities->Add(
new SettingEntry(
"economy.fund_roads"));
1694 authorities->Add(
new SettingEntry(
"economy.fund_buildings"));
1695 authorities->Add(
new SettingEntry(
"economy.station_noise_level"));
1698 SettingsPage *towns = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_TOWNS));
1700 towns->Add(
new SettingEntry(
"economy.town_growth_rate"));
1701 towns->Add(
new SettingEntry(
"economy.allow_town_roads"));
1702 towns->Add(
new SettingEntry(
"economy.allow_town_level_crossings"));
1706 SettingsPage *industries = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));
1708 industries->Add(
new SettingEntry(
"construction.raw_industry_construction"));
1709 industries->Add(
new SettingEntry(
"construction.industry_platform"));
1710 industries->Add(
new SettingEntry(
"economy.multiple_industry_per_town"));
1711 industries->Add(
new SettingEntry(
"game_creation.oil_refinery_limit"));
1712 industries->Add(
new SettingEntry(
"economy.smooth_economy"));
1715 SettingsPage *cdist = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST));
1718 cdist->Add(
new SettingEntry(
"linkgraph.recalc_interval"));
1719 cdist->Add(
new SettingEntry(
"linkgraph.distribution_pax"));
1720 cdist->Add(
new SettingEntry(
"linkgraph.distribution_mail"));
1721 cdist->Add(
new SettingEntry(
"linkgraph.distribution_armoured"));
1722 cdist->Add(
new SettingEntry(
"linkgraph.distribution_default"));
1724 cdist->Add(
new SettingEntry(
"linkgraph.demand_distance"));
1726 cdist->Add(
new SettingEntry(
"linkgraph.short_path_saturation"));
1729 environment->Add(
new SettingEntry(
"station.modified_catchment"));
1730 environment->Add(
new SettingEntry(
"construction.extra_tree_placement"));
1733 SettingsPage *ai = main->Add(
new SettingsPage(STR_CONFIG_SETTING_AI));
1735 SettingsPage *npc = ai->Add(
new SettingsPage(STR_CONFIG_SETTING_AI_NPC));
1738 npc->Add(
new SettingEntry(
"script.script_max_opcode_till_suspend"));
1739 npc->Add(
new SettingEntry(
"difficulty.competitor_speed"));
1742 npc->Add(
new SettingEntry(
"ai.ai_disable_veh_roadveh"));
1743 npc->Add(
new SettingEntry(
"ai.ai_disable_veh_aircraft"));
1756 static const StringID _game_settings_restrict_dropdown[] = {
1757 STR_CONFIG_SETTING_RESTRICT_BASIC,
1758 STR_CONFIG_SETTING_RESTRICT_ADVANCED,
1759 STR_CONFIG_SETTING_RESTRICT_ALL,
1760 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_DEFAULT,
1761 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_NEW,
1763 assert_compile(
lengthof(_game_settings_restrict_dropdown) ==
RM_END);
1801 this->filter.min_cat =
RM_ALL;
1802 this->filter.type =
ST_ALL;
1803 this->filter.type_hides =
false;
1838 static const StringID setting_types[] = {
1839 STR_CONFIG_SETTING_TYPE_CLIENT,
1840 STR_CONFIG_SETTING_TYPE_COMPANY_MENU, STR_CONFIG_SETTING_TYPE_COMPANY_INGAME,
1841 STR_CONFIG_SETTING_TYPE_GAME_MENU, STR_CONFIG_SETTING_TYPE_GAME_INGAME,
1843 for (uint i = 0; i <
lengthof(setting_types); i++) {
1875 if (this->warn_missing ==
WHR_NONE) {
1889 if (this->warn_missing !=
WHR_NONE) {
1891 const int right = left + panel->
current_x - 1;
1912 case ST_GAME:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME);
break;
1913 case ST_COMPANY:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME);
break;
1915 default:
SetDParam(0, STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL);
break;
1928 for (
int mode = 0; mode !=
RM_END; mode++) {
1940 *list->
Append() =
new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME,
ST_GAME,
false);
1941 *list->
Append() =
new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME,
ST_COMPANY,
false);
1955 this->vscroll->GetPosition(), last_row, this->
last_clicked);
1966 case ST_COMPANY:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME);
break;
1968 case ST_GAME:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME);
break;
1969 default: NOT_REACHED();
1971 DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE);
1976 DrawString(r.left, r.right, y, STR_CONFIG_SETTING_DEFAULT_VALUE);
1979 DrawStringMultiLine(r.left, r.right, y, r.bottom, this->last_clicked->GetHelpText(), TC_WHITE);
2033 if (btn == INT_MAX || (
int)btn < this->
warn_lines)
return;
2039 if (clicked_entry == NULL)
return;
2045 if (clicked_page != NULL) {
2065 const void *var = ResolveVariableAddress(settings_ptr, sd);
2093 if (pt.y >= wi_rect.top && pt.y <= wi_rect.bottom) {
2098 for (
int i = sdb->
min; i <= (
int)sdb->
max; i++) {
2109 int32 oldvalue = value;
2120 if (step == 0) step = 1;
2132 assert((int32)sdb->
max >= 0);
2133 if (value > (int32)sdb->
max) value = (int32)sdb->
max;
2135 if ((uint32)value > sdb->
max) value = (int32)sdb->
max;
2137 if (value < sdb->
min) value = sdb->
min;
2144 if (value != oldvalue) {
2145 if (this->clicked_entry != NULL) {
2146 this->clicked_entry->SetButtons(0);
2148 this->clicked_entry = pe;
2156 default: NOT_REACHED();
2159 if (value != oldvalue) {
2193 if (str == NULL)
return;
2205 value = (int32)(
size_t)sd->
desc.
def;
2281 if (!gui_scope)
return;
2285 this->filter.min_cat = min_level;
2286 this->filter.type_hides =
false;
2302 bool all_folded =
true;
2303 bool all_unfolded =
true;
2330 static const NWidgetPart _nested_settings_selection_widgets[] = {
2340 NWidget(
WWT_DROPDOWN, COLOUR_MAUVE,
WID_GS_RESTRICT_DROPDOWN),
SetMinimalSize(100, 12),
SetDataTip(STR_BLACK_STRING, STR_CONFIG_SETTING_RESTRICT_DROPDOWN_HELPTEXT),
SetFill(1, 0),
SetResize(1, 0),
2344 NWidget(
WWT_DROPDOWN, COLOUR_MAUVE,
WID_GS_TYPE_DROPDOWN),
SetMinimalSize(100, 12),
SetDataTip(STR_BLACK_STRING, STR_CONFIG_SETTING_TYPE_DROPDOWN_HELPTEXT),
SetFill(1, 0),
SetResize(1, 0),
2351 SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
2375 _nested_settings_selection_widgets,
lengthof(_nested_settings_selection_widgets)
2395 void DrawArrowButtons(
int x,
int y, Colours button_colour, byte state,
bool clickable_left,
bool clickable_right)
2398 Dimension dim = NWidgetScrollbar::GetHorizontalDimension();
2400 DrawFrameRect(x, y, x + dim.width - 1, y + dim.height - 1, button_colour, (state == 1) ?
FR_LOWERED : FR_NONE);
2401 DrawFrameRect(x + dim.width, y, x + dim.width + dim.width - 1, y + dim.height - 1, button_colour, (state == 2) ?
FR_LOWERED : FR_NONE);
2407 if (rtl ? !clickable_right : !clickable_left) {
2410 if (rtl ? !clickable_left : !clickable_right) {
2444 static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}};
2458 void SetButtonState()
2474 SetDParam(0, (_custom_currency.to_euro !=
CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER);
2512 if (_custom_currency.rate > 1) _custom_currency.rate--;
2518 if (_custom_currency.rate < UINT16_MAX) _custom_currency.rate++;
2534 str = STR_JUST_RAW_STRING;
2542 str = STR_JUST_RAW_STRING;
2550 str = STR_JUST_RAW_STRING;
2556 _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ?
CF_NOEURO : _custom_currency.to_euro - 1;
2562 _custom_currency.to_euro =
Clamp(_custom_currency.to_euro + 1, 2000,
MAX_YEAR);
2577 this->query_widget = line;
2578 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1,
this, afilter, QSF_NONE);
2587 if (str == NULL)
return;
2589 switch (this->query_widget) {
2591 _custom_currency.rate =
Clamp(atoi(str), 1, UINT16_MAX);
2595 strecpy(_custom_currency.separator, str,
lastof(_custom_currency.separator));
2599 strecpy(_custom_currency.prefix, str,
lastof(_custom_currency.prefix));
2603 strecpy(_custom_currency.suffix, str,
lastof(_custom_currency.suffix));
2607 int val = atoi(str);
2623 static const NWidgetPart _nested_cust_currency_widgets[] = {
2659 SetDataTip(STR_CURRENCY_PREVIEW, STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP),
SetPadding(15, 1, 18, 2),
2667 _nested_cust_currency_widgets,
lengthof(_nested_cust_currency_widgets)