|
OpenTTD Source 20261123-master-g1c55c72fd0
|
The tables of all the settings as well as the implementation of most of their callbacks. More...
#include "stdafx.h"#include "settings_table.h"#include "currency_type.h"#include "screenshot.h"#include "network/network.h"#include "network/network_func.h"#include "network/core/config.h"#include "pathfinder/pathfinder_type.h"#include "linkgraph/linkgraphschedule.h"#include "genworld.h"#include "train.h"#include "news_func.h"#include "window_func.h"#include "company_base.h"#include "company_func.h"#include "saveload/saveload_func.h"#include "timer/timer_game_calendar.h"#include "fontcache.h"#include "textbuf_gui.h"#include "rail_gui.h"#include "elrail_func.h"#include "error.h"#include "town.h"#include "video/video_driver.hpp"#include "sound/sound_driver.hpp"#include "music/music_driver.hpp"#include "blitter/factory.hpp"#include "base_media_base.h"#include "base_media_music.h"#include "base_media_sounds.h"#include "ai/ai_config.hpp"#include "ai/ai.hpp"#include "game/game_config.hpp"#include "ship.h"#include "smallmap_gui.h"#include "roadveh.h"#include "roadveh_cmd.h"#include "spritecache.h"#include "vehicle_func.h"#include "vehicle_gui.h"#include "viewport_func.h"#include "void_map.h"#include "station_func.h"#include "station_base.h"#include "aircraft.h"#include "aircraft_cmd.h"#include "table/strings.h"#include "table/settings.h"#include "safeguards.h"Go to the source code of this file.
Functions | |
| static StringID | SettingTitleWallclock (const IntSettingDesc &sd) |
| Switch setting title depending on wallclock setting. | |
| static StringID | SettingHelpWallclock (const IntSettingDesc &sd) |
| Switch setting help depending on wallclock setting. | |
| static std::pair< StringParameter, StringParameter > | SettingsValueVelocityUnit (const IntSettingDesc &sd, int32_t value) |
| Setting values for velocity unit localisation. | |
| static std::pair< StringParameter, StringParameter > | SettingsValueAbsolute (const IntSettingDesc &sd, int32_t value) |
| A negative value has another string (the one after "strval"). | |
| static std::pair< StringParameter, StringParameter > | ServiceIntervalSettingsValueText (const IntSettingDesc &sd, int32_t value) |
| Service Interval Settings Default Value displays the correct units or as a percentage. | |
| static void | v_PositionMainToolbar (int32_t) |
| Reposition the main toolbar as the setting changed. | |
| static void | v_PositionStatusbar (int32_t) |
| Reposition the statusbar as the setting changed. | |
| static void | RedrawSmallmap (int32_t) |
| Redraw the smallmap after a colour scheme change. | |
| static void | UpdateLinkgraphColours (int32_t) |
| Redraw linkgraph links after a colour scheme change. | |
| static void | StationSpreadChanged (int32_t) |
| static void | UpdateConsists (int32_t) |
| static void | UpdateAllServiceInterval (int32_t new_value) |
| Check and update if needed all vehicle service intervals. | |
| static bool | CanUpdateServiceInterval (VehicleType, int32_t &new_value) |
| static void | UpdateServiceInterval (VehicleType type, int32_t new_value) |
| static int32_t | GetDefaultServiceInterval (const IntSettingDesc &sd, VehicleType type) |
| Checks if the service intervals in the settings are specified as percentages and corrects the default value accordingly. | |
| static std::tuple< int32_t, uint32_t > | GetServiceIntervalRange (const IntSettingDesc &) |
| static void | TrainAccelerationModelChanged (int32_t) |
| static void | TrainSlopeSteepnessChanged (int32_t) |
| This function updates the train acceleration cache after a steepness change. | |
| static void | RoadVehAccelerationModelChanged (int32_t) |
| This function updates realistic acceleration caches when the setting "Road vehicle acceleration model" is set. | |
| static void | RoadVehSlopeSteepnessChanged (int32_t) |
| This function updates the road vehicle acceleration cache after a steepness change. | |
| static void | AircraftRangeChanged (int32_t) |
| This function updates the aircraft cache when the aircraft range setting is changed. | |
| static void | TownFoundingChanged (int32_t) |
| static void | ZoomMinMaxChanged (int32_t) |
| static void | SpriteZoomMinChanged (int32_t) |
| static void | InvalidateNewGRFChangeWindows (int32_t) |
| Update any possible saveload window and delete any newgrf dialogue as its widget parts might change. | |
| static void | InvalidateCompanyLiveryWindow (int32_t) |
| static void | DifficultyNoiseChange (int32_t) |
| static void | MaxNoAIsChange (int32_t) |
| static bool | CheckRoadSide (int32_t &) |
| Check whether the road side may be changed. | |
| static std::optional< uint32_t > | ConvertLandscape (std::string_view value) |
| Conversion callback for _gameopt_settings_game.landscape It converts (or try) between old values and the new ones, without losing initial setting of the user. | |
| static bool | CheckFreeformEdges (int32_t &new_value) |
| static void | UpdateFreeformEdges (int32_t new_value) |
| static bool | CheckDynamicEngines (int32_t &value) |
| Changing the setting "allow multiple NewGRF sets" is not allowed if there are vehicles. | |
| static bool | CheckMaxHeightLevel (int32_t &new_value) |
| static void | StationCatchmentChanged (int32_t) |
| static void | MaxVehiclesChanged (int32_t) |
| static bool | ReplaceAsteriskWithEmptyPassword (std::string &newval) |
| Replace a passwords that are a literal asterisk with an empty string. | |
| static void | UpdateClientConfigValues () |
| Update the game info, and send it to the clients when we are running as a server. | |
| static void | ChangeTimekeepingUnits () |
| Callback for when the player changes the timekeeping units. | |
| static void | ChangeMinutesPerYear (int32_t new_value) |
| Callback after the player changes the minutes per year. | |
| static std::tuple< int32_t, uint32_t > | GetMinutesPerYearRange (const IntSettingDesc &) |
| static bool | CanChangeTimetableMode (int32_t &) |
| Pre-callback check when trying to change the timetable mode. | |
Variables | |
| SettingTable | _company_settings { _company_settings_table } |
| SettingTable | _currency_settings { _currency_settings_table } |
| SettingTable | _difficulty_settings { _difficulty_settings_table } |
| SettingTable | _multimedia_settings { _multimedia_settings_table } |
| SettingTable | _economy_settings { _economy_settings_table } |
| SettingTable | _game_settings { _game_settings_table } |
| SettingTable | _gui_settings { _gui_settings_table } |
| SettingTable | _linkgraph_settings { _linkgraph_settings_table } |
| SettingTable | _locale_settings { _locale_settings_table } |
| SettingTable | _misc_settings { _misc_settings_table } |
| SettingTable | _network_private_settings { _network_private_settings_table } |
| SettingTable | _network_secrets_settings { _network_secrets_settings_table } |
| SettingTable | _network_settings { _network_settings_table } |
| SettingTable | _news_display_settings { _news_display_settings_table } |
| SettingTable | _old_gameopt_settings { _old_gameopt_settings_table } |
| SettingTable | _pathfinding_settings { _pathfinding_settings_table } |
| SettingTable | _script_settings { _script_settings_table } |
| SettingTable | _window_settings { _window_settings_table } |
| SettingTable | _world_settings { _world_settings_table } |
The tables of all the settings as well as the implementation of most of their callbacks.
Definition in file settings_table.cpp.
| #define HAS_TRUETYPE_FONT |
Definition at line 28 of file settings_table.cpp.
|
static |
This function updates the aircraft cache when the aircraft range setting is changed.
Definition at line 376 of file settings_table.cpp.
References AircraftDestinationTooFar, DeleteVehicleNews(), DestinationTooFar, SetWindowWidgetDirty(), and WID_VV_START_STOP.
|
static |
Pre-callback check when trying to change the timetable mode.
This is locked to Seconds when using wallclock units.
Definition at line 707 of file settings_table.cpp.
References TimerGameEconomy::UsingWallclockUnits().
|
static |
Definition at line 244 of file settings_table.cpp.
|
static |
Callback after the player changes the minutes per year.
| new_value | The intended new value of the setting, used for clamping. |
Definition at line 662 of file settings_table.cpp.
References _settings_game, _settings_newgame, ChangeTimekeepingUnits(), and Menu.
|
static |
Callback for when the player changes the timekeeping units.
Definition at line 620 of file settings_table.cpp.
References _settings_client, _settings_newgame, TimerGameEconomy::ConvertYMDToDate(), TimerGameCalendar::date, TimerGameEconomy::date, TimerGameCalendar::date_fract, Editor, LinkGraphSchedule::instance, InvalidateWindowClassesData(), TimerGameEconomy::SetDate(), UpdateAllServiceInterval(), and TimerGameEconomy::UsingWallclockUnits().
Referenced by ChangeMinutesPerYear().
|
static |
Changing the setting "allow multiple NewGRF sets" is not allowed if there are vehicles.
A check to be performed before the setting gets changed.
The passed integer may be changed by the check if that is important, for example to remove some unwanted bit. The return value denotes whether the value, potentially after the changes, is allowed to be used/set in the configuration.
| value | The prospective new value for the setting. |
Definition at line 552 of file settings_table.cpp.
References Error, GetEncodedString(), Menu, EngineOverrideManager::ResetToCurrentNewGRFConfig(), and ShowErrorMessage().
|
static |
Definition at line 479 of file settings_table.cpp.
|
static |
Definition at line 564 of file settings_table.cpp.
|
static |
Check whether the road side may be changed.
Definition at line 460 of file settings_table.cpp.
References Menu, and RoadVehiclesAreBuilt().
|
static |
Conversion callback for _gameopt_settings_game.landscape It converts (or try) between old values and the new ones, without losing initial setting of the user.
| value | that was read from config file |
Definition at line 472 of file settings_table.cpp.
References OneOfManySettingDesc::ParseSingleValue().
|
static |
Definition at line 435 of file settings_table.cpp.
|
static |
Checks if the service intervals in the settings are specified as percentages and corrects the default value accordingly.
| sd | The current setting. |
| type | The vehicle's type. |
Definition at line 277 of file settings_table.cpp.
References _current_company, _settings_client, Aircraft, IntSettingDesc::def, Menu, Road, VehicleDefaultSettings::servint_ispercent, Ship, Train, and TimerGameEconomy::UsingWallclockUnits().
|
static |
Definition at line 695 of file settings_table.cpp.
|
static |
Definition at line 301 of file settings_table.cpp.
|
static |
Definition at line 429 of file settings_table.cpp.
|
static |
Update any possible saveload window and delete any newgrf dialogue as its widget parts might change.
Reinit all windows as it allows access to the newgrf debug button.
Definition at line 422 of file settings_table.cpp.
References CloseWindowByClass(), InvalidateWindowClassesData(), and ReInitAllWindows().
|
static |
Definition at line 445 of file settings_table.cpp.
|
static |
Definition at line 588 of file settings_table.cpp.
|
static |
Redraw the smallmap after a colour scheme change.
Definition at line 166 of file settings_table.cpp.
References BuildLandLegend(), BuildOwnerLegend(), and SetWindowClassesDirty().
|
static |
Replace a passwords that are a literal asterisk with an empty string.
| newval | The new string value for this password field. |
Definition at line 599 of file settings_table.cpp.
|
static |
This function updates realistic acceleration caches when the setting "Road vehicle acceleration model" is set.
Definition at line 347 of file settings_table.cpp.
References _settings_game, InvalidateWindowClassesData(), Original, and SetWindowClassesDirty().
|
static |
This function updates the road vehicle acceleration cache after a steepness change.
Definition at line 366 of file settings_table.cpp.
|
static |
Service Interval Settings Default Value displays the correct units or as a percentage.
Callback to parameters for string formatting for this setting.
| sd | The setting to consider. |
| value | The value of the setting. |
Definition at line 125 of file settings_table.cpp.
References _current_company, _settings_client, Menu, VehicleDefaultSettings::servint_ispercent, IntSettingDesc::str_val, and TimerGameEconomy::UsingWallclockUnits().
|
static |
Switch setting help depending on wallclock setting.
Callback to get the help description for the settings panel of this setting.
| sd | The setting to consider. |
Definition at line 98 of file settings_table.cpp.
References Menu, IntSettingDesc::str_help, and TimerGameEconomy::UsingWallclockUnits().
|
static |
A negative value has another string (the one after "strval").
Callback to parameters for string formatting for this setting.
| sd | The setting to consider. |
| value | The value of the setting. |
Definition at line 119 of file settings_table.cpp.
References abs(), and IntSettingDesc::str_val.
|
static |
Setting values for velocity unit localisation.
Callback to parameters for string formatting for this setting.
| sd | The setting to consider. |
| value | The value of the setting. |
Definition at line 104 of file settings_table.cpp.
References Menu, and TimerGameEconomy::UsingWallclockUnits().
|
static |
Switch setting title depending on wallclock setting.
Callback to get the title for the settings panel of this setting.
| sd | The setting to consider. |
Definition at line 92 of file settings_table.cpp.
References Menu, IntSettingDesc::str, and TimerGameEconomy::UsingWallclockUnits().
|
static |
Definition at line 410 of file settings_table.cpp.
|
static |
Definition at line 582 of file settings_table.cpp.
|
static |
Definition at line 180 of file settings_table.cpp.
|
static |
Definition at line 391 of file settings_table.cpp.
|
static |
Definition at line 319 of file settings_table.cpp.
|
static |
This function updates the train acceleration cache after a steepness change.
Definition at line 337 of file settings_table.cpp.
|
static |
Check and update if needed all vehicle service intervals.
| new_value | Contains 0 if service intervals are in time (days or real-world minutes), otherwise intervals use percents. |
Definition at line 199 of file settings_table.cpp.
References _current_company, _settings_client, CompanyServiceInterval(), Menu, VehicleDefaultSettings::servint_aircraft, VehicleDefaultSettings::servint_roadveh, VehicleDefaultSettings::servint_ships, VehicleDefaultSettings::servint_trains, SetWindowClassesDirty(), and TimerGameEconomy::UsingWallclockUnits().
Referenced by ChangeTimekeepingUnits().
|
static |
Update the game info, and send it to the clients when we are running as a server.
Definition at line 606 of file settings_table.cpp.
References _network_server, InvalidateWindowData(), NetworkServerSendConfigUpdate(), and NetworkServerUpdateGameInfo().
|
static |
Definition at line 186 of file settings_table.cpp.
|
static |
Definition at line 526 of file settings_table.cpp.
|
static |
Redraw linkgraph links after a colour scheme change.
Definition at line 174 of file settings_table.cpp.
References BuildLinkStatsLegend(), and MarkWholeScreenDirty().
|
static |
Definition at line 258 of file settings_table.cpp.
|
static |
Reposition the main toolbar as the setting changed.
Definition at line 148 of file settings_table.cpp.
References Menu, and PositionMainToolbar().
|
static |
Reposition the statusbar as the setting changed.
Definition at line 154 of file settings_table.cpp.
References Menu, PositionNetworkChatWindow(), PositionNewsMessage(), and PositionStatusbar().
|
static |
Definition at line 400 of file settings_table.cpp.
| SettingTable _company_settings { _company_settings_table } |
Definition at line 65 of file settings_table.cpp.
| SettingTable _currency_settings { _currency_settings_table } |
Definition at line 66 of file settings_table.cpp.
| SettingTable _difficulty_settings { _difficulty_settings_table } |
Definition at line 67 of file settings_table.cpp.
| SettingTable _economy_settings { _economy_settings_table } |
Definition at line 69 of file settings_table.cpp.
| SettingTable _game_settings { _game_settings_table } |
Definition at line 70 of file settings_table.cpp.
| SettingTable _gui_settings { _gui_settings_table } |
Definition at line 71 of file settings_table.cpp.
| SettingTable _linkgraph_settings { _linkgraph_settings_table } |
Definition at line 72 of file settings_table.cpp.
| SettingTable _locale_settings { _locale_settings_table } |
Definition at line 73 of file settings_table.cpp.
| SettingTable _misc_settings { _misc_settings_table } |
Definition at line 74 of file settings_table.cpp.
| SettingTable _multimedia_settings { _multimedia_settings_table } |
Definition at line 68 of file settings_table.cpp.
| SettingTable _network_private_settings { _network_private_settings_table } |
Definition at line 75 of file settings_table.cpp.
| SettingTable _network_secrets_settings { _network_secrets_settings_table } |
Definition at line 76 of file settings_table.cpp.
| SettingTable _network_settings { _network_settings_table } |
Definition at line 77 of file settings_table.cpp.
| SettingTable _news_display_settings { _news_display_settings_table } |
Definition at line 78 of file settings_table.cpp.
| SettingTable _old_gameopt_settings { _old_gameopt_settings_table } |
Definition at line 79 of file settings_table.cpp.
| SettingTable _pathfinding_settings { _pathfinding_settings_table } |
Definition at line 80 of file settings_table.cpp.
| SettingTable _script_settings { _script_settings_table } |
Definition at line 81 of file settings_table.cpp.
| SettingTable _window_settings { _window_settings_table } |
Definition at line 82 of file settings_table.cpp.
| SettingTable _world_settings { _world_settings_table } |
Definition at line 83 of file settings_table.cpp.