src/settings_gui.cpp
changeset 9354 845e07db4549
parent 9346 bfd803297888
child 9358 2e1e4d2f71dd
equal deleted inserted replaced
9353:9d76aef9fe2b 9354:845e07db4549
   665 	DeleteWindowById(WC_GAME_OPTIONS, 0);
   665 	DeleteWindowById(WC_GAME_OPTIONS, 0);
   666 	new GameDifficultyWindow();
   666 	new GameDifficultyWindow();
   667 }
   667 }
   668 
   668 
   669 static const char *_patches_ui[] = {
   669 static const char *_patches_ui[] = {
   670 	"vehicle_speed",
   670 	"gui.vehicle_speed",
   671 	"status_long_date",
   671 	"gui.status_long_date",
   672 	"show_finances",
   672 	"gui.show_finances",
   673 	"autoscroll",
   673 	"gui.autoscroll",
   674 	"reverse_scroll",
   674 	"gui.reverse_scroll",
   675 	"smooth_scroll",
   675 	"gui.smooth_scroll",
   676 	"errmsg_duration",
   676 	"gui.errmsg_duration",
   677 	"toolbar_pos",
   677 	"gui.toolbar_pos",
   678 	"measure_tooltip",
   678 	"gui.measure_tooltip",
   679 	"window_snap_radius",
   679 	"gui.window_snap_radius",
   680 	"population_in_label",
   680 	"gui.population_in_label",
   681 	"link_terraform_toolbar",
   681 	"gui.link_terraform_toolbar",
   682 	"liveries",
   682 	"gui.liveries",
   683 	"prefer_teamchat",
   683 	"gui.prefer_teamchat",
   684 	/* While the horizontal scrollwheel scrolling is written as general code, only
   684 	/* While the horizontal scrollwheel scrolling is written as general code, only
   685 	 *  the cocoa (OSX) driver generates input for it.
   685 	 *  the cocoa (OSX) driver generates input for it.
   686 	 *  Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */
   686 	 *  Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */
   687 	"scrollwheel_scrolling",
   687 	"gui.scrollwheel_scrolling",
   688 	"scrollwheel_multiplier",
   688 	"gui.scrollwheel_multiplier",
   689 #ifdef __APPLE__
   689 #ifdef __APPLE__
   690 	/* We might need to emulate a right mouse button on mac */
   690 	/* We might need to emulate a right mouse button on mac */
   691 	"right_mouse_btn_emulation",
   691 	"gui.right_mouse_btn_emulation",
   692 #endif
   692 #endif
   693 	"pause_on_newgame",
   693 	"gui.pause_on_newgame",
   694 	"advanced_vehicle_list",
   694 	"gui.advanced_vehicle_list",
   695 	"loading_indicators",
   695 	"gui.loading_indicators",
   696 	"timetable_in_ticks",
   696 	"gui.timetable_in_ticks",
   697 	"default_rail_type",
   697 	"gui.default_rail_type",
   698 	"always_build_infrastructure",
   698 	"gui.always_build_infrastructure",
   699 };
   699 };
   700 
   700 
   701 static const char *_patches_construction[] = {
   701 static const char *_patches_construction[] = {
   702 	"build_on_slopes",
   702 	"construction.build_on_slopes",
   703 	"autoslope",
   703 	"construction.autoslope",
   704 	"extra_dynamite",
   704 	"construction.extra_dynamite",
   705 	"longbridges",
   705 	"construction.longbridges",
   706 	"signal_side",
   706 	"construction.signal_side",
   707 	"always_small_airport",
   707 	"station.always_small_airport",
   708 	"enable_signal_gui",
   708 	"gui.enable_signal_gui",
   709 	"drag_signals_density",
   709 	"gui.drag_signals_density",
   710 	"oil_refinery_limit",
   710 	"game_creation.oil_refinery_limit",
   711 	"semaphore_build_before",
   711 	"gui.semaphore_build_before",
   712 };
   712 };
   713 
   713 
   714 static const char *_patches_stations[] = {
   714 static const char *_patches_stations[] = {
   715 	"join_stations",
   715 	"station.join_stations",
   716 	"improved_load",
   716 	"order.improved_load",
   717 	"selectgoods",
   717 	"order.selectgoods",
   718 	"new_nonstop",
   718 	"gui.new_nonstop",
   719 	"nonuniform_stations",
   719 	"station.nonuniform_stations",
   720 	"station_spread",
   720 	"station.station_spread",
   721 	"serviceathelipad",
   721 	"order.serviceathelipad",
   722 	"modified_catchment",
   722 	"station.modified_catchment",
   723 	"gradual_loading",
   723 	"order.gradual_loading",
   724 	"road_stop_on_town_road",
   724 	"construction.road_stop_on_town_road",
   725 	"adjacent_stations",
   725 	"station.adjacent_stations",
   726 	"station_noise_level",
   726 	"economy.station_noise_level",
   727 };
   727 };
   728 
   728 
   729 static const char *_patches_economy[] = {
   729 static const char *_patches_economy[] = {
   730 	"inflation",
   730 	"economy.inflation",
   731 	"raw_industry_construction",
   731 	"construction.raw_industry_construction",
   732 	"multiple_industry_per_town",
   732 	"economy.multiple_industry_per_town",
   733 	"same_industry_close",
   733 	"economy.same_industry_close",
   734 	"bribe",
   734 	"economy.bribe",
   735 	"exclusive_rights",
   735 	"economy.exclusive_rights",
   736 	"give_money",
   736 	"economy.give_money",
   737 	"colored_news_year",
   737 	"gui.colored_news_year",
   738 	"ending_year",
   738 	"gui.ending_year",
   739 	"smooth_economy",
   739 	"economy.smooth_economy",
   740 	"allow_shares",
   740 	"economy.allow_shares",
   741 	"town_layout",
   741 	"economy.town_layout",
   742 	"mod_road_rebuild",
   742 	"economy.mod_road_rebuild",
   743 	"town_growth_rate",
   743 	"economy.town_growth_rate",
   744 	"larger_towns",
   744 	"economy.larger_towns",
   745 	"initial_city_size",
   745 	"economy.initial_city_size",
   746 };
   746 };
   747 
   747 
   748 static const char *_patches_ai[] = {
   748 static const char *_patches_ai[] = {
   749 	"ainew_active",
   749 	"ai.ainew_active",
   750 	"ai_in_multiplayer",
   750 	"ai.ai_in_multiplayer",
   751 	"ai_disable_veh_train",
   751 	"ai.ai_disable_veh_train",
   752 	"ai_disable_veh_roadveh",
   752 	"ai.ai_disable_veh_roadveh",
   753 	"ai_disable_veh_aircraft",
   753 	"ai.ai_disable_veh_aircraft",
   754 	"ai_disable_veh_ship",
   754 	"ai.ai_disable_veh_ship",
   755 };
   755 };
   756 
   756 
   757 static const char *_patches_vehicles[] = {
   757 static const char *_patches_vehicles[] = {
   758 	"realistic_acceleration",
   758 	"vehicle.realistic_acceleration",
   759 	"forbid_90_deg",
   759 	"pf.forbid_90_deg",
   760 	"mammoth_trains",
   760 	"vehicle.mammoth_trains",
   761 	"gotodepot",
   761 	"order.gotodepot",
   762 	"roadveh_queue",
   762 	"pf.roadveh_queue",
   763 	"pathfinder_for_trains",
   763 	"pf.pathfinder_for_trains",
   764 	"pathfinder_for_roadvehs",
   764 	"pf.pathfinder_for_roadvehs",
   765 	"pathfinder_for_ships",
   765 	"pf.pathfinder_for_ships",
   766 	"train_income_warn",
   766 	"gui.train_income_warn",
   767 	"order_review_system",
   767 	"gui.order_review_system",
   768 	"never_expire_vehicles",
   768 	"vehicle.never_expire_vehicles",
   769 	"lost_train_warn",
   769 	"gui.lost_train_warn",
   770 	"autorenew",
   770 	"gui.autorenew",
   771 	"autorenew_months",
   771 	"gui.autorenew_months",
   772 	"autorenew_money",
   772 	"gui.autorenew_money",
   773 	"max_trains",
   773 	"vehicle.max_trains",
   774 	"max_roadveh",
   774 	"vehicle.max_roadveh",
   775 	"max_aircraft",
   775 	"vehicle.max_aircraft",
   776 	"max_ships",
   776 	"vehicle.max_ships",
   777 	"servint_ispercent",
   777 	"vehicle.servint_ispercent",
   778 	"servint_trains",
   778 	"vehicle.servint_trains",
   779 	"servint_roadveh",
   779 	"vehicle.servint_roadveh",
   780 	"servint_ships",
   780 	"vehicle.servint_ships",
   781 	"servint_aircraft",
   781 	"vehicle.servint_aircraft",
   782 	"no_servicing_if_no_breakdowns",
   782 	"order.no_servicing_if_no_breakdowns",
   783 	"wagon_speed_limits",
   783 	"vehicle.wagon_speed_limits",
   784 	"disable_elrails",
   784 	"vehicle.disable_elrails",
   785 	"freight_trains",
   785 	"vehicle.freight_trains",
   786 	"plane_speed",
   786 	"vehicle.plane_speed",
   787 	"timetabling",
   787 	"order.timetabling",
   788 	"dynamic_engines",
   788 	"vehicle.dynamic_engines",
   789 };
   789 };
   790 
   790 
   791 struct PatchEntry {
   791 struct PatchEntry {
   792 	const SettingDesc *setting;
   792 	const SettingDesc *setting;
   793 	uint index;
   793 	uint index;
   820 	PATCHSEL_ECONOMY,
   820 	PATCHSEL_ECONOMY,
   821 	PATCHSEL_COMPETITORS
   821 	PATCHSEL_COMPETITORS
   822 };
   822 };
   823 
   823 
   824 struct PatchesSelectionWindow : Window {
   824 struct PatchesSelectionWindow : Window {
   825 	static Patches *patches_ptr;
   825 	static Settings *patches_ptr;
   826 	static int patches_max;
   826 	static int patches_max;
   827 
   827 
   828 	int page;
   828 	int page;
   829 	int entry;
   829 	int entry;
   830 	int click;
   830 	int click;
   831 
   831 
   832 	PatchesSelectionWindow(const WindowDesc *desc) : Window(desc)
   832 	PatchesSelectionWindow(const WindowDesc *desc) : Window(desc)
   833 	{
   833 	{
   834 		static bool first_time = true;
   834 		static bool first_time = true;
   835 
   835 
   836 		patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches;
   836 		patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
   837 
   837 
   838 		/* Build up the dynamic settings-array only once per OpenTTD session */
   838 		/* Build up the dynamic settings-array only once per OpenTTD session */
   839 		if (first_time) {
   839 		if (first_time) {
   840 			PatchPage *page;
   840 			PatchPage *page;
   841 			for (page = &_patches_page[0]; page != endof(_patches_page); page++) {
   841 			for (page = &_patches_page[0]; page != endof(_patches_page); page++) {
  1043 			this->SetDirty();
  1043 			this->SetDirty();
  1044 		}
  1044 		}
  1045 	}
  1045 	}
  1046 };
  1046 };
  1047 
  1047 
  1048 Patches *PatchesSelectionWindow::patches_ptr = NULL;
  1048 Settings *PatchesSelectionWindow::patches_ptr = NULL;
  1049 int PatchesSelectionWindow::patches_max = 0;
  1049 int PatchesSelectionWindow::patches_max = 0;
  1050 
  1050 
  1051 static const Widget _patches_selection_widgets[] = {
  1051 static const Widget _patches_selection_widgets[] = {
  1052 {   WWT_CLOSEBOX,   RESIZE_NONE,    10,     0,    10,     0,    13, STR_00C5,                        STR_018B_CLOSE_WINDOW},
  1052 {   WWT_CLOSEBOX,   RESIZE_NONE,    10,     0,    10,     0,    13, STR_00C5,                        STR_018B_CLOSE_WINDOW},
  1053 {    WWT_CAPTION,   RESIZE_NONE,    10,    11,   369,     0,    13, STR_CONFIG_PATCHES_CAPTION,      STR_018C_WINDOW_TITLE_DRAG_THIS},
  1053 {    WWT_CAPTION,   RESIZE_NONE,    10,    11,   369,     0,    13, STR_CONFIG_PATCHES_CAPTION,      STR_018C_WINDOW_TITLE_DRAG_THIS},