45 static const StringID _driveside_dropdown[] = {
46 STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT,
47 STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT,
51 static const StringID _autosave_dropdown[] = {
52 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF,
53 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH,
54 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_3_MONTHS,
55 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_6_MONTHS,
56 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_12_MONTHS,
60 static const StringID _gui_zoom_dropdown[] = {
61 STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_NORMAL,
62 STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_2X_ZOOM,
63 STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_4X_ZOOM,
91 if (town_name <
_nb_orig_names)
return STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + town_name;
117 static DropDownList *BuiltSetDropDownList(
int *selected_index)
119 int n = T::GetNumSets();
120 *selected_index = T::GetIndexOfUsedSet();
123 for (
int i = 0; i < n; i++) {
131 template <
class TBaseSet>
138 const char *textfile = this->baseset->GetTextfile(file_type);
157 template <
class TBaseSet>
171 this->reload =
false;
215 const StringID *items = _driveside_dropdown;
235 int enabled_item = (_game_mode == GM_MENU ||
Town::GetNumItems() == 0) ? -1 : *selected_index;
244 int newgrf_size = list->
Length();
246 if (newgrf_size > 0) {
253 *list->
Append() =
new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, enabled_item != i && enabled_item >= 0);
262 const StringID *items = _autosave_dropdown;
292 const StringID *items = _gui_zoom_dropdown;
300 list = BuiltSetDropDownList<BaseGraphics>(selected_index);
304 list = BuiltSetDropDownList<BaseSounds>(selected_index);
308 list = BuiltSetDropDownList<BaseMusic>(selected_index);
363 size->height =
max(size->height, (uint)
GetStringHeight(STR_BLACK_RAW_STRING, size->width));
369 for (
int i = 0; i < BaseGraphics::GetNumSets(); i++) {
371 if (invalid_files == 0)
continue;
382 size->height =
max(size->height, (uint)
GetStringHeight(STR_BLACK_RAW_STRING, size->width));
390 size->height =
max(size->height, (uint)
GetStringHeight(STR_BLACK_RAW_STRING, size->width));
396 for (
int i = 0; i < BaseMusic::GetNumSets(); i++) {
398 if (invalid_files == 0)
continue;
412 int width = (*it)->Width();
413 string_dim.width = width + padding.width;
414 string_dim.height = (*it)->Height(width) + padding.height;
415 *size =
maxdim(*size, string_dim);
446 if (!ToggleFullScreen(!_fullscreen)) {
474 if (_game_mode == GM_MENU) {
475 const char *name = T::GetSet(index)->name;
539 this->SetMediaSet<BaseGraphics>(index);
543 this->SetMediaSet<BaseSounds>(index);
547 this->SetMediaSet<BaseMusic>(index);
559 if (!gui_scope)
return;
565 for (
TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
576 static const NWidgetPart _nested_game_options_widgets[] = {
591 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),
621 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),
634 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),
647 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),
661 _nested_game_options_widgets,
lengthof(_nested_game_options_widgets)
716 virtual void FoldAll() {}
717 virtual void UnFoldAll() {}
725 virtual uint Length()
const = 0;
726 virtual void GetFoldingState(
bool &all_folded,
bool &all_unfolded)
const {}
729 virtual uint GetMaxHelpHeight(
int maxw) {
return 0; }
737 virtual bool UpdateFilterState(
SettingFilter &filter,
bool force_visible) = 0;
739 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;
742 virtual void DrawSetting(
GameSettings *settings_ptr,
int left,
int right,
int y,
bool highlight)
const = 0;
754 virtual uint
Length()
const;
780 typedef std::vector<BaseSettingEntry*> EntryVector;
790 void Init(byte level = 0);
802 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;
816 virtual uint
Length()
const;
817 virtual void GetFoldingState(
bool &all_folded,
bool &all_unfolded)
const;
824 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;
850 if (
this == item)
return true;
863 if (row_num == *cur_row)
return this;
900 if (cur_row >= max_row)
return cur_row;
903 int offset = rtl ? -4 : 4;
904 int level_width = rtl ? -LEVEL_WIDTH :
LEVEL_WIDTH;
906 int x = rtl ? right : left;
907 if (cur_row >= first_row) {
909 y += (cur_row - first_row) * SETTING_HEIGHT;
912 for (uint lvl = 0; lvl < this->
level; lvl++) {
913 if (!
HasBit(parent_last, lvl)) GfxDrawLine(x + offset, y, x + offset, y + SETTING_HEIGHT - 1, colour);
917 int halfway_y = y + SETTING_HEIGHT / 2;
919 GfxDrawLine(x + offset, y, x + offset, bottom_y, colour);
921 GfxDrawLine(x + offset, halfway_y, x + level_width - offset, halfway_y, colour);
924 this->DrawSetting(settings_ptr, rtl ? left : x, rtl ? x : right, y,
this == selected);
990 if (mode ==
RM_ALL)
return true;
999 const void *var = ResolveVariableAddress(settings_ptr, sd);
1022 return current_value != filter_value;
1035 bool visible =
true;
1089 SetDParam(first_param++, value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
1115 const void *var = ResolveVariableAddress(settings_ptr, sd);
1127 SetDParam(0, highlight ? STR_ORANGE_STRING1_WHITE : STR_ORANGE_STRING1_LTBLUE);
1152 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1160 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1168 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1180 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1181 (*it)->GetFoldingState(all_folded, all_unfolded);
1193 bool visible =
false;
1194 bool first_visible =
true;
1195 for (EntryVector::reverse_iterator it = this->
entries.rbegin(); it != this->
entries.rend(); ++it) {
1196 visible |= (*it)->UpdateFilterState(filter, force_visible);
1197 (*it)->SetLastField(first_visible);
1198 if (visible && first_visible) first_visible =
false;
1212 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1213 if ((*it)->IsVisible(item))
return true;
1222 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1223 length += (*it)->Length();
1237 for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1238 pe = (*it)->
FindEntry(row_num, cur_row);
1254 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1255 biggest =
max(biggest, (*it)->GetMaxHelpHeight(maxw));
1277 for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
1278 cur_row = (*it)->Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
1279 if (cur_row >= max_row) {
1294 this->title =
title;
1336 all_unfolded =
false;
1376 if (
this == item)
return true;
1377 if (this->
folded)
return false;
1386 if (this->
folded)
return 1;
1400 if (row_num == *cur_row)
return this;
1402 if (this->
folded)
return NULL;
1424 if (cur_row >= max_row)
return cur_row;
1426 cur_row =
BaseSettingEntry::Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
1430 assert(this->
level < 8 *
sizeof(parent_last));
1434 cur_row =
SettingsContainer::Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
1451 DrawSprite((this->
folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? right - _circle_size.width : left, y + (SETTING_HEIGHT - _circle_size.height) / 2);
1452 DrawString(rtl ? left : left + _circle_size.width + 2, rtl ? right - _circle_size.width - 2 : right, y + (SETTING_HEIGHT -
FONT_HEIGHT_NORMAL) / 2, this->title);
1467 localisation->Add(
new SettingEntry(
"locale.units_velocity"));
1468 localisation->Add(
new SettingEntry(
"locale.units_power"));
1469 localisation->Add(
new SettingEntry(
"locale.units_weight"));
1470 localisation->Add(
new SettingEntry(
"locale.units_volume"));
1471 localisation->Add(
new SettingEntry(
"locale.units_force"));
1472 localisation->Add(
new SettingEntry(
"locale.units_height"));
1473 localisation->Add(
new SettingEntry(
"gui.date_format_in_default_names"));
1480 graphics->Add(
new SettingEntry(
"gui.smallmap_land_colour"));
1481 graphics->Add(
new SettingEntry(
"gui.graph_line_thickness"));
1496 SettingsPage *
interface = main->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE));
1498 SettingsPage *general = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_GENERAL));
1503 general->Add(
new SettingEntry(
"gui.window_snap_radius"));
1504 general->Add(
new SettingEntry(
"gui.window_soft_limit"));
1507 SettingsPage *viewports = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_VIEWPORTS));
1509 viewports->Add(
new SettingEntry(
"gui.auto_scrolling"));
1510 viewports->Add(
new SettingEntry(
"gui.reverse_scroll"));
1512 viewports->Add(
new SettingEntry(
"gui.left_mouse_btn_scrolling"));
1516 viewports->Add(
new SettingEntry(
"gui.scrollwheel_scrolling"));
1517 viewports->Add(
new SettingEntry(
"gui.scrollwheel_multiplier"));
1520 viewports->Add(
new SettingEntry(
"gui.right_mouse_btn_emulation"));
1522 viewports->Add(
new SettingEntry(
"gui.population_in_label"));
1524 viewports->Add(
new SettingEntry(
"construction.train_signal_side"));
1525 viewports->Add(
new SettingEntry(
"gui.measure_tooltip"));
1526 viewports->Add(
new SettingEntry(
"gui.loading_indicators"));
1527 viewports->Add(
new SettingEntry(
"gui.show_track_reservation"));
1530 SettingsPage *construction = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION));
1532 construction->Add(
new SettingEntry(
"gui.link_terraform_toolbar"));
1533 construction->Add(
new SettingEntry(
"gui.enable_signal_gui"));
1534 construction->Add(
new SettingEntry(
"gui.persistent_buildingtools"));
1536 construction->Add(
new SettingEntry(
"gui.default_rail_type"));
1537 construction->Add(
new SettingEntry(
"gui.disable_unsuitable_building"));
1543 interface->Add(
new SettingEntry(
"gui.prefer_teamchat"));
1544 interface->Add(
new SettingEntry(
"gui.advanced_vehicle_list"));
1545 interface->Add(
new SettingEntry(
"gui.timetable_in_ticks"));
1546 interface->Add(
new SettingEntry(
"gui.timetable_arrival_departure"));
1547 interface->Add(
new SettingEntry(
"gui.expenses_layout"));
1550 SettingsPage *advisors = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ADVISORS));
1552 advisors->Add(
new SettingEntry(
"gui.coloured_news_year"));
1553 advisors->Add(
new SettingEntry(
"news_display.general"));
1554 advisors->Add(
new SettingEntry(
"news_display.new_vehicles"));
1555 advisors->Add(
new SettingEntry(
"news_display.accident"));
1556 advisors->Add(
new SettingEntry(
"news_display.company_info"));
1557 advisors->Add(
new SettingEntry(
"news_display.acceptance"));
1558 advisors->Add(
new SettingEntry(
"news_display.arrival_player"));
1559 advisors->Add(
new SettingEntry(
"news_display.arrival_other"));
1560 advisors->Add(
new SettingEntry(
"news_display.advice"));
1561 advisors->Add(
new SettingEntry(
"gui.order_review_system"));
1562 advisors->Add(
new SettingEntry(
"gui.vehicle_income_warn"));
1563 advisors->Add(
new SettingEntry(
"gui.lost_vehicle_warn"));
1565 advisors->Add(
new SettingEntry(
"news_display.economy"));
1566 advisors->Add(
new SettingEntry(
"news_display.subsidies"));
1569 advisors->Add(
new SettingEntry(
"news_display.production_player"));
1570 advisors->Add(
new SettingEntry(
"news_display.production_other"));
1571 advisors->Add(
new SettingEntry(
"news_display.production_nobody"));
1574 SettingsPage *company = main->Add(
new SettingsPage(STR_CONFIG_SETTING_COMPANY));
1576 company->Add(
new SettingEntry(
"gui.semaphore_build_before"));
1577 company->Add(
new SettingEntry(
"gui.default_signal_type"));
1578 company->Add(
new SettingEntry(
"gui.cycle_signal_types"));
1579 company->Add(
new SettingEntry(
"gui.drag_signals_fixed_distance"));
1582 company->Add(
new SettingEntry(
"company.engine_renew"));
1583 company->Add(
new SettingEntry(
"company.engine_renew_months"));
1584 company->Add(
new SettingEntry(
"company.engine_renew_money"));
1585 company->Add(
new SettingEntry(
"vehicle.servint_ispercent"));
1586 company->Add(
new SettingEntry(
"vehicle.servint_trains"));
1587 company->Add(
new SettingEntry(
"vehicle.servint_roadveh"));
1588 company->Add(
new SettingEntry(
"vehicle.servint_ships"));
1589 company->Add(
new SettingEntry(
"vehicle.servint_aircraft"));
1592 SettingsPage *accounting = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
1594 accounting->Add(
new SettingEntry(
"economy.inflation"));
1595 accounting->Add(
new SettingEntry(
"difficulty.initial_interest"));
1596 accounting->Add(
new SettingEntry(
"difficulty.max_loan"));
1597 accounting->Add(
new SettingEntry(
"difficulty.subsidy_multiplier"));
1598 accounting->Add(
new SettingEntry(
"economy.feeder_payment_share"));
1599 accounting->Add(
new SettingEntry(
"economy.infrastructure_maintenance"));
1600 accounting->Add(
new SettingEntry(
"difficulty.vehicle_costs"));
1601 accounting->Add(
new SettingEntry(
"difficulty.construction_cost"));
1604 SettingsPage *vehicles = main->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES));
1606 SettingsPage *physics = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_PHYSICS));
1608 physics->Add(
new SettingEntry(
"vehicle.train_acceleration_model"));
1609 physics->Add(
new SettingEntry(
"vehicle.train_slope_steepness"));
1610 physics->Add(
new SettingEntry(
"vehicle.wagon_speed_limits"));
1611 physics->Add(
new SettingEntry(
"vehicle.freight_trains"));
1612 physics->Add(
new SettingEntry(
"vehicle.roadveh_acceleration_model"));
1613 physics->Add(
new SettingEntry(
"vehicle.roadveh_slope_steepness"));
1614 physics->Add(
new SettingEntry(
"vehicle.smoke_amount"));
1618 SettingsPage *routing = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
1620 routing->Add(
new SettingEntry(
"pf.pathfinder_for_trains"));
1621 routing->Add(
new SettingEntry(
"difficulty.line_reverse_mode"));
1622 routing->Add(
new SettingEntry(
"pf.reverse_at_signals"));
1624 routing->Add(
new SettingEntry(
"pf.pathfinder_for_roadvehs"));
1625 routing->Add(
new SettingEntry(
"pf.pathfinder_for_ships"));
1628 vehicles->Add(
new SettingEntry(
"order.no_servicing_if_no_breakdowns"));
1629 vehicles->Add(
new SettingEntry(
"order.serviceathelipad"));
1632 SettingsPage *limitations = main->Add(
new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
1634 limitations->Add(
new SettingEntry(
"construction.command_pause_level"));
1635 limitations->Add(
new SettingEntry(
"construction.autoslope"));
1636 limitations->Add(
new SettingEntry(
"construction.extra_dynamite"));
1637 limitations->Add(
new SettingEntry(
"construction.max_heightlevel"));
1638 limitations->Add(
new SettingEntry(
"construction.max_bridge_length"));
1639 limitations->Add(
new SettingEntry(
"construction.max_bridge_height"));
1640 limitations->Add(
new SettingEntry(
"construction.max_tunnel_length"));
1641 limitations->Add(
new SettingEntry(
"station.never_expire_airports"));
1642 limitations->Add(
new SettingEntry(
"vehicle.never_expire_vehicles"));
1643 limitations->Add(
new SettingEntry(
"vehicle.max_trains"));
1644 limitations->Add(
new SettingEntry(
"vehicle.max_roadveh"));
1645 limitations->Add(
new SettingEntry(
"vehicle.max_aircraft"));
1646 limitations->Add(
new SettingEntry(
"vehicle.max_ships"));
1647 limitations->Add(
new SettingEntry(
"vehicle.max_train_length"));
1648 limitations->Add(
new SettingEntry(
"station.station_spread"));
1649 limitations->Add(
new SettingEntry(
"station.distant_join_stations"));
1650 limitations->Add(
new SettingEntry(
"construction.road_stop_on_town_road"));
1651 limitations->Add(
new SettingEntry(
"construction.road_stop_on_competitor_road"));
1652 limitations->Add(
new SettingEntry(
"vehicle.disable_elrails"));
1655 SettingsPage *disasters = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCIDENTS));
1657 disasters->Add(
new SettingEntry(
"difficulty.disasters"));
1658 disasters->Add(
new SettingEntry(
"difficulty.economy"));
1659 disasters->Add(
new SettingEntry(
"difficulty.vehicle_breakdowns"));
1660 disasters->Add(
new SettingEntry(
"vehicle.plane_crashes"));
1663 SettingsPage *genworld = main->Add(
new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
1665 genworld->Add(
new SettingEntry(
"game_creation.landscape"));
1666 genworld->Add(
new SettingEntry(
"game_creation.land_generator"));
1667 genworld->Add(
new SettingEntry(
"difficulty.terrain_type"));
1668 genworld->Add(
new SettingEntry(
"game_creation.tgen_smoothness"));
1669 genworld->Add(
new SettingEntry(
"game_creation.variety"));
1670 genworld->Add(
new SettingEntry(
"game_creation.snow_line_height"));
1671 genworld->Add(
new SettingEntry(
"game_creation.amount_of_rivers"));
1672 genworld->Add(
new SettingEntry(
"game_creation.tree_placer"));
1674 genworld->Add(
new SettingEntry(
"economy.larger_towns"));
1675 genworld->Add(
new SettingEntry(
"economy.initial_city_size"));
1676 genworld->Add(
new SettingEntry(
"economy.town_layout"));
1677 genworld->Add(
new SettingEntry(
"difficulty.industry_density"));
1678 genworld->Add(
new SettingEntry(
"gui.pause_on_newgame"));
1681 SettingsPage *environment = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT));
1683 SettingsPage *authorities = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES));
1685 authorities->Add(
new SettingEntry(
"difficulty.town_council_tolerance"));
1687 authorities->Add(
new SettingEntry(
"economy.exclusive_rights"));
1688 authorities->Add(
new SettingEntry(
"economy.fund_roads"));
1689 authorities->Add(
new SettingEntry(
"economy.fund_buildings"));
1690 authorities->Add(
new SettingEntry(
"economy.station_noise_level"));
1693 SettingsPage *towns = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_TOWNS));
1695 towns->Add(
new SettingEntry(
"economy.town_growth_rate"));
1696 towns->Add(
new SettingEntry(
"economy.allow_town_roads"));
1697 towns->Add(
new SettingEntry(
"economy.allow_town_level_crossings"));
1701 SettingsPage *industries = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));
1703 industries->Add(
new SettingEntry(
"construction.raw_industry_construction"));
1704 industries->Add(
new SettingEntry(
"construction.industry_platform"));
1705 industries->Add(
new SettingEntry(
"economy.multiple_industry_per_town"));
1706 industries->Add(
new SettingEntry(
"game_creation.oil_refinery_limit"));
1707 industries->Add(
new SettingEntry(
"economy.smooth_economy"));
1710 SettingsPage *cdist = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST));
1713 cdist->Add(
new SettingEntry(
"linkgraph.recalc_interval"));
1714 cdist->Add(
new SettingEntry(
"linkgraph.distribution_pax"));
1715 cdist->Add(
new SettingEntry(
"linkgraph.distribution_mail"));
1716 cdist->Add(
new SettingEntry(
"linkgraph.distribution_armoured"));
1717 cdist->Add(
new SettingEntry(
"linkgraph.distribution_default"));
1719 cdist->Add(
new SettingEntry(
"linkgraph.demand_distance"));
1721 cdist->Add(
new SettingEntry(
"linkgraph.short_path_saturation"));
1724 environment->Add(
new SettingEntry(
"station.modified_catchment"));
1725 environment->Add(
new SettingEntry(
"construction.extra_tree_placement"));
1728 SettingsPage *ai = main->Add(
new SettingsPage(STR_CONFIG_SETTING_AI));
1730 SettingsPage *npc = ai->Add(
new SettingsPage(STR_CONFIG_SETTING_AI_NPC));
1733 npc->Add(
new SettingEntry(
"script.script_max_opcode_till_suspend"));
1734 npc->Add(
new SettingEntry(
"difficulty.competitor_speed"));
1737 npc->Add(
new SettingEntry(
"ai.ai_disable_veh_roadveh"));
1738 npc->Add(
new SettingEntry(
"ai.ai_disable_veh_aircraft"));
1751 static const StringID _game_settings_restrict_dropdown[] = {
1752 STR_CONFIG_SETTING_RESTRICT_BASIC,
1753 STR_CONFIG_SETTING_RESTRICT_ADVANCED,
1754 STR_CONFIG_SETTING_RESTRICT_ALL,
1755 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_DEFAULT,
1756 STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_NEW,
1758 assert_compile(
lengthof(_game_settings_restrict_dropdown) ==
RM_END);
1796 this->filter.min_cat =
RM_ALL;
1797 this->filter.type =
ST_ALL;
1798 this->filter.type_hides =
false;
1833 static const StringID setting_types[] = {
1834 STR_CONFIG_SETTING_TYPE_CLIENT,
1835 STR_CONFIG_SETTING_TYPE_COMPANY_MENU, STR_CONFIG_SETTING_TYPE_COMPANY_INGAME,
1836 STR_CONFIG_SETTING_TYPE_GAME_MENU, STR_CONFIG_SETTING_TYPE_GAME_INGAME,
1838 for (uint i = 0; i <
lengthof(setting_types); i++) {
1870 if (this->warn_missing ==
WHR_NONE) {
1884 if (this->warn_missing !=
WHR_NONE) {
1886 const int right = left + panel->
current_x - 1;
1907 case ST_GAME:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME);
break;
1908 case ST_COMPANY:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME);
break;
1910 default:
SetDParam(0, STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL);
break;
1923 for (
int mode = 0; mode !=
RM_END; mode++) {
1935 *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);
1936 *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);
1950 this->vscroll->GetPosition(), last_row, this->
last_clicked);
1961 case ST_COMPANY:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME);
break;
1963 case ST_GAME:
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME);
break;
1964 default: NOT_REACHED();
1966 DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE);
1971 DrawString(r.left, r.right, y, STR_CONFIG_SETTING_DEFAULT_VALUE);
1974 DrawStringMultiLine(r.left, r.right, y, r.bottom, this->last_clicked->GetHelpText(), TC_WHITE);
2028 if (btn == INT_MAX || (
int)btn < this->
warn_lines)
return;
2034 if (clicked_entry == NULL)
return;
2040 if (clicked_page != NULL) {
2060 const void *var = ResolveVariableAddress(settings_ptr, sd);
2088 if (pt.y >= wi_rect.top && pt.y <= wi_rect.bottom) {
2093 for (
int i = sdb->
min; i <= (
int)sdb->
max; i++) {
2104 int32 oldvalue = value;
2115 if (step == 0) step = 1;
2127 assert((int32)sdb->
max >= 0);
2128 if (value > (int32)sdb->
max) value = (int32)sdb->
max;
2130 if ((uint32)value > sdb->
max) value = (int32)sdb->
max;
2132 if (value < sdb->
min) value = sdb->
min;
2139 if (value != oldvalue) {
2140 if (this->clicked_entry != NULL) {
2141 this->clicked_entry->SetButtons(0);
2143 this->clicked_entry = pe;
2151 default: NOT_REACHED();
2154 if (value != oldvalue) {
2188 if (str == NULL)
return;
2200 value = (int32)(
size_t)sd->
desc.
def;
2276 if (!gui_scope)
return;
2280 this->filter.min_cat = min_level;
2281 this->filter.type_hides =
false;
2297 bool all_folded =
true;
2298 bool all_unfolded =
true;
2325 static const NWidgetPart _nested_settings_selection_widgets[] = {
2335 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),
2339 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),
2346 SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
2370 _nested_settings_selection_widgets,
lengthof(_nested_settings_selection_widgets)
2390 void DrawArrowButtons(
int x,
int y, Colours button_colour, byte state,
bool clickable_left,
bool clickable_right)
2393 Dimension dim = NWidgetScrollbar::GetHorizontalDimension();
2395 DrawFrameRect(x, y, x + dim.width - 1, y + dim.height - 1, button_colour, (state == 1) ?
FR_LOWERED : FR_NONE);
2396 DrawFrameRect(x + dim.width, y, x + dim.width + dim.width - 1, y + dim.height - 1, button_colour, (state == 2) ?
FR_LOWERED : FR_NONE);
2402 if (rtl ? !clickable_right : !clickable_left) {
2405 if (rtl ? !clickable_left : !clickable_right) {
2439 static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}};
2453 void SetButtonState()
2469 SetDParam(0, (_custom_currency.to_euro !=
CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER);
2507 if (_custom_currency.rate > 1) _custom_currency.rate--;
2513 if (_custom_currency.rate < UINT16_MAX) _custom_currency.rate++;
2529 str = STR_JUST_RAW_STRING;
2537 str = STR_JUST_RAW_STRING;
2545 str = STR_JUST_RAW_STRING;
2551 _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ?
CF_NOEURO : _custom_currency.to_euro - 1;
2557 _custom_currency.to_euro =
Clamp(_custom_currency.to_euro + 1, 2000,
MAX_YEAR);
2572 this->query_widget = line;
2573 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1,
this, afilter, QSF_NONE);
2582 if (str == NULL)
return;
2584 switch (this->query_widget) {
2586 _custom_currency.rate =
Clamp(atoi(str), 1, UINT16_MAX);
2590 strecpy(_custom_currency.separator, str,
lastof(_custom_currency.separator));
2594 strecpy(_custom_currency.prefix, str,
lastof(_custom_currency.prefix));
2598 strecpy(_custom_currency.suffix, str,
lastof(_custom_currency.suffix));
2602 int val = atoi(str);
2618 static const NWidgetPart _nested_cust_currency_widgets[] = {
2654 SetDataTip(STR_CURRENCY_PREVIEW, STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP),
SetPadding(15, 1, 18, 2),
2662 _nested_cust_currency_widgets,
lengthof(_nested_cust_currency_widgets)