Changeset - r19494:114d84fa2d8f
[Not reviewed]
master
0 2 0
frosch - 12 years ago 2012-07-17 20:18:18
frosch@openttd.org
(svn r24411) -Add [FS#5244-ish]: Display the a setting type in the adv. settings description which explains the scope of changes to a particular setting.
2 files changed with 30 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1012,192 +1012,198 @@ STR_DIFFICULTY_LEVEL_CAPTION            
 

	
 
############ range for difficulty levels starts
 
STR_DIFFICULTY_LEVEL_EASY                                       :{BLACK}Easy
 
STR_DIFFICULTY_LEVEL_MEDIUM                                     :{BLACK}Medium
 
STR_DIFFICULTY_LEVEL_HARD                                       :{BLACK}Hard
 
STR_DIFFICULTY_LEVEL_CUSTOM                                     :{BLACK}Custom
 
############ range for difficulty levels ends
 

	
 
STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON                          :{BLACK}Show hi-score chart
 
STR_DIFFICULTY_LEVEL_SAVE                                       :{BLACK}Save
 

	
 
############ range for difficulty settings starts
 
STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_NO_COMPETITORS             :{LTBLUE}Maximum no. competitors: {ORANGE}{COMMA}
 
STR_DIFFICULTY_LEVEL_SETTING_NO_OF_TOWNS                        :{LTBLUE}No. of towns: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_NO_OF_INDUSTRIES                   :{LTBLUE}No. of industries: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_INITIAL_LOAN_000           :{LTBLUE}Maximum initial loan: {ORANGE}{CURRENCY_LONG}
 
STR_DIFFICULTY_LEVEL_SETTING_INITIAL_INTEREST_RATE              :{LTBLUE}Initial interest rate: {ORANGE}{COMMA}%
 
STR_DIFFICULTY_LEVEL_SETTING_VEHICLE_RUNNING_COSTS              :{LTBLUE}Vehicle running costs: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_CONSTRUCTION_SPEED_OF_COMPETITOR   :{LTBLUE}Construction speed of competitors: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_VEHICLE_BREAKDOWNS                 :{LTBLUE}Vehicle breakdowns: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_SUBSIDY_MULTIPLIER                 :{LTBLUE}Subsidy multiplier: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_COST_OF_CONSTRUCTION               :{LTBLUE}Cost of construction: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_TERRAIN_TYPE                       :{LTBLUE}Terrain type: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_QUANTITY_OF_SEA_LAKES              :{LTBLUE}Quantity of sea/lakes: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_ECONOMY                            :{LTBLUE}Economy: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_TRAIN_REVERSING                    :{LTBLUE}Train reversing: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_DISASTERS                          :{LTBLUE}Disasters: {ORANGE}{STRING}
 
STR_DIFFICULTY_LEVEL_SETTING_CITY_APPROVAL                      :{LTBLUE}City council's attitude towards area restructuring: {ORANGE}{STRING}
 
############ range for difficulty settings ends
 

	
 
STR_NONE                                                        :None
 
STR_FUNDING_ONLY                                                :Funding only
 
STR_MINIMAL                                                     :Minimal
 
STR_NUM_VERY_LOW                                                :Very Low
 
STR_NUM_LOW                                                     :Low
 
STR_NUM_NORMAL                                                  :Normal
 
STR_NUM_HIGH                                                    :High
 
STR_NUM_CUSTOM                                                  :Custom
 
STR_NUM_CUSTOM_NUMBER                                           :Custom ({NUM})
 

	
 
STR_VARIETY_NONE                                                :None
 
STR_VARIETY_VERY_LOW                                            :Very Low
 
STR_VARIETY_LOW                                                 :Low
 
STR_VARIETY_MEDIUM                                              :Medium
 
STR_VARIETY_HIGH                                                :High
 
STR_VARIETY_VERY_HIGH                                           :Very High
 

	
 
STR_AI_SPEED_VERY_SLOW                                          :Very Slow
 
STR_AI_SPEED_SLOW                                               :Slow
 
STR_AI_SPEED_MEDIUM                                             :Medium
 
STR_AI_SPEED_FAST                                               :Fast
 
STR_AI_SPEED_VERY_FAST                                          :Very Fast
 

	
 
STR_SEA_LEVEL_VERY_LOW                                          :Very Low
 
STR_SEA_LEVEL_LOW                                               :Low
 
STR_SEA_LEVEL_MEDIUM                                            :Medium
 
STR_SEA_LEVEL_HIGH                                              :High
 
STR_SEA_LEVEL_CUSTOM                                            :Custom
 
STR_SEA_LEVEL_CUSTOM_PERCENTAGE                                 :Custom ({NUM}%)
 

	
 
STR_RIVERS_NONE                                                 :None
 
STR_RIVERS_FEW                                                  :Few
 
STR_RIVERS_MODERATE                                             :Medium
 
STR_RIVERS_LOT                                                  :Many
 

	
 
STR_DISASTER_NONE                                               :None
 
STR_DISASTER_REDUCED                                            :Reduced
 
STR_DISASTER_NORMAL                                             :Normal
 

	
 
STR_SUBSIDY_X1_5                                                :x1.5
 
STR_SUBSIDY_X2                                                  :x2
 
STR_SUBSIDY_X3                                                  :x3
 
STR_SUBSIDY_X4                                                  :x4
 

	
 
STR_TERRAIN_TYPE_VERY_FLAT                                      :Very Flat
 
STR_TERRAIN_TYPE_FLAT                                           :Flat
 
STR_TERRAIN_TYPE_HILLY                                          :Hilly
 
STR_TERRAIN_TYPE_MOUNTAINOUS                                    :Mountainous
 

	
 
STR_ECONOMY_STEADY                                              :Steady
 
STR_ECONOMY_FLUCTUATING                                         :Fluctuating
 

	
 
STR_REVERSE_AT_END_OF_LINE_AND_AT_STATIONS                      :At end of line, and at stations
 
STR_REVERSE_AT_END_OF_LINE_ONLY                                 :At end of line only
 

	
 
STR_CITY_APPROVAL_PERMISSIVE                                    :Permissive
 
STR_CITY_APPROVAL_TOLERANT                                      :Tolerant
 
STR_CITY_APPROVAL_HOSTILE                                       :Hostile
 

	
 
STR_WARNING_NO_SUITABLE_AI                                      :{WHITE}No suitable AIs available...{}You can download several AIs via the 'Online Content' system
 
STR_WARNING_DIFFICULTY_TO_CUSTOM                                :{WHITE}This action changed the difficulty level to custom
 

	
 
# Advanced settings window
 
STR_CONFIG_SETTING_CAPTION                                      :{WHITE}Advanced Settings
 
STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT            :(no explanation available)
 
STR_CONFIG_SETTING_DEFAULT_VALUE                                :{LTBLUE}Default value: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_TYPE                                         :{LTBLUE}Setting type: {ORANGE}{STRING}
 
STR_CONFIG_SETTING_TYPE_CLIENT                                  :Client setting (not stored in saves; affects all games)
 
STR_CONFIG_SETTING_TYPE_GAME_MENU                               :Game setting (stored in saves; affects only new games)
 
STR_CONFIG_SETTING_TYPE_GAME_INGAME                             :Game setting (stored in save; affects only current game)
 
STR_CONFIG_SETTING_TYPE_COMPANY_MENU                            :Company setting (stored in saves; affects only new games)
 
STR_CONFIG_SETTING_TYPE_COMPANY_INGAME                          :Company setting (stored in save; affects only current company)
 

	
 
STR_CONFIG_SETTING_OFF                                          :Off
 
STR_CONFIG_SETTING_ON                                           :On
 
STR_CONFIG_SETTING_DISABLED                                     :disabled
 

	
 
STR_CONFIG_SETTING_COMPANIES_OFF                                :Off
 
STR_CONFIG_SETTING_COMPANIES_OWN                                :Own company
 
STR_CONFIG_SETTING_COMPANIES_ALL                                :All companies
 

	
 
STR_CONFIG_SETTING_NONE                                         :None
 
STR_CONFIG_SETTING_ORIGINAL                                     :Original
 
STR_CONFIG_SETTING_REALISTIC                                    :Realistic
 

	
 
STR_CONFIG_SETTING_HORIZONTAL_POS_LEFT                          :Left
 
STR_CONFIG_SETTING_HORIZONTAL_POS_CENTER                        :Centre
 
STR_CONFIG_SETTING_HORIZONTAL_POS_RIGHT                         :Right
 

	
 
STR_CONFIG_SETTING_BUILDONSLOPES                                :Allow building on slopes and coasts: {STRING2}
 
STR_CONFIG_SETTING_BUILDONSLOPES_HELPTEXT                       :If enabled, tracks and stations can be build on most slopes. If disabled, they are only allowed on slopes which match the direction of the track and thus require no foundations
 
STR_CONFIG_SETTING_AUTOSLOPE                                    :Allow landscaping under buildings, tracks, etc. (autoslope): {STRING2}
 
STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT                           :Allow landscaping under buildings and tracks without removing them
 
STR_CONFIG_SETTING_CATCHMENT                                    :Allow more realistically sized catchment areas: {STRING2}
 
STR_CONFIG_SETTING_CATCHMENT_HELPTEXT                           :Have differently sized catchment areas for different types of stations and airports
 
STR_CONFIG_SETTING_EXTRADYNAMITE                                :Allow removal of more town-owned roads, bridges and tunnels: {STRING2}
 
STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT                       :Make it easier to remove town-owned infrastructure and buildings
 
STR_CONFIG_SETTING_TRAIN_LENGTH                                 :Maximum length of trains: {STRING2}
 
STR_CONFIG_SETTING_TRAIN_LENGTH_HELPTEXT                        :Set the maximum length of trains
 
STR_CONFIG_SETTING_TILE_LENGTH                                  :{COMMA} tile{P 0 "" s}
 
STR_CONFIG_SETTING_SMOKE_AMOUNT                                 :Amount of vehicle smoke/sparks: {STRING2}
 
STR_CONFIG_SETTING_SMOKE_AMOUNT_HELPTEXT                        :Set how much smoke or how many sparks are emitted by vehicles
 
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL                     :Train acceleration model: {STRING2}
 
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_HELPTEXT            :Select the physics model for train acceleration. The "original" model penalises slopes equally for all vehicles. The "realistic" model penalises slopes and curves depending on various properties of the consist, like length and tractive effort
 
STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL              :Road vehicle acceleration model: {STRING2}
 
STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL_HELPTEXT     :Select the physics model for road vehicle acceleration. The "original" model penalises slopes equally for all vehicles. The "realistic" model penalises slopes depending on various properties of the engine, for example 'tractive effort'
 
STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS                        :Slope steepness for trains: {STRING2}
 
STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS_HELPTEXT               :Steepness of a sloped tile for a train. Higher values make it more difficult to climb a hill
 
STR_CONFIG_SETTING_PERCENTAGE                                   :{COMMA}%
 
STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS                 :Slope steepness for road vehicles: {STRING2}
 
STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS_HELPTEXT        :Steepness of a sloped tile for a road vehicle. Higher values make it more difficult to climb a hill
 
STR_CONFIG_SETTING_FORBID_90_DEG                                :Forbid trains and ships from making 90° turns: {STRING2}
 
STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT                       :90 degree turns occur when a horizontal track is directly followed by a vertical track piece on the adjacent tile, thus making the train turn by 90 degree when traversing the tile edge instead of the usual 45 degrees for other track combinations. This also applies to the turning radius of ships
 
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS                        :Allow to join stations not directly adjacent: {STRING2}
 
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT               :Allow adding parts to a station without directly touching the existing parts. Needs Ctrl+Click while placing the new parts
 
STR_CONFIG_SETTING_IMPROVEDLOAD                                 :Use improved loading algorithm: {STRING2}
 
STR_CONFIG_SETTING_IMPROVEDLOAD_HELPTEXT                        :If enabled, multiple vehicles waiting at a station are loaded sequentially. Loading of the next vehicle only starts when there is enough cargo waiting to completely fill the first vehicle
 
STR_CONFIG_SETTING_GRADUAL_LOADING                              :Load vehicles gradually: {STRING2}
 
STR_CONFIG_SETTING_GRADUAL_LOADING_HELPTEXT                     :Gradually load vehicles using vehicle specific loading durations, instead of loading everything at once with a fixed time depending only on the amount of cargo loaded
 
STR_CONFIG_SETTING_INFLATION                                    :Inflation: {STRING2}
 
STR_CONFIG_SETTING_INFLATION_HELPTEXT                           :Enable inflation in the economy, where costs are slightly faster rising than payments
 
STR_CONFIG_SETTING_SELECTGOODS                                  :Deliver cargo to a station only when there is a demand: {STRING2}
 
STR_CONFIG_SETTING_SELECTGOODS_HELPTEXT                         :Only deliver cargo to a station that was requested from a loading vehicle. This prevents bad ratings for cargoes that are not serviced at a station
 
STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH                            :Maximum bridge length: {STRING2}
 
STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH_HELPTEXT                   :Maximum length for building bridges
 
STR_CONFIG_SETTING_MAX_TUNNEL_LENGTH                            :Maximum tunnel length: {STRING2}
 
STR_CONFIG_SETTING_MAX_TUNNEL_LENGTH_HELPTEXT                   :Maximum length for building tunnels
 
STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD             :Manual primary industry construction method: {STRING2}
 
STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_HELPTEXT    :Method of funding a primary industry. 'none' means it is not possible to fund any, 'prospecting' means funding is possible, but construction occurs in a random spot on the map and may as well fail, 'as other industries' means raw industries can be constructed by companies like processing industries in any position they like
 
STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_NONE        :none
 
STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_NORMAL      :as other industries
 
STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_PROSPECTING :prospecting
 
STR_CONFIG_SETTING_INDUSTRY_PLATFORM                            :Flat area around industries: {STRING2}
 
STR_CONFIG_SETTING_INDUSTRY_PLATFORM_HELPTEXT                   :Amount of flat space around an industry. This ensures empty space will remain available around an industry for building tracks, et cetera
 
STR_CONFIG_SETTING_MULTIPINDTOWN                                :Allow multiple similar industries per town: {STRING2}
 
STR_CONFIG_SETTING_MULTIPINDTOWN_HELPTEXT                       :Normally, a town does not want more than one industry of each type. With this setting, it will allow several industries of the same type in the same town
 
STR_CONFIG_SETTING_SIGNALSIDE                                   :Show signals: {STRING2}
 
STR_CONFIG_SETTING_SIGNALSIDE_HELPTEXT                          :Select on which side of the track to place signals
 
STR_CONFIG_SETTING_SIGNALSIDE_LEFT                              :On the left
 
STR_CONFIG_SETTING_SIGNALSIDE_DRIVING_SIDE                      :On the driving side
 
STR_CONFIG_SETTING_SIGNALSIDE_RIGHT                             :On the right
 
STR_CONFIG_SETTING_SHOWFINANCES                                 :Show finances window at the end of the year: {STRING2}
 
STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT                        :If enabled, the finances window pops up at the end of each year to allow easy inspection of the financial status of the company
 
STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT                           :New orders are 'non-stop' by default: {STRING2}
 
STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT                  :Normally, a vehicle will stop at every station it passes. By enabling this setting, it will drive through all station on the way to its final destination without stopping. Note, that this setting only defines a default value for new orders. Individual orders can be set explicitly to either behaviour nevertheless
 
STR_CONFIG_SETTING_STOP_LOCATION                                :New train orders stop by default at the {STRING2} of the platform
 
STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT                       :Place where a train will stop at the platform by default. The 'near end' means close to the entry point, 'middle' means in the middle of the platform, and 'far end' means far away from the entry point. Note, that this setting only defines a default value for new orders. Individual orders can be set explicitly to either behaviour nevertheless
 
STR_CONFIG_SETTING_STOP_LOCATION_NEAR_END                       :near end
 
STR_CONFIG_SETTING_STOP_LOCATION_MIDDLE                         :middle
 
STR_CONFIG_SETTING_STOP_LOCATION_FAR_END                        :far end
 
STR_CONFIG_SETTING_ROAD_VEHICLE_QUEUEING                        :Road vehicle queueing (with quantum effects): {STRING2}
 
STR_CONFIG_SETTING_ROAD_VEHICLE_QUEUEING_HELPTEXT               :Make road vehicle wait in front of occupied road stops until they are cleared
 
STR_CONFIG_SETTING_AUTOSCROLL                                   :Pan window when mouse is at the edge: {STRING2}
 
STR_CONFIG_SETTING_AUTOSCROLL_HELPTEXT                          :When enabled, the main display will start to scroll when the mouse is near the edge of the screen
 
STR_CONFIG_SETTING_BRIBE                                        :Allow bribing of the local authority: {STRING2}
 
STR_CONFIG_SETTING_BRIBE_HELPTEXT                               :Allow companies to try bribing the local town authority. If the bribe is noticed by an inspector, the company will not be able to act in the town for six months
 
STR_CONFIG_SETTING_ALLOW_EXCLUSIVE                              :Allow buying exclusive transport rights: {STRING2}
 
STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT                     :If a company buys exclusive transport rights for a town, opponents' stations (passenger and cargo) won't receive any cargo for a whole year
 
STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS                         :Allow funding buildings: {STRING2}
 
STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS_HELPTEXT                :Allow companies to give money to towns for funding new houses
 
STR_CONFIG_SETTING_ALLOW_FUND_ROAD                              :Allow funding local road reconstruction: {STRING2}
 
STR_CONFIG_SETTING_ALLOW_FUND_ROAD_HELPTEXT                     :Allow companies to give money to towns for road re-construction to sabotage road-based services in the town
 
STR_CONFIG_SETTING_ALLOW_GIVE_MONEY                             :Allow sending money to other companies: {STRING2}
 
STR_CONFIG_SETTING_ALLOW_GIVE_MONEY_HELPTEXT                    :Allow transfer of money between companies in multiplayer mode
 
STR_CONFIG_SETTING_FREIGHT_TRAINS                               :Weight multiplier for freight to simulate heavy trains: {STRING2}
 
STR_CONFIG_SETTING_FREIGHT_TRAINS_HELPTEXT                      :Set the impact of carrying freight in trains. A higher value makes carrying freight more demanding for trains, especially at hills
 
STR_CONFIG_SETTING_PLANE_SPEED                                  :Plane speed factor: {STRING2}
 
STR_CONFIG_SETTING_PLANE_SPEED_HELPTEXT                         :Set the relative speed of planes compared to other vehicle types, to reduce the amount of income of transport by aircraft
src/settings_gui.cpp
Show inline comments
 
@@ -1651,228 +1651,248 @@ static SettingEntry _settings_vehicles_t
 
	SettingEntry("vehicle.disable_elrails"),
 
	SettingEntry("vehicle.freight_trains"),
 
	SettingEntry("gui.stop_location"),
 
};
 
/** Trains sub-page */
 
static SettingsPage _settings_vehicles_trains_page = {_settings_vehicles_trains, lengthof(_settings_vehicles_trains)};
 

	
 
static SettingEntry _settings_vehicles[] = {
 
	SettingEntry(&_settings_vehicles_routing_page, STR_CONFIG_SETTING_VEHICLES_ROUTING),
 
	SettingEntry(&_settings_vehicles_autorenew_page, STR_CONFIG_SETTING_VEHICLES_AUTORENEW),
 
	SettingEntry(&_settings_vehicles_servicing_page, STR_CONFIG_SETTING_VEHICLES_SERVICING),
 
	SettingEntry(&_settings_vehicles_trains_page, STR_CONFIG_SETTING_VEHICLES_TRAINS),
 
	SettingEntry("gui.new_nonstop"),
 
	SettingEntry("gui.order_review_system"),
 
	SettingEntry("gui.vehicle_income_warn"),
 
	SettingEntry("gui.lost_vehicle_warn"),
 
	SettingEntry("vehicle.never_expire_vehicles"),
 
	SettingEntry("vehicle.max_trains"),
 
	SettingEntry("vehicle.max_roadveh"),
 
	SettingEntry("vehicle.max_aircraft"),
 
	SettingEntry("vehicle.max_ships"),
 
	SettingEntry("vehicle.plane_speed"),
 
	SettingEntry("vehicle.plane_crashes"),
 
	SettingEntry("vehicle.dynamic_engines"),
 
	SettingEntry("vehicle.roadveh_acceleration_model"),
 
	SettingEntry("vehicle.roadveh_slope_steepness"),
 
	SettingEntry("vehicle.smoke_amount"),
 
};
 
/** Vehicles sub-page */
 
static SettingsPage _settings_vehicles_page = {_settings_vehicles, lengthof(_settings_vehicles)};
 

	
 
static SettingEntry _settings_main[] = {
 
	SettingEntry(&_settings_ui_page,           STR_CONFIG_SETTING_GUI),
 
	SettingEntry(&_settings_construction_page, STR_CONFIG_SETTING_CONSTRUCTION),
 
	SettingEntry(&_settings_vehicles_page,     STR_CONFIG_SETTING_VEHICLES),
 
	SettingEntry(&_settings_stations_page,     STR_CONFIG_SETTING_STATIONS),
 
	SettingEntry(&_settings_economy_page,      STR_CONFIG_SETTING_ECONOMY),
 
	SettingEntry(&_settings_ai_page,           STR_CONFIG_SETTING_AI),
 
};
 

	
 
/** Main page, holding all advanced settings */
 
static SettingsPage _settings_main_page = {_settings_main, lengthof(_settings_main)};
 

	
 
struct GameSettingsWindow : Window {
 
	static const int SETTINGTREE_LEFT_OFFSET   = 5; ///< Position of left edge of setting values
 
	static const int SETTINGTREE_RIGHT_OFFSET  = 5; ///< Position of right edge of setting values
 
	static const int SETTINGTREE_TOP_OFFSET    = 5; ///< Position of top edge of setting values
 
	static const int SETTINGTREE_BOTTOM_OFFSET = 5; ///< Position of bottom edge of setting values
 

	
 
	static GameSettings *settings_ptr; ///< Pointer to the game settings being displayed and modified.
 

	
 
	SettingEntry *valuewindow_entry;   ///< If non-NULL, pointer to setting for which a value-entering window has been opened.
 
	SettingEntry *clicked_entry;       ///< If non-NULL, pointer to a clicked numeric setting (with a depressed left or right button).
 
	SettingEntry *last_clicked;        ///< If non-NULL, pointer to the last clicked setting.
 
	SettingEntry *valuedropdown_entry; ///< If non-NULL, pointer to the value for which a dropdown window is currently opened.
 
	bool closing_dropdown;             ///< True, if the dropdown list is currently closing.
 

	
 
	Scrollbar *vscroll;
 

	
 
	GameSettingsWindow(const WindowDesc *desc) : Window()
 
	{
 
		static bool first_time = true;
 

	
 
		settings_ptr = &GetGameSettings();
 

	
 
		/* Build up the dynamic settings-array only once per OpenTTD session */
 
		if (first_time) {
 
			_settings_main_page.Init();
 
			first_time = false;
 
		} else {
 
			_settings_main_page.FoldAll(); // Close all sub-pages
 
		}
 

	
 
		this->valuewindow_entry = NULL; // No setting entry for which a entry window is opened
 
		this->clicked_entry = NULL; // No numeric setting buttons are depressed
 
		this->last_clicked = NULL;
 
		this->valuedropdown_entry = NULL;
 
		this->closing_dropdown = false;
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_GS_SCROLLBAR);
 
		this->FinishInitNested(desc, WN_GAME_OPTIONS_GAME_SETTINGS);
 

	
 
		this->vscroll->SetCount(_settings_main_page.Length());
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case WID_GS_OPTIONSPANEL:
 
				resize->height = SETTING_HEIGHT = max(11, FONT_HEIGHT_NORMAL + 1);
 
				resize->width  = 1;
 

	
 
				size->height = 5 * resize->height + SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET;
 
				break;
 

	
 
			case WID_GS_HELP_TEXT:
 
				size->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL +
 
			case WID_GS_HELP_TEXT: {
 
				static const StringID setting_types[] = {
 
					STR_CONFIG_SETTING_TYPE_CLIENT,
 
					STR_CONFIG_SETTING_TYPE_COMPANY_MENU, STR_CONFIG_SETTING_TYPE_COMPANY_INGAME,
 
					STR_CONFIG_SETTING_TYPE_GAME_MENU, STR_CONFIG_SETTING_TYPE_GAME_INGAME,
 
				};
 
				for (uint i = 0; i < lengthof(setting_types); i++) {
 
					SetDParam(0, setting_types[i]);
 
					size->width = max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width);
 
				}
 
				size->height = 2 * FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL +
 
						max(size->height, _settings_main_page.GetMaxHelpHeight(size->width));
 
				break;
 
			}
 

	
 
			default:
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		if (this->closing_dropdown) {
 
			this->closing_dropdown = false;
 
			assert(this->valuedropdown_entry != NULL);
 
			this->valuedropdown_entry->SetButtons(0);
 
			this->valuedropdown_entry = NULL;
 
		}
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case WID_GS_OPTIONSPANEL:
 
				_settings_main_page.Draw(settings_ptr, r.left + SETTINGTREE_LEFT_OFFSET, r.right - SETTINGTREE_RIGHT_OFFSET, r.top + SETTINGTREE_TOP_OFFSET,
 
						this->vscroll->GetPosition(), this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->last_clicked);
 
				break;
 

	
 
			case WID_GS_HELP_TEXT:
 
				if (this->last_clicked != NULL) {
 
					const SettingDesc *sd = this->last_clicked->d.entry.setting;
 

	
 
					int y = r.top;
 
					if (sd->desc.flags & SGF_PER_COMPANY) {
 
						SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME);
 
					} else if (sd->save.conv & SLF_NOT_IN_SAVE) {
 
						SetDParam(0, STR_CONFIG_SETTING_TYPE_CLIENT);
 
					} else {
 
						SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME);
 
					}
 
					DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE);
 
					y += FONT_HEIGHT_NORMAL;
 

	
 
					int32 default_value = ReadValue(&sd->desc.def, sd->save.conv);
 
					this->last_clicked->SetValueDParams(0, default_value);
 

	
 
					int y = r.top;
 
					DrawString(r.left, r.right, y, STR_CONFIG_SETTING_DEFAULT_VALUE);
 
					y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
 

	
 
					DrawStringMultiLine(r.left, r.right, y, r.bottom, this->last_clicked->GetHelpText(), TC_WHITE);
 
				}
 
				break;
 

	
 
			default:
 
				break;
 
		}
 
	}
 

	
 
	/**
 
	 * Set the entry that should have its help text displayed, and mark the window dirty so it gets repainted.
 
	 * @param pe Setting to display help text of, use \c NULL to stop displaying help of the currently displayed setting.
 
	 */
 
	void SetDisplayedHelpText(SettingEntry *pe)
 
	{
 
		if (this->last_clicked != pe) this->SetDirty();
 
		this->last_clicked = pe;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != WID_GS_OPTIONSPANEL) return;
 

	
 
		uint btn = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_GS_OPTIONSPANEL, SETTINGTREE_TOP_OFFSET);
 
		if (btn == INT_MAX) return;
 

	
 
		uint cur_row = 0;
 
		SettingEntry *pe = _settings_main_page.FindEntry(btn, &cur_row);
 

	
 
		if (pe == NULL) return;  // Clicked below the last setting of the page
 

	
 
		int x = (_current_text_dir == TD_RTL ? this->width - 1 - pt.x : pt.x) - SETTINGTREE_LEFT_OFFSET - (pe->level + 1) * LEVEL_WIDTH;  // Shift x coordinate
 
		if (x < 0) return;  // Clicked left of the entry
 

	
 
		if ((pe->flags & SEF_KIND_MASK) == SEF_SUBTREE_KIND) {
 
			this->SetDisplayedHelpText(NULL);
 
			pe->d.sub.folded = !pe->d.sub.folded; // Flip 'folded'-ness of the sub-page
 

	
 
			this->vscroll->SetCount(_settings_main_page.Length());
 
			this->SetDirty();
 
			return;
 
		}
 

	
 
		assert((pe->flags & SEF_KIND_MASK) == SEF_SETTING_KIND);
 
		const SettingDesc *sd = pe->d.entry.setting;
 

	
 
		/* return if action is only active in network, or only settable by server */
 
		if ((!(sd->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server && !(sd->desc.flags & SGF_PER_COMPANY)) ||
 
				((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) || ((sd->desc.flags & SGF_NO_NETWORK) && _networking)) {
 
			this->SetDisplayedHelpText(pe);
 
			return;
 
		}
 

	
 
		const void *var = ResolveVariableAddress(settings_ptr, sd);
 
		int32 value = (int32)ReadValue(var, sd->save.conv);
 

	
 
		/* clicked on the icon on the left side. Either scroller, bool on/off or dropdown */
 
		if (x < SETTING_BUTTON_WIDTH && (sd->desc.flags & SGF_MULTISTRING)) {
 
			const SettingDescBase *sdb = &sd->desc;
 
			this->SetDisplayedHelpText(pe);
 

	
 
			if (this->valuedropdown_entry == pe) {
 
				/* unclick the dropdown */
 
				HideDropDownMenu(this);
 
				this->closing_dropdown = false;
 
				this->valuedropdown_entry->SetButtons(0);
 
				this->valuedropdown_entry = NULL;
 
			} else {
 
				if (this->valuedropdown_entry != NULL) this->valuedropdown_entry->SetButtons(0);
 
				this->closing_dropdown = false;
 

	
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_GS_OPTIONSPANEL);
 
				int rel_y = (pt.y - (int)wid->pos_y - SETTINGTREE_TOP_OFFSET) % wid->resize_y;
 

	
 
				Rect wi_rect;
 
				wi_rect.left = pt.x - (_current_text_dir == TD_RTL ? SETTING_BUTTON_WIDTH - 1 - x : x);
 
				wi_rect.right = wi_rect.left + SETTING_BUTTON_WIDTH - 1;
 
				wi_rect.top = pt.y - rel_y + (SETTING_HEIGHT - SETTING_BUTTON_HEIGHT) / 2;
 
				wi_rect.bottom = wi_rect.top + SETTING_BUTTON_HEIGHT - 1;
 

	
 
				/* For dropdowns we also have to check the y position thoroughly, the mouse may not above the just opening dropdown */
 
				if (pt.y >= wi_rect.top && pt.y <= wi_rect.bottom) {
 
					this->valuedropdown_entry = pe;
 
					this->valuedropdown_entry->SetButtons(SEF_LEFT_DEPRESSED);
 

	
 
					DropDownList *list = new DropDownList();
 
					for (int i = sdb->min; i <= (int)sdb->max; i++) {
 
						list->push_back(new DropDownListStringItem(sdb->str_val + i - sdb->min, i, false));
 
					}
 

	
 
					ShowDropDownListAt(this, list, value, -1, wi_rect, COLOUR_ORANGE, true);
 
				}
 
			}
0 comments (0 inline, 0 general)