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"));
1511 SettingsPage *viewports = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_VIEWPORTS));
1513 viewports->Add(
new SettingEntry(
"gui.auto_scrolling"));
1514 viewports->Add(
new SettingEntry(
"gui.reverse_scroll"));
1516 viewports->Add(
new SettingEntry(
"gui.left_mouse_btn_scrolling"));
1520 viewports->Add(
new SettingEntry(
"gui.scrollwheel_scrolling"));
1521 viewports->Add(
new SettingEntry(
"gui.scrollwheel_multiplier"));
1524 viewports->Add(
new SettingEntry(
"gui.right_mouse_btn_emulation"));
1526 viewports->Add(
new SettingEntry(
"gui.population_in_label"));
1528 viewports->Add(
new SettingEntry(
"construction.train_signal_side"));
1529 viewports->Add(
new SettingEntry(
"gui.measure_tooltip"));
1530 viewports->Add(
new SettingEntry(
"gui.loading_indicators"));
1531 viewports->Add(
new SettingEntry(
"gui.show_track_reservation"));
1534 SettingsPage *construction = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION));
1536 construction->Add(
new SettingEntry(
"gui.link_terraform_toolbar"));
1537 construction->Add(
new SettingEntry(
"gui.enable_signal_gui"));
1538 construction->Add(
new SettingEntry(
"gui.persistent_buildingtools"));
1540 construction->Add(
new SettingEntry(
"gui.default_rail_type"));
1541 construction->Add(
new SettingEntry(
"gui.disable_unsuitable_building"));
1547 interface->Add(
new SettingEntry(
"gui.prefer_teamchat"));
1548 interface->Add(
new SettingEntry(
"gui.advanced_vehicle_list"));
1549 interface->Add(
new SettingEntry(
"gui.timetable_in_ticks"));
1550 interface->Add(
new SettingEntry(
"gui.timetable_arrival_departure"));
1551 interface->Add(
new SettingEntry(
"gui.expenses_layout"));
1554 SettingsPage *advisors = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ADVISORS));
1556 advisors->Add(
new SettingEntry(
"gui.coloured_news_year"));
1557 advisors->Add(
new SettingEntry(
"news_display.general"));
1558 advisors->Add(
new SettingEntry(
"news_display.new_vehicles"));
1559 advisors->Add(
new SettingEntry(
"news_display.accident"));
1560 advisors->Add(
new SettingEntry(
"news_display.company_info"));
1561 advisors->Add(
new SettingEntry(
"news_display.acceptance"));
1562 advisors->Add(
new SettingEntry(
"news_display.arrival_player"));
1563 advisors->Add(
new SettingEntry(
"news_display.arrival_other"));
1564 advisors->Add(
new SettingEntry(
"news_display.advice"));
1565 advisors->Add(
new SettingEntry(
"gui.order_review_system"));
1566 advisors->Add(
new SettingEntry(
"gui.vehicle_income_warn"));
1567 advisors->Add(
new SettingEntry(
"gui.lost_vehicle_warn"));
1569 advisors->Add(
new SettingEntry(
"news_display.economy"));
1570 advisors->Add(
new SettingEntry(
"news_display.subsidies"));
1573 advisors->Add(
new SettingEntry(
"news_display.production_player"));
1574 advisors->Add(
new SettingEntry(
"news_display.production_other"));
1575 advisors->Add(
new SettingEntry(
"news_display.production_nobody"));
1578 SettingsPage *company = main->Add(
new SettingsPage(STR_CONFIG_SETTING_COMPANY));
1580 company->Add(
new SettingEntry(
"gui.semaphore_build_before"));
1581 company->Add(
new SettingEntry(
"gui.default_signal_type"));
1582 company->Add(
new SettingEntry(
"gui.cycle_signal_types"));
1583 company->Add(
new SettingEntry(
"gui.drag_signals_fixed_distance"));
1586 company->Add(
new SettingEntry(
"company.engine_renew"));
1587 company->Add(
new SettingEntry(
"company.engine_renew_months"));
1588 company->Add(
new SettingEntry(
"company.engine_renew_money"));
1589 company->Add(
new SettingEntry(
"vehicle.servint_ispercent"));
1590 company->Add(
new SettingEntry(
"vehicle.servint_trains"));
1591 company->Add(
new SettingEntry(
"vehicle.servint_roadveh"));
1592 company->Add(
new SettingEntry(
"vehicle.servint_ships"));
1593 company->Add(
new SettingEntry(
"vehicle.servint_aircraft"));
1596 SettingsPage *accounting = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
1598 accounting->Add(
new SettingEntry(
"economy.inflation"));
1599 accounting->Add(
new SettingEntry(
"difficulty.initial_interest"));
1600 accounting->Add(
new SettingEntry(
"difficulty.max_loan"));
1601 accounting->Add(
new SettingEntry(
"difficulty.subsidy_multiplier"));
1602 accounting->Add(
new SettingEntry(
"economy.feeder_payment_share"));
1603 accounting->Add(
new SettingEntry(
"economy.infrastructure_maintenance"));
1604 accounting->Add(
new SettingEntry(
"difficulty.vehicle_costs"));
1605 accounting->Add(
new SettingEntry(
"difficulty.construction_cost"));
1608 SettingsPage *vehicles = main->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES));
1610 SettingsPage *physics = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_PHYSICS));
1612 physics->Add(
new SettingEntry(
"vehicle.train_acceleration_model"));
1613 physics->Add(
new SettingEntry(
"vehicle.train_slope_steepness"));
1614 physics->Add(
new SettingEntry(
"vehicle.wagon_speed_limits"));
1615 physics->Add(
new SettingEntry(
"vehicle.freight_trains"));
1616 physics->Add(
new SettingEntry(
"vehicle.roadveh_acceleration_model"));
1617 physics->Add(
new SettingEntry(
"vehicle.roadveh_slope_steepness"));
1618 physics->Add(
new SettingEntry(
"vehicle.smoke_amount"));
1622 SettingsPage *routing = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
1624 routing->Add(
new SettingEntry(
"pf.pathfinder_for_trains"));
1625 routing->Add(
new SettingEntry(
"difficulty.line_reverse_mode"));
1626 routing->Add(
new SettingEntry(
"pf.reverse_at_signals"));
1628 routing->Add(
new SettingEntry(
"pf.pathfinder_for_roadvehs"));
1629 routing->Add(
new SettingEntry(
"pf.pathfinder_for_ships"));
1632 vehicles->Add(
new SettingEntry(
"order.no_servicing_if_no_breakdowns"));
1633 vehicles->Add(
new SettingEntry(
"order.serviceathelipad"));
1636 SettingsPage *limitations = main->Add(
new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
1638 limitations->Add(
new SettingEntry(
"construction.command_pause_level"));
1639 limitations->Add(
new SettingEntry(
"construction.autoslope"));
1640 limitations->Add(
new SettingEntry(
"construction.extra_dynamite"));
1641 limitations->Add(
new SettingEntry(
"construction.max_heightlevel"));
1642 limitations->Add(
new SettingEntry(
"construction.max_bridge_length"));
1643 limitations->Add(
new SettingEntry(
"construction.max_bridge_height"));
1644 limitations->Add(
new SettingEntry(
"construction.max_tunnel_length"));
1645 limitations->Add(
new SettingEntry(
"station.never_expire_airports"));
1646 limitations->Add(
new SettingEntry(
"vehicle.never_expire_vehicles"));
1647 limitations->Add(
new SettingEntry(
"vehicle.max_trains"));
1648 limitations->Add(
new SettingEntry(
"vehicle.max_roadveh"));
1649 limitations->Add(
new SettingEntry(
"vehicle.max_aircraft"));
1650 limitations->Add(
new SettingEntry(
"vehicle.max_ships"));
1651 limitations->Add(
new SettingEntry(
"vehicle.max_train_length"));
1652 limitations->Add(
new SettingEntry(
"station.station_spread"));
1653 limitations->Add(
new SettingEntry(
"station.distant_join_stations"));
1654 limitations->Add(
new SettingEntry(
"construction.road_stop_on_town_road"));
1655 limitations->Add(
new SettingEntry(
"construction.road_stop_on_competitor_road"));
1656 limitations->Add(
new SettingEntry(
"vehicle.disable_elrails"));
1659 SettingsPage *disasters = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCIDENTS));
1661 disasters->Add(
new SettingEntry(
"difficulty.disasters"));
1662 disasters->Add(
new SettingEntry(
"difficulty.economy"));
1663 disasters->Add(
new SettingEntry(
"difficulty.vehicle_breakdowns"));
1664 disasters->Add(
new SettingEntry(
"vehicle.plane_crashes"));
1667 SettingsPage *genworld = main->Add(
new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
1669 genworld->Add(
new SettingEntry(
"game_creation.landscape"));
1670 genworld->Add(
new SettingEntry(
"game_creation.land_generator"));
1671 genworld->Add(
new SettingEntry(
"difficulty.terrain_type"));
1672 genworld->Add(
new SettingEntry(
"game_creation.tgen_smoothness"));
1673 genworld->Add(
new SettingEntry(
"game_creation.variety"));
1674 genworld->Add(
new SettingEntry(
"game_creation.snow_line_height"));
1675 genworld->Add(
new SettingEntry(
"game_creation.amount_of_rivers"));
1676 genworld->Add(
new SettingEntry(
"game_creation.tree_placer"));
1678 genworld->Add(
new SettingEntry(
"economy.larger_towns"));
1679 genworld->Add(
new SettingEntry(
"economy.initial_city_size"));
1680 genworld->Add(
new SettingEntry(
"economy.town_layout"));
1681 genworld->Add(
new SettingEntry(
"difficulty.industry_density"));
1682 genworld->Add(
new SettingEntry(
"gui.pause_on_newgame"));
1685 SettingsPage *environment = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT));
1687 SettingsPage *authorities = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES));
1689 authorities->Add(
new SettingEntry(
"difficulty.town_council_tolerance"));
1691 authorities->Add(
new SettingEntry(
"economy.exclusive_rights"));
1692 authorities->Add(
new SettingEntry(
"economy.fund_roads"));
1693 authorities->Add(
new SettingEntry(
"economy.fund_buildings"));
1694 authorities->Add(
new SettingEntry(
"economy.station_noise_level"));
1697 SettingsPage *towns = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_TOWNS));
1699 towns->Add(
new SettingEntry(
"economy.town_growth_rate"));
1700 towns->Add(
new SettingEntry(
"economy.allow_town_roads"));
1701 towns->Add(
new SettingEntry(
"economy.allow_town_level_crossings"));
1705 SettingsPage *industries = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));
1707 industries->Add(
new SettingEntry(
"construction.raw_industry_construction"));
1708 industries->Add(
new SettingEntry(
"construction.industry_platform"));
1709 industries->Add(
new SettingEntry(
"economy.multiple_industry_per_town"));
1710 industries->Add(
new SettingEntry(
"game_creation.oil_refinery_limit"));
1711 industries->Add(
new SettingEntry(
"economy.smooth_economy"));
1714 SettingsPage *cdist = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST));
1717 cdist->Add(
new SettingEntry(
"linkgraph.recalc_interval"));
1718 cdist->Add(
new SettingEntry(
"linkgraph.distribution_pax"));
1719 cdist->Add(
new SettingEntry(
"linkgraph.distribution_mail"));
1720 cdist->Add(
new SettingEntry(
"linkgraph.distribution_armoured"));
1721 cdist->Add(
new SettingEntry(
"linkgraph.distribution_default"));
1723 cdist->Add(
new SettingEntry(
"linkgraph.demand_distance"));
1725 cdist->Add(
new SettingEntry(
"linkgraph.short_path_saturation"));
1728 environment->Add(
new SettingEntry(
"station.modified_catchment"));
1729 environment->Add(
new SettingEntry(
"construction.extra_tree_placement"));
1732 SettingsPage *ai = main->Add(
new SettingsPage(STR_CONFIG_SETTING_AI));
1734 SettingsPage *npc = ai->Add(
new SettingsPage(STR_CONFIG_SETTING_AI_NPC));
1737 npc->Add(
new SettingEntry(
"script.script_max_opcode_till_suspend"));
1738 npc->Add(
new SettingEntry(
"difficulty.competitor_speed"));
1741 npc->Add(
new SettingEntry(
"ai.ai_disable_veh_roadveh"));
1742 npc->Add(
new SettingEntry(
"ai.ai_disable_veh_aircraft"));
1755 static const StringID _game_settings_restrict_dropdown[] = {
1756 STR_CONFIG_SETTING_RESTRICT_BASIC,
1757 STR_CONFIG_SETTING_RESTRICT_ADVANCED,
1758 STR_CONFIG_SETTING_RESTRICT_ALL,
1759 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_DEFAULT,
1760 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_NEW,
1762 assert_compile(
lengthof(_game_settings_restrict_dropdown) ==
RM_END);
1800 this->filter.min_cat =
RM_ALL;
1801 this->filter.type =
ST_ALL;
1802 this->filter.type_hides =
false;
1837 static const StringID setting_types[] = {
1838 STR_CONFIG_SETTING_TYPE_CLIENT,
1839 STR_CONFIG_SETTING_TYPE_COMPANY_MENU, STR_CONFIG_SETTING_TYPE_COMPANY_INGAME,
1840 STR_CONFIG_SETTING_TYPE_GAME_MENU, STR_CONFIG_SETTING_TYPE_GAME_INGAME,
1842 for (uint i = 0; i <
lengthof(setting_types); i++) {
1874 if (this->warn_missing ==
WHR_NONE) {
1888 if (this->warn_missing !=
WHR_NONE) {
1890 const int right = left + panel->
current_x - 1;
1911 case ST_GAME:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME);
break;
1912 case ST_COMPANY:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME);
break;
1914 default:
SetDParam(0, STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL);
break;
1927 for (
int mode = 0; mode !=
RM_END; mode++) {
1939 *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);
1940 *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);
1954 this->vscroll->GetPosition(), last_row, this->
last_clicked);
1965 case ST_COMPANY:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME);
break;
1967 case ST_GAME:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME);
break;
1968 default: NOT_REACHED();
1970 DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE);
1975 DrawString(r.left, r.right, y, STR_CONFIG_SETTING_DEFAULT_VALUE);
1978 DrawStringMultiLine(r.left, r.right, y, r.bottom, this->last_clicked->GetHelpText(), TC_WHITE);
2032 if (btn == INT_MAX || (
int)btn < this->
warn_lines)
return;
2038 if (clicked_entry == NULL)
return;
2044 if (clicked_page != NULL) {
2064 const void *var = ResolveVariableAddress(settings_ptr, sd);
2092 if (pt.y >= wi_rect.top && pt.y <= wi_rect.bottom) {
2097 for (
int i = sdb->
min; i <= (
int)sdb->
max; i++) {
2108 int32 oldvalue = value;
2119 if (step == 0) step = 1;
2131 assert((int32)sdb->
max >= 0);
2132 if (value > (int32)sdb->
max) value = (int32)sdb->
max;
2134 if ((uint32)value > sdb->
max) value = (int32)sdb->
max;
2136 if (value < sdb->
min) value = sdb->
min;
2143 if (value != oldvalue) {
2144 if (this->clicked_entry != NULL) {
2145 this->clicked_entry->SetButtons(0);
2147 this->clicked_entry = pe;
2155 default: NOT_REACHED();
2158 if (value != oldvalue) {
2192 if (str == NULL)
return;
2204 value = (int32)(
size_t)sd->
desc.
def;
2280 if (!gui_scope)
return;
2284 this->filter.min_cat = min_level;
2285 this->filter.type_hides =
false;
2301 bool all_folded =
true;
2302 bool all_unfolded =
true;
2329 static const NWidgetPart _nested_settings_selection_widgets[] = {
2339 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),
2343 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),
2350 SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
2374 _nested_settings_selection_widgets,
lengthof(_nested_settings_selection_widgets)
2394 void DrawArrowButtons(
int x,
int y, Colours button_colour, byte state,
bool clickable_left,
bool clickable_right)
2397 Dimension dim = NWidgetScrollbar::GetHorizontalDimension();
2399 DrawFrameRect(x, y, x + dim.width - 1, y + dim.height - 1, button_colour, (state == 1) ?
FR_LOWERED : FR_NONE);
2400 DrawFrameRect(x + dim.width, y, x + dim.width + dim.width - 1, y + dim.height - 1, button_colour, (state == 2) ?
FR_LOWERED : FR_NONE);
2406 if (rtl ? !clickable_right : !clickable_left) {
2409 if (rtl ? !clickable_left : !clickable_right) {
2443 static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}};
2457 void SetButtonState()
2473 SetDParam(0, (_custom_currency.to_euro !=
CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER);
2511 if (_custom_currency.rate > 1) _custom_currency.rate--;
2517 if (_custom_currency.rate < UINT16_MAX) _custom_currency.rate++;
2533 str = STR_JUST_RAW_STRING;
2541 str = STR_JUST_RAW_STRING;
2549 str = STR_JUST_RAW_STRING;
2555 _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ?
CF_NOEURO : _custom_currency.to_euro - 1;
2561 _custom_currency.to_euro =
Clamp(_custom_currency.to_euro + 1, 2000,
MAX_YEAR);
2576 this->query_widget = line;
2577 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1,
this, afilter, QSF_NONE);
2586 if (str == NULL)
return;
2588 switch (this->query_widget) {
2590 _custom_currency.rate =
Clamp(atoi(str), 1, UINT16_MAX);
2594 strecpy(_custom_currency.separator, str,
lastof(_custom_currency.separator));
2598 strecpy(_custom_currency.prefix, str,
lastof(_custom_currency.prefix));
2602 strecpy(_custom_currency.suffix, str,
lastof(_custom_currency.suffix));
2606 int val = atoi(str);
2622 static const NWidgetPart _nested_cust_currency_widgets[] = {
2658 SetDataTip(STR_CURRENCY_PREVIEW, STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP),
SetPadding(15, 1, 18, 2),
2666 _nested_cust_currency_widgets,
lengthof(_nested_cust_currency_widgets)