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;
 
  538         this->SetMediaSet<BaseGraphics>(index);
 
  542         this->SetMediaSet<BaseSounds>(index);
 
  546         this->SetMediaSet<BaseMusic>(index);
 
  558     if (!gui_scope) 
return;
 
  564     for (
TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
 
  575 static const NWidgetPart _nested_game_options_widgets[] = {
 
  590           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),
 
  620       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),
 
  633       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),
 
  646       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),
 
  660   _nested_game_options_widgets, 
lengthof(_nested_game_options_widgets)
 
  715   virtual void FoldAll() {}
 
  716   virtual void UnFoldAll() {}
 
  724   virtual uint Length() 
const = 0;
 
  725   virtual void GetFoldingState(
bool &all_folded, 
bool &all_unfolded)
 const {}
 
  728   virtual uint GetMaxHelpHeight(
int maxw) { 
return 0; }
 
  736   virtual bool UpdateFilterState(
SettingFilter &filter, 
bool force_visible) = 0;
 
  738   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;
 
  741   virtual void DrawSetting(
GameSettings *settings_ptr, 
int left, 
int right, 
int y, 
bool highlight) 
const = 0;
 
  753   virtual uint 
Length() 
const;
 
  779   typedef std::vector<BaseSettingEntry*> EntryVector;
 
  789   void Init(byte level = 0);
 
  801   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;
 
  815   virtual uint 
Length() 
const;
 
  816   virtual void GetFoldingState(
bool &all_folded, 
bool &all_unfolded) 
const;
 
  823   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;
 
  849   if (
this == item) 
return true;
 
  862   if (row_num == *cur_row) 
return this;
 
  899   if (cur_row >= max_row) 
return cur_row;
 
  902   int offset = rtl ? -4 : 4;
 
  903   int level_width = rtl ? -LEVEL_WIDTH : 
LEVEL_WIDTH;
 
  905   int x = rtl ? right : left;
 
  906   if (cur_row >= first_row) {
 
  908     y += (cur_row - first_row) * SETTING_HEIGHT; 
 
  911     for (uint lvl = 0; lvl < this->
level; lvl++) {
 
  912       if (!
HasBit(parent_last, lvl)) GfxDrawLine(x + offset, y, x + offset, y + SETTING_HEIGHT - 1, colour);
 
  916     int halfway_y = y + SETTING_HEIGHT / 2;
 
  918     GfxDrawLine(x + offset, y, x + offset, bottom_y, colour);
 
  920     GfxDrawLine(x + offset, halfway_y, x + level_width - offset, halfway_y, colour);
 
  923     this->DrawSetting(settings_ptr, rtl ? left : x, rtl ? x : right, y, 
this == selected);
 
  989   if (mode == 
RM_ALL) 
return true;
 
  998   const void *var = ResolveVariableAddress(settings_ptr, sd);
 
 1021   return current_value != filter_value;
 
 1034   bool visible = 
true;
 
 1088     SetDParam(first_param++, value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
 
 1114   const void *var = ResolveVariableAddress(settings_ptr, sd);
 
 1126   SetDParam(0, highlight ? STR_ORANGE_STRING1_WHITE : STR_ORANGE_STRING1_LTBLUE);
 
 1151   for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1159   for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1167   for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1179   for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1180     (*it)->GetFoldingState(all_folded, all_unfolded);
 
 1192   bool visible = 
false;
 
 1193   bool first_visible = 
true;
 
 1194   for (EntryVector::reverse_iterator it = this->
entries.rbegin(); it != this->
entries.rend(); ++it) {
 
 1195     visible |= (*it)->UpdateFilterState(filter, force_visible);
 
 1196     (*it)->SetLastField(first_visible);
 
 1197     if (visible && first_visible) first_visible = 
false;
 
 1211   for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1212     if ((*it)->IsVisible(item)) 
return true;
 
 1221   for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1222     length += (*it)->Length();
 
 1236   for (EntryVector::iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1237     pe = (*it)->
FindEntry(row_num, cur_row);
 
 1253   for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1254     biggest = 
max(biggest, (*it)->GetMaxHelpHeight(maxw));
 
 1276   for (EntryVector::const_iterator it = this->
entries.begin(); it != this->
entries.end(); ++it) {
 
 1277     cur_row = (*it)->Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
 
 1278     if (cur_row >= max_row) {
 
 1293   this->title = 
title;
 
 1335     all_unfolded = 
false;
 
 1375   if (
this == item) 
return true;
 
 1376   if (this->
folded) 
return false;
 
 1385   if (this->
folded) 
return 1; 
 
 1399   if (row_num == *cur_row) 
return this;
 
 1401   if (this->
folded) 
return NULL;
 
 1423   if (cur_row >= max_row) 
return cur_row;
 
 1425   cur_row = 
BaseSettingEntry::Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
 
 1429       assert(this->
level < 8 * 
sizeof(parent_last));
 
 1433     cur_row = 
SettingsContainer::Draw(settings_ptr, left, right, y, first_row, max_row, selected, cur_row, parent_last);
 
 1450   DrawSprite((this->
folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? right - _circle_size.width : left, y + (SETTING_HEIGHT - _circle_size.height) / 2);
 
 1451   DrawString(rtl ? left : left + _circle_size.width + 2, rtl ? right - _circle_size.width - 2 : right, y + (SETTING_HEIGHT - 
FONT_HEIGHT_NORMAL) / 2, this->title);
 
 1466       localisation->Add(
new SettingEntry(
"locale.units_velocity"));
 
 1467       localisation->Add(
new SettingEntry(
"locale.units_power"));
 
 1468       localisation->Add(
new SettingEntry(
"locale.units_weight"));
 
 1469       localisation->Add(
new SettingEntry(
"locale.units_volume"));
 
 1470       localisation->Add(
new SettingEntry(
"locale.units_force"));
 
 1471       localisation->Add(
new SettingEntry(
"locale.units_height"));
 
 1472       localisation->Add(
new SettingEntry(
"gui.date_format_in_default_names"));
 
 1479       graphics->Add(
new SettingEntry(
"gui.smallmap_land_colour"));
 
 1480       graphics->Add(
new SettingEntry(
"gui.graph_line_thickness"));
 
 1495     SettingsPage *
interface = main->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE));
 
 1497       SettingsPage *general = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_GENERAL));
 
 1502         general->Add(
new SettingEntry(
"gui.window_snap_radius"));
 
 1503         general->Add(
new SettingEntry(
"gui.window_soft_limit"));
 
 1506       SettingsPage *viewports = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_VIEWPORTS));
 
 1508         viewports->Add(
new SettingEntry(
"gui.auto_scrolling"));
 
 1509         viewports->Add(
new SettingEntry(
"gui.reverse_scroll"));
 
 1511         viewports->Add(
new SettingEntry(
"gui.left_mouse_btn_scrolling"));
 
 1515         viewports->Add(
new SettingEntry(
"gui.scrollwheel_scrolling"));
 
 1516         viewports->Add(
new SettingEntry(
"gui.scrollwheel_multiplier"));
 
 1519         viewports->Add(
new SettingEntry(
"gui.right_mouse_btn_emulation"));
 
 1521         viewports->Add(
new SettingEntry(
"gui.population_in_label"));
 
 1523         viewports->Add(
new SettingEntry(
"construction.train_signal_side"));
 
 1524         viewports->Add(
new SettingEntry(
"gui.measure_tooltip"));
 
 1525         viewports->Add(
new SettingEntry(
"gui.loading_indicators"));
 
 1526         viewports->Add(
new SettingEntry(
"gui.show_track_reservation"));
 
 1529       SettingsPage *construction = interface->Add(
new SettingsPage(STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION));
 
 1531         construction->Add(
new SettingEntry(
"gui.link_terraform_toolbar"));
 
 1532         construction->Add(
new SettingEntry(
"gui.enable_signal_gui"));
 
 1533         construction->Add(
new SettingEntry(
"gui.persistent_buildingtools"));
 
 1535         construction->Add(
new SettingEntry(
"gui.default_rail_type"));
 
 1536         construction->Add(
new SettingEntry(
"gui.disable_unsuitable_building"));
 
 1542       interface->Add(
new SettingEntry(
"gui.prefer_teamchat"));
 
 1543       interface->Add(
new SettingEntry(
"gui.advanced_vehicle_list"));
 
 1544       interface->Add(
new SettingEntry(
"gui.timetable_in_ticks"));
 
 1545       interface->Add(
new SettingEntry(
"gui.timetable_arrival_departure"));
 
 1546       interface->Add(
new SettingEntry(
"gui.expenses_layout"));
 
 1549     SettingsPage *advisors = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ADVISORS));
 
 1551       advisors->Add(
new SettingEntry(
"gui.coloured_news_year"));
 
 1552       advisors->Add(
new SettingEntry(
"news_display.general"));
 
 1553       advisors->Add(
new SettingEntry(
"news_display.new_vehicles"));
 
 1554       advisors->Add(
new SettingEntry(
"news_display.accident"));
 
 1555       advisors->Add(
new SettingEntry(
"news_display.company_info"));
 
 1556       advisors->Add(
new SettingEntry(
"news_display.acceptance"));
 
 1557       advisors->Add(
new SettingEntry(
"news_display.arrival_player"));
 
 1558       advisors->Add(
new SettingEntry(
"news_display.arrival_other"));
 
 1559       advisors->Add(
new SettingEntry(
"news_display.advice"));
 
 1560       advisors->Add(
new SettingEntry(
"gui.order_review_system"));
 
 1561       advisors->Add(
new SettingEntry(
"gui.vehicle_income_warn"));
 
 1562       advisors->Add(
new SettingEntry(
"gui.lost_vehicle_warn"));
 
 1564       advisors->Add(
new SettingEntry(
"news_display.economy"));
 
 1565       advisors->Add(
new SettingEntry(
"news_display.subsidies"));
 
 1568       advisors->Add(
new SettingEntry(
"news_display.production_player"));
 
 1569       advisors->Add(
new SettingEntry(
"news_display.production_other"));
 
 1570       advisors->Add(
new SettingEntry(
"news_display.production_nobody"));
 
 1573     SettingsPage *company = main->Add(
new SettingsPage(STR_CONFIG_SETTING_COMPANY));
 
 1575       company->Add(
new SettingEntry(
"gui.semaphore_build_before"));
 
 1576       company->Add(
new SettingEntry(
"gui.default_signal_type"));
 
 1577       company->Add(
new SettingEntry(
"gui.cycle_signal_types"));
 
 1578       company->Add(
new SettingEntry(
"gui.drag_signals_fixed_distance"));
 
 1581       company->Add(
new SettingEntry(
"company.engine_renew"));
 
 1582       company->Add(
new SettingEntry(
"company.engine_renew_months"));
 
 1583       company->Add(
new SettingEntry(
"company.engine_renew_money"));
 
 1584       company->Add(
new SettingEntry(
"vehicle.servint_ispercent"));
 
 1585       company->Add(
new SettingEntry(
"vehicle.servint_trains"));
 
 1586       company->Add(
new SettingEntry(
"vehicle.servint_roadveh"));
 
 1587       company->Add(
new SettingEntry(
"vehicle.servint_ships"));
 
 1588       company->Add(
new SettingEntry(
"vehicle.servint_aircraft"));
 
 1591     SettingsPage *accounting = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
 
 1593       accounting->Add(
new SettingEntry(
"economy.inflation"));
 
 1594       accounting->Add(
new SettingEntry(
"difficulty.initial_interest"));
 
 1595       accounting->Add(
new SettingEntry(
"difficulty.max_loan"));
 
 1596       accounting->Add(
new SettingEntry(
"difficulty.subsidy_multiplier"));
 
 1597       accounting->Add(
new SettingEntry(
"economy.feeder_payment_share"));
 
 1598       accounting->Add(
new SettingEntry(
"economy.infrastructure_maintenance"));
 
 1599       accounting->Add(
new SettingEntry(
"difficulty.vehicle_costs"));
 
 1600       accounting->Add(
new SettingEntry(
"difficulty.construction_cost"));
 
 1603     SettingsPage *vehicles = main->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES));
 
 1605       SettingsPage *physics = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_PHYSICS));
 
 1607         physics->Add(
new SettingEntry(
"vehicle.train_acceleration_model"));
 
 1608         physics->Add(
new SettingEntry(
"vehicle.train_slope_steepness"));
 
 1609         physics->Add(
new SettingEntry(
"vehicle.wagon_speed_limits"));
 
 1610         physics->Add(
new SettingEntry(
"vehicle.freight_trains"));
 
 1611         physics->Add(
new SettingEntry(
"vehicle.roadveh_acceleration_model"));
 
 1612         physics->Add(
new SettingEntry(
"vehicle.roadveh_slope_steepness"));
 
 1613         physics->Add(
new SettingEntry(
"vehicle.smoke_amount"));
 
 1617       SettingsPage *routing = vehicles->Add(
new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
 
 1619         routing->Add(
new SettingEntry(
"pf.pathfinder_for_trains"));
 
 1620         routing->Add(
new SettingEntry(
"difficulty.line_reverse_mode"));
 
 1621         routing->Add(
new SettingEntry(
"pf.reverse_at_signals"));
 
 1623         routing->Add(
new SettingEntry(
"pf.pathfinder_for_roadvehs"));
 
 1624         routing->Add(
new SettingEntry(
"pf.pathfinder_for_ships"));
 
 1627       vehicles->Add(
new SettingEntry(
"order.no_servicing_if_no_breakdowns"));
 
 1628       vehicles->Add(
new SettingEntry(
"order.serviceathelipad"));
 
 1631     SettingsPage *limitations = main->Add(
new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
 
 1633       limitations->Add(
new SettingEntry(
"construction.command_pause_level"));
 
 1634       limitations->Add(
new SettingEntry(
"construction.autoslope"));
 
 1635       limitations->Add(
new SettingEntry(
"construction.extra_dynamite"));
 
 1636       limitations->Add(
new SettingEntry(
"construction.max_heightlevel"));
 
 1637       limitations->Add(
new SettingEntry(
"construction.max_bridge_length"));
 
 1638       limitations->Add(
new SettingEntry(
"construction.max_bridge_height"));
 
 1639       limitations->Add(
new SettingEntry(
"construction.max_tunnel_length"));
 
 1640       limitations->Add(
new SettingEntry(
"station.never_expire_airports"));
 
 1641       limitations->Add(
new SettingEntry(
"vehicle.never_expire_vehicles"));
 
 1642       limitations->Add(
new SettingEntry(
"vehicle.max_trains"));
 
 1643       limitations->Add(
new SettingEntry(
"vehicle.max_roadveh"));
 
 1644       limitations->Add(
new SettingEntry(
"vehicle.max_aircraft"));
 
 1645       limitations->Add(
new SettingEntry(
"vehicle.max_ships"));
 
 1646       limitations->Add(
new SettingEntry(
"vehicle.max_train_length"));
 
 1647       limitations->Add(
new SettingEntry(
"station.station_spread"));
 
 1648       limitations->Add(
new SettingEntry(
"station.distant_join_stations"));
 
 1649       limitations->Add(
new SettingEntry(
"construction.road_stop_on_town_road"));
 
 1650       limitations->Add(
new SettingEntry(
"construction.road_stop_on_competitor_road"));
 
 1651       limitations->Add(
new SettingEntry(
"vehicle.disable_elrails"));
 
 1654     SettingsPage *disasters = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ACCIDENTS));
 
 1656       disasters->Add(
new SettingEntry(
"difficulty.disasters"));
 
 1657       disasters->Add(
new SettingEntry(
"difficulty.economy"));
 
 1658       disasters->Add(
new SettingEntry(
"difficulty.vehicle_breakdowns"));
 
 1659       disasters->Add(
new SettingEntry(
"vehicle.plane_crashes"));
 
 1662     SettingsPage *genworld = main->Add(
new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
 
 1664       genworld->Add(
new SettingEntry(
"game_creation.landscape"));
 
 1665       genworld->Add(
new SettingEntry(
"game_creation.land_generator"));
 
 1666       genworld->Add(
new SettingEntry(
"difficulty.terrain_type"));
 
 1667       genworld->Add(
new SettingEntry(
"game_creation.tgen_smoothness"));
 
 1668       genworld->Add(
new SettingEntry(
"game_creation.variety"));
 
 1669       genworld->Add(
new SettingEntry(
"game_creation.snow_line_height"));
 
 1670       genworld->Add(
new SettingEntry(
"game_creation.amount_of_rivers"));
 
 1671       genworld->Add(
new SettingEntry(
"game_creation.tree_placer"));
 
 1673       genworld->Add(
new SettingEntry(
"economy.larger_towns"));
 
 1674       genworld->Add(
new SettingEntry(
"economy.initial_city_size"));
 
 1675       genworld->Add(
new SettingEntry(
"economy.town_layout"));
 
 1676       genworld->Add(
new SettingEntry(
"difficulty.industry_density"));
 
 1677       genworld->Add(
new SettingEntry(
"gui.pause_on_newgame"));
 
 1680     SettingsPage *environment = main->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT));
 
 1682       SettingsPage *authorities = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES));
 
 1684         authorities->Add(
new SettingEntry(
"difficulty.town_council_tolerance"));
 
 1686         authorities->Add(
new SettingEntry(
"economy.exclusive_rights"));
 
 1687         authorities->Add(
new SettingEntry(
"economy.fund_roads"));
 
 1688         authorities->Add(
new SettingEntry(
"economy.fund_buildings"));
 
 1689         authorities->Add(
new SettingEntry(
"economy.station_noise_level"));
 
 1692       SettingsPage *towns = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_TOWNS));
 
 1694         towns->Add(
new SettingEntry(
"economy.town_growth_rate"));
 
 1695         towns->Add(
new SettingEntry(
"economy.allow_town_roads"));
 
 1696         towns->Add(
new SettingEntry(
"economy.allow_town_level_crossings"));
 
 1700       SettingsPage *industries = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));
 
 1702         industries->Add(
new SettingEntry(
"construction.raw_industry_construction"));
 
 1703         industries->Add(
new SettingEntry(
"construction.industry_platform"));
 
 1704         industries->Add(
new SettingEntry(
"economy.multiple_industry_per_town"));
 
 1705         industries->Add(
new SettingEntry(
"game_creation.oil_refinery_limit"));
 
 1706         industries->Add(
new SettingEntry(
"economy.smooth_economy"));
 
 1709       SettingsPage *cdist = environment->Add(
new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST));
 
 1712         cdist->Add(
new SettingEntry(
"linkgraph.recalc_interval"));
 
 1713         cdist->Add(
new SettingEntry(
"linkgraph.distribution_pax"));
 
 1714         cdist->Add(
new SettingEntry(
"linkgraph.distribution_mail"));
 
 1715         cdist->Add(
new SettingEntry(
"linkgraph.distribution_armoured"));
 
 1716         cdist->Add(
new SettingEntry(
"linkgraph.distribution_default"));
 
 1718         cdist->Add(
new SettingEntry(
"linkgraph.demand_distance"));
 
 1720         cdist->Add(
new SettingEntry(
"linkgraph.short_path_saturation"));
 
 1723       environment->Add(
new SettingEntry(
"station.modified_catchment"));
 
 1724       environment->Add(
new SettingEntry(
"construction.extra_tree_placement"));
 
 1727     SettingsPage *ai = main->Add(
new SettingsPage(STR_CONFIG_SETTING_AI));
 
 1729       SettingsPage *npc = ai->Add(
new SettingsPage(STR_CONFIG_SETTING_AI_NPC));
 
 1732         npc->Add(
new SettingEntry(
"script.script_max_opcode_till_suspend"));
 
 1733         npc->Add(
new SettingEntry(
"difficulty.competitor_speed"));
 
 1736         npc->Add(
new SettingEntry(
"ai.ai_disable_veh_roadveh"));
 
 1737         npc->Add(
new SettingEntry(
"ai.ai_disable_veh_aircraft"));
 
 1750 static const StringID _game_settings_restrict_dropdown[] = {
 
 1751   STR_CONFIG_SETTING_RESTRICT_BASIC,                            
 
 1752   STR_CONFIG_SETTING_RESTRICT_ADVANCED,                         
 
 1753   STR_CONFIG_SETTING_RESTRICT_ALL,                              
 
 1754   STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_DEFAULT,          
 
 1755   STR_CONFIG_SETTING_RESTRICT_CHANGED_AGAINST_NEW,              
 
 1757 assert_compile(
lengthof(_game_settings_restrict_dropdown) == 
RM_END);
 
 1795     this->filter.min_cat = 
RM_ALL;
 
 1796     this->filter.type = 
ST_ALL;
 
 1797     this->filter.type_hides = 
false;
 
 1832         static const StringID setting_types[] = {
 
 1833           STR_CONFIG_SETTING_TYPE_CLIENT,
 
 1834           STR_CONFIG_SETTING_TYPE_COMPANY_MENU, STR_CONFIG_SETTING_TYPE_COMPANY_INGAME,
 
 1835           STR_CONFIG_SETTING_TYPE_GAME_MENU, STR_CONFIG_SETTING_TYPE_GAME_INGAME,
 
 1837         for (uint i = 0; i < 
lengthof(setting_types); i++) {
 
 1869     if (this->warn_missing == 
WHR_NONE) {
 
 1883     if (this->warn_missing != 
WHR_NONE) {
 
 1885       const int right = left + panel->
current_x - 1;
 
 1906           case ST_GAME:    
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME); 
break;
 
 1907           case ST_COMPANY: 
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME); 
break;
 
 1909           default:         
SetDParam(0, STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL); 
break;
 
 1922         for (
int mode = 0; mode != 
RM_END; mode++) {
 
 1934         *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);
 
 1935         *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);
 
 1949             this->vscroll->GetPosition(), last_row, this->
last_clicked);
 
 1960             case ST_COMPANY: 
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME); 
break;
 
 1962             case ST_GAME:    
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME); 
break;
 
 1963             default: NOT_REACHED();
 
 1965           DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE);
 
 1970           DrawString(r.left, r.right, y, STR_CONFIG_SETTING_DEFAULT_VALUE);
 
 1973           DrawStringMultiLine(r.left, r.right, y, r.bottom, this->last_clicked->GetHelpText(), TC_WHITE);
 
 2027     if (btn == INT_MAX || (
int)btn < this->
warn_lines) 
return;
 
 2033     if (clicked_entry == NULL) 
return;  
 
 2039     if (clicked_page != NULL) {
 
 2059     const void *var = ResolveVariableAddress(settings_ptr, sd);
 
 2087         if (pt.y >= wi_rect.top && pt.y <= wi_rect.bottom) {
 
 2092           for (
int i = sdb->
min; i <= (
int)sdb->
max; i++) {
 
 2103       int32 oldvalue = value;
 
 2114           if (step == 0) step = 1;
 
 2126               assert((int32)sdb->
max >= 0);
 
 2127               if (value > (int32)sdb->
max) value = (int32)sdb->
max;
 
 2129               if ((uint32)value > sdb->
max) value = (int32)sdb->
max;
 
 2131             if (value < sdb->
min) value = sdb->
min; 
 
 2138           if (value != oldvalue) {
 
 2139             if (this->clicked_entry != NULL) { 
 
 2140               this->clicked_entry->SetButtons(0);
 
 2142             this->clicked_entry = pe;
 
 2150         default: NOT_REACHED();
 
 2153       if (value != oldvalue) {
 
 2187     if (str == NULL) 
return;
 
 2199       value = (int32)(
size_t)sd->
desc.
def;
 
 2275     if (!gui_scope) 
return;
 
 2279     this->filter.min_cat = min_level;
 
 2280     this->filter.type_hides = 
false;
 
 2296     bool all_folded = 
true;
 
 2297     bool all_unfolded = 
true;
 
 2324 static const NWidgetPart _nested_settings_selection_widgets[] = {
 
 2334         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),
 
 2338         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),
 
 2345           SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
 
 2369   _nested_settings_selection_widgets, 
lengthof(_nested_settings_selection_widgets)
 
 2389 void DrawArrowButtons(
int x, 
int y, Colours button_colour, byte state, 
bool clickable_left, 
bool clickable_right)
 
 2392   Dimension dim = NWidgetScrollbar::GetHorizontalDimension();
 
 2394   DrawFrameRect(x,             y, x + dim.width - 1,             y + dim.height - 1, button_colour, (state == 1) ? 
FR_LOWERED : FR_NONE);
 
 2395   DrawFrameRect(x + dim.width, y, x + dim.width + dim.width - 1, y + dim.height - 1, button_colour, (state == 2) ? 
FR_LOWERED : FR_NONE);
 
 2401   if (rtl ? !clickable_right : !clickable_left) {
 
 2404   if (rtl ? !clickable_left : !clickable_right) {
 
 2438   static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}};
 
 2452   void SetButtonState()
 
 2468         SetDParam(0, (_custom_currency.to_euro != 
CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER);
 
 2506         if (_custom_currency.rate > 1) _custom_currency.rate--;
 
 2512         if (_custom_currency.rate < UINT16_MAX) _custom_currency.rate++;
 
 2528         str = STR_JUST_RAW_STRING;
 
 2536         str = STR_JUST_RAW_STRING;
 
 2544         str = STR_JUST_RAW_STRING;
 
 2550         _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ? 
CF_NOEURO : _custom_currency.to_euro - 1;
 
 2556         _custom_currency.to_euro = 
Clamp(_custom_currency.to_euro + 1, 2000, 
MAX_YEAR);
 
 2571       this->query_widget = line;
 
 2572       ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 
this, afilter, QSF_NONE);
 
 2581     if (str == NULL) 
return;
 
 2583     switch (this->query_widget) {
 
 2585         _custom_currency.rate = 
Clamp(atoi(str), 1, UINT16_MAX);
 
 2589         strecpy(_custom_currency.separator, str, 
lastof(_custom_currency.separator));
 
 2593         strecpy(_custom_currency.prefix, str, 
lastof(_custom_currency.prefix));
 
 2597         strecpy(_custom_currency.suffix, str, 
lastof(_custom_currency.suffix));
 
 2601         int val = atoi(str);
 
 2617 static const NWidgetPart _nested_cust_currency_widgets[] = {
 
 2653                 SetDataTip(STR_CURRENCY_PREVIEW, STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP), 
SetPadding(15, 1, 18, 2),
 
 2661   _nested_cust_currency_widgets, 
lengthof(_nested_cust_currency_widgets)