OpenTTD Source  14.0-beta1
settings_table.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
12 #include "stdafx.h"
13 #include "settings_table.h"
14 #include "currency.h"
15 #include "screenshot.h"
16 #include "network/network.h"
17 #include "network/network_func.h"
18 #include "network/core/config.h"
20 #include "genworld.h"
21 #include "train.h"
22 #include "news_func.h"
23 #include "window_func.h"
24 #include "company_func.h"
26 #if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA)
27 #define HAS_TRUETYPE_FONT
28 #include "fontcache.h"
29 #endif
30 #include "textbuf_gui.h"
31 #include "rail_gui.h"
32 #include "elrail_func.h"
33 #include "error.h"
34 #include "town.h"
35 #include "video/video_driver.hpp"
36 #include "sound/sound_driver.hpp"
37 #include "music/music_driver.hpp"
38 #include "blitter/factory.hpp"
39 #include "base_media_base.h"
40 #include "ai/ai_config.hpp"
41 #include "ai/ai.hpp"
42 #include "game/game_config.hpp"
43 #include "ship.h"
44 #include "smallmap_gui.h"
45 #include "roadveh.h"
46 #include "roadveh_cmd.h"
47 #include "vehicle_func.h"
48 #include "viewport_func.h"
49 #include "void_map.h"
50 #include "station_func.h"
51 #include "station_base.h"
52 
53 #include "table/strings.h"
54 #include "table/settings.h"
55 
56 #include "safeguards.h"
57 
58 SettingTable _company_settings{ _company_settings_table };
59 SettingTable _currency_settings{ _currency_settings_table };
60 SettingTable _difficulty_settings{ _difficulty_settings_table };
61 SettingTable _multimedia_settings{ _multimedia_settings_table };
62 SettingTable _economy_settings{ _economy_settings_table };
63 SettingTable _game_settings{ _game_settings_table };
64 SettingTable _gui_settings{ _gui_settings_table };
65 SettingTable _linkgraph_settings{ _linkgraph_settings_table };
66 SettingTable _locale_settings{ _locale_settings_table };
67 SettingTable _misc_settings{ _misc_settings_table };
68 SettingTable _network_private_settings{ _network_private_settings_table };
69 SettingTable _network_secrets_settings{ _network_secrets_settings_table };
70 SettingTable _network_settings{ _network_settings_table };
71 SettingTable _news_display_settings{ _news_display_settings_table };
72 SettingTable _old_gameopt_settings{ _old_gameopt_settings_table };
73 SettingTable _pathfinding_settings{ _pathfinding_settings_table };
74 SettingTable _script_settings{ _script_settings_table };
75 SettingTable _window_settings{ _window_settings_table };
76 SettingTable _world_settings{ _world_settings_table };
77 #if defined(_WIN32) && !defined(DEDICATED)
78 SettingTable _win32_settings{ _win32_settings_table };
79 #endif /* _WIN32 */
80 
81 
82 /* Begin - Callback Functions for the various settings. */
83 
86 {
87  return TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU) ? sd.str + 1 : sd.str;
88 }
89 
92 {
93  return TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU) ? sd.str_help + 1 : sd.str_help;
94 }
95 
97 static void SettingsValueVelocityUnit(const IntSettingDesc &, uint first_param, int32_t value)
98 {
99  StringID val;
100  switch (value) {
101  case 0: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL; break;
102  case 1: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC; break;
103  case 2: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI; break;
104  case 3: val = TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU) ? STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS_SECS : STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS_DAYS; break;
105  case 4: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS; break;
106  default: NOT_REACHED();
107  }
108  SetDParam(first_param, val);
109 }
110 
112 static void SettingsValueAbsolute(const IntSettingDesc &sd, uint first_param, int32_t value)
113 {
114  SetDParam(first_param, sd.str_val + ((value >= 0) ? 1 : 0));
115  SetDParam(first_param + 1, abs(value));
116 }
117 
119 static void v_PositionMainToolbar(int32_t)
120 {
121  if (_game_mode != GM_MENU) PositionMainToolbar(nullptr);
122 }
123 
125 static void v_PositionStatusbar(int32_t)
126 {
127  if (_game_mode != GM_MENU) {
128  PositionStatusbar(nullptr);
129  PositionNewsMessage(nullptr);
130  PositionNetworkChatWindow(nullptr);
131  }
132 }
133 
137 static void RedrawSmallmap(int32_t)
138 {
139  BuildLandLegend();
142 }
143 
145 static void UpdateLinkgraphColours(int32_t)
146 {
149 }
150 
151 static void StationSpreadChanged(int32_t)
152 {
155 }
156 
157 static void UpdateConsists(int32_t)
158 {
159  for (Train *t : Train::Iterate()) {
160  /* Update the consist of all trains so the maximum speed is set correctly. */
161  if (t->IsFrontEngine() || t->IsFreeWagon()) t->ConsistChanged(CCF_TRACK);
162  }
164 }
165 
170 static void UpdateAllServiceInterval(int32_t new_value)
171 {
172  bool update_vehicles;
174  if (_game_mode == GM_MENU || !Company::IsValidID(_current_company)) {
176  update_vehicles = false;
177  } else {
178  vds = &Company::Get(_current_company)->settings.vehicle;
179  update_vehicles = true;
180  }
181 
182  if (new_value != 0) {
183  /* Service intervals are in percents. */
184  vds->servint_trains = DEF_SERVINT_PERCENT;
185  vds->servint_roadveh = DEF_SERVINT_PERCENT;
186  vds->servint_aircraft = DEF_SERVINT_PERCENT;
187  vds->servint_ships = DEF_SERVINT_PERCENT;
188  } else if (TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU)) {
189  /* Service intervals are in minutes. */
190  vds->servint_trains = DEF_SERVINT_MINUTES_TRAINS;
191  vds->servint_roadveh = DEF_SERVINT_MINUTES_ROADVEH;
192  vds->servint_aircraft = DEF_SERVINT_MINUTES_AIRCRAFT;
193  vds->servint_ships = DEF_SERVINT_MINUTES_SHIPS;
194  } else {
195  /* Service intervals are in days. */
196  vds->servint_trains = DEF_SERVINT_DAYS_TRAINS;
197  vds->servint_roadveh = DEF_SERVINT_DAYS_ROADVEH;
198  vds->servint_aircraft = DEF_SERVINT_DAYS_AIRCRAFT;
199  vds->servint_ships = DEF_SERVINT_DAYS_SHIPS;
200  }
201 
202  if (update_vehicles) {
204  for (Vehicle *v : Vehicle::Iterate()) {
205  if (v->owner == _current_company && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
206  v->SetServiceInterval(CompanyServiceInterval(c, v->type));
207  v->SetServiceIntervalIsPercent(new_value != 0);
208  }
209  }
210  }
211 
213 }
214 
215 static bool CanUpdateServiceInterval(VehicleType, int32_t &new_value)
216 {
218  if (_game_mode == GM_MENU || !Company::IsValidID(_current_company)) {
220  } else {
221  vds = &Company::Get(_current_company)->settings.vehicle;
222  }
223 
224  /* Test if the interval is valid */
225  int32_t interval = GetServiceIntervalClamped(new_value, vds->servint_ispercent);
226  return interval == new_value;
227 }
228 
229 static void UpdateServiceInterval(VehicleType type, int32_t new_value)
230 {
231  if (_game_mode != GM_MENU && Company::IsValidID(_current_company)) {
232  for (Vehicle *v : Vehicle::Iterate()) {
233  if (v->owner == _current_company && v->type == type && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
234  v->SetServiceInterval(new_value);
235  }
236  }
237  }
238 
240 }
241 
242 static void TrainAccelerationModelChanged(int32_t)
243 {
244  for (Train *t : Train::Iterate()) {
245  if (t->IsFrontEngine()) {
246  t->tcache.cached_max_curve_speed = t->GetCurveSpeedLimit();
247  t->UpdateAcceleration();
248  }
249  }
250 
251  /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
255 }
256 
260 static void TrainSlopeSteepnessChanged(int32_t)
261 {
262  for (Train *t : Train::Iterate()) {
263  if (t->IsFrontEngine()) t->CargoChanged();
264  }
265 }
266 
271 {
273  for (RoadVehicle *rv : RoadVehicle::Iterate()) {
274  if (rv->IsFrontEngine()) {
275  rv->CargoChanged();
276  }
277  }
278  }
279 
280  /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
284 }
285 
289 static void RoadVehSlopeSteepnessChanged(int32_t)
290 {
291  for (RoadVehicle *rv : RoadVehicle::Iterate()) {
292  if (rv->IsFrontEngine()) rv->CargoChanged();
293  }
294 }
295 
296 static void TownFoundingChanged(int32_t)
297 {
298  if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {
300  } else {
302  }
303 }
304 
305 static void ZoomMinMaxChanged(int32_t)
306 {
307  ConstrainAllViewportsZoom();
310  if (AdjustGUIZoom(false)) {
311  ReInitAllWindows(true);
312  }
313 }
314 
315 static void SpriteZoomMinChanged(int32_t)
316 {
318  /* Force all sprites to redraw at the new chosen zoom level */
320 }
321 
327 static void InvalidateNewGRFChangeWindows(int32_t)
328 {
331  ReInitAllWindows(false);
332 }
333 
334 static void InvalidateCompanyLiveryWindow(int32_t)
335 {
337  ResetVehicleColourMap();
338 }
339 
340 static void DifficultyNoiseChange(int32_t)
341 {
342  if (_game_mode == GM_NORMAL) {
346  }
347  }
348 }
349 
350 static void MaxNoAIsChange(int32_t)
351 {
352  if (GetGameSettings().difficulty.max_no_competitors != 0 &&
353  AI::GetInfoList()->empty() &&
355  ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, WL_CRITICAL);
356  }
357 
359 }
360 
365 static bool CheckRoadSide(int32_t &)
366 {
367  return _game_mode == GM_MENU || !RoadVehiclesAreBuilt();
368 }
369 
377 static size_t ConvertLandscape(const char *value)
378 {
379  /* try with the old values */
380  static std::vector<std::string> _old_landscape_values{"normal", "hilly", "desert", "candy"};
381  return OneOfManySettingDesc::ParseSingleValue(value, strlen(value), _old_landscape_values);
382 }
383 
384 static bool CheckFreeformEdges(int32_t &new_value)
385 {
386  if (_game_mode == GM_MENU) return true;
387  if (new_value != 0) {
388  for (Ship *s : Ship::Iterate()) {
389  /* Check if there is a ship on the northern border. */
390  if (TileX(s->tile) == 0 || TileY(s->tile) == 0) {
391  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
392  return false;
393  }
394  }
395  for (const BaseStation *st : BaseStation::Iterate()) {
396  /* Check if there is a non-deleted buoy on the northern border. */
397  if (st->IsInUse() && (TileX(st->xy) == 0 || TileY(st->xy) == 0)) {
398  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
399  return false;
400  }
401  }
402  } else {
403  for (uint i = 0; i < Map::MaxX(); i++) {
404  if (TileHeight(TileXY(i, 1)) != 0) {
405  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
406  return false;
407  }
408  }
409  for (uint i = 1; i < Map::MaxX(); i++) {
410  if (!IsTileType(TileXY(i, Map::MaxY() - 1), MP_WATER) || TileHeight(TileXY(1, Map::MaxY())) != 0) {
411  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
412  return false;
413  }
414  }
415  for (uint i = 0; i < Map::MaxY(); i++) {
416  if (TileHeight(TileXY(1, i)) != 0) {
417  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
418  return false;
419  }
420  }
421  for (uint i = 1; i < Map::MaxY(); i++) {
422  if (!IsTileType(TileXY(Map::MaxX() - 1, i), MP_WATER) || TileHeight(TileXY(Map::MaxX(), i)) != 0) {
423  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
424  return false;
425  }
426  }
427  }
428  return true;
429 }
430 
431 static void UpdateFreeformEdges(int32_t new_value)
432 {
433  if (_game_mode == GM_MENU) return;
434 
435  if (new_value != 0) {
436  for (uint x = 0; x < Map::SizeX(); x++) MakeVoid(TileXY(x, 0));
437  for (uint y = 0; y < Map::SizeY(); y++) MakeVoid(TileXY(0, y));
438  } else {
439  /* Make tiles at the border water again. */
440  for (uint i = 0; i < Map::MaxX(); i++) {
441  SetTileHeight(TileXY(i, 0), 0);
442  SetTileType(TileXY(i, 0), MP_WATER);
443  }
444  for (uint i = 0; i < Map::MaxY(); i++) {
445  SetTileHeight(TileXY(0, i), 0);
446  SetTileType(TileXY(0, i), MP_WATER);
447  }
448  }
450 }
451 
456 static bool CheckDynamicEngines(int32_t &)
457 {
458  if (_game_mode == GM_MENU) return true;
459 
461  ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, WL_ERROR);
462  return false;
463  }
464 
465  return true;
466 }
467 
468 static bool CheckMaxHeightLevel(int32_t &new_value)
469 {
470  if (_game_mode == GM_NORMAL) return false;
471  if (_game_mode != GM_EDITOR) return true;
472 
473  /* Check if at least one mountain on the map is higher than the new value.
474  * If yes, disallow the change. */
475  for (TileIndex t = 0; t < Map::Size(); t++) {
476  if ((int32_t)TileHeight(t) > new_value) {
477  ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, WL_ERROR);
478  /* Return old, unchanged value */
479  return false;
480  }
481  }
482 
483  return true;
484 }
485 
486 static void StationCatchmentChanged(int32_t)
487 {
490 }
491 
492 static void MaxVehiclesChanged(int32_t)
493 {
496 }
497 
498 static void InvalidateShipPathCache(int32_t)
499 {
500  for (Ship *s : Ship::Iterate()) {
501  s->path.clear();
502  }
503 }
504 
510 static bool ReplaceAsteriskWithEmptyPassword(std::string &newval)
511 {
512  if (newval.compare("*") == 0) newval.clear();
513  return true;
514 }
515 
518 {
520 
521  if (_network_server) {
524  }
525 }
526 
531 static void ChangeTimekeepingUnits(int32_t)
532 {
533  /* If service intervals are in time units (calendar days or real-world minutes), reset them to the correct defaults. */
536  }
537 
538  /* If we are using calendar timekeeping, "minutes per year" must be default. */
540  _settings_newgame.economy.minutes_per_calendar_year = CalendarTime::DEF_MINUTES_PER_YEAR;
541  }
542 
544 }
545 
550 static void ChangeMinutesPerYear(int32_t new_value)
551 {
552  /* We don't allow setting Minutes Per Year below default, unless it's to 0 for frozen calendar time. */
553  if (new_value < CalendarTime::DEF_MINUTES_PER_YEAR) {
554  int clamped;
555 
556  /* If the new value is 1, we're probably at 0 and trying to increase the value, so we should jump up to default. */
557  if (new_value == 1) {
558  clamped = CalendarTime::DEF_MINUTES_PER_YEAR;
559  } else {
560  clamped = CalendarTime::FROZEN_MINUTES_PER_YEAR;
561  }
562 
563  /* Override the setting with the clamped value. */
564  if (_game_mode == GM_MENU) {
566  } else {
568  }
569  }
570 
571  /* If the setting value is not the default, force the game to use wallclock timekeeping units.
572  * This can only happen in the menu, since the pre_cb ensures this setting can only be changed there, or if we're already using wallclock units.
573  */
574  if (_game_mode == GM_MENU && (_settings_newgame.economy.minutes_per_calendar_year != CalendarTime::DEF_MINUTES_PER_YEAR)) {
577  }
578 }
579 
585 static bool CanChangeTimetableMode(int32_t &)
586 {
588 }
589 
590 /* End - Callback Functions */
RoadVehicle
Buses, trucks and trams belong to this class.
Definition: roadveh.h:106
TileY
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
Definition: map_func.h:437
WC_SAVELOAD
@ WC_SAVELOAD
Saveload window; Window numbers:
Definition: window_type.h:144
BuildOwnerLegend
void BuildOwnerLegend()
Completes the array for the owned property legend.
Definition: smallmap_gui.cpp:343
InvalidateWindowData
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Definition: window.cpp:3200
CloseWindowByClass
void CloseWindowByClass(WindowClass cls, int data)
Close all windows of a given class.
Definition: window.cpp:1153
factory.hpp
EngineOverrideManager::ResetToCurrentNewGRFConfig
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
Definition: engine.cpp:547
Pool::PoolItem<&_company_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:335
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:73
train.h
ShowErrorMessage
void ShowErrorMessage(StringID summary_msg, int x, int y, CommandCost cc)
Display an error message in a window.
Definition: error_gui.cpp:367
PositionMainToolbar
int PositionMainToolbar(Window *w)
(Re)position main toolbar window at the screen.
Definition: window.cpp:3370
smallmap_gui.h
CheckDynamicEngines
static bool CheckDynamicEngines(int32_t &)
Changing the setting "allow multiple NewGRF sets" is not allowed if there are vehicles.
Definition: settings_table.cpp:456
Map::MaxX
static debug_inline uint MaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
Definition: map_func.h:297
timer_game_calendar.h
WC_COMPANY_COLOUR
@ WC_COMPANY_COLOUR
Company colour selection; Window numbers:
Definition: window_type.h:230
WC_FOUND_TOWN
@ WC_FOUND_TOWN
Found a town; Window numbers:
Definition: window_type.h:429
currency.h
elrail_func.h
TF_FORBIDDEN
@ TF_FORBIDDEN
Forbidden.
Definition: town_type.h:96
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
_network_server
bool _network_server
network-server is active
Definition: network.cpp:60
WC_ENGINE_PREVIEW
@ WC_ENGINE_PREVIEW
Engine preview window; Window numbers:
Definition: window_type.h:595
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Definition: window.cpp:1141
WC_CLIENT_LIST
@ WC_CLIENT_LIST
Client list; Window numbers:
Definition: window_type.h:478
CanChangeTimetableMode
static bool CanChangeTimetableMode(int32_t &)
Pre-callback check when trying to change the timetable mode.
Definition: settings_table.cpp:585
SetTileHeight
void SetTileHeight(Tile tile, uint height)
Sets the height of a tile.
Definition: tile_map.h:57
ship.h
UpdateAllServiceInterval
static void UpdateAllServiceInterval(int32_t new_value)
Check and update if needed all vehicle service intervals.
Definition: settings_table.cpp:170
void_map.h
SettingsValueVelocityUnit
static void SettingsValueVelocityUnit(const IntSettingDesc &, uint first_param, int32_t value)
Setting values for velocity unit localisation.
Definition: settings_table.cpp:97
CompanySettings::vehicle
VehicleDefaultSettings vehicle
default settings for vehicles
Definition: settings_type.h:613
UpdateLinkgraphColours
static void UpdateLinkgraphColours(int32_t)
Redraw linkgraph links after a colour scheme change.
Definition: settings_table.cpp:145
EconomySettings::timekeeping_units
TimekeepingUnits timekeeping_units
time units to use for the game economy, either calendar or wallclock
Definition: settings_type.h:561
base_media_base.h
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:54
TimerGameEconomy::UsingWallclockUnits
static bool UsingWallclockUnits(bool newgame=false)
Check if we are using wallclock units.
Definition: timer_game_economy.cpp:97
town.h
ConvertLandscape
static size_t ConvertLandscape(const char *value)
Conversion callback for _gameopt_settings_game.landscape It converts (or try) between old values and ...
Definition: settings_table.cpp:377
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
WC_BUILD_STATION
@ WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:397
ChangeTimekeepingUnits
static void ChangeTimekeepingUnits(int32_t)
Callback for when the player changes the timekeeping units.
Definition: settings_table.cpp:531
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:240
UpdateClientConfigValues
static void UpdateClientConfigValues()
Update the game info, and send it to the clients when we are running as a server.
Definition: settings_table.cpp:517
RedrawSmallmap
static void RedrawSmallmap(int32_t)
Redraw the smallmap after a colour scheme change.
Definition: settings_table.cpp:137
genworld.h
textbuf_gui.h
EconomySettings::minutes_per_calendar_year
uint16_t minutes_per_calendar_year
minutes per calendar year. Special value 0 means that calendar time is frozen.
Definition: settings_type.h:562
ChangeMinutesPerYear
static void ChangeMinutesPerYear(int32_t new_value)
Callback after the player changes the minutes per year.
Definition: settings_table.cpp:550
ai.hpp
screenshot.h
AdjustGUIZoom
bool AdjustGUIZoom(bool automatic)
Resolve GUI zoom level and adjust GUI to new zoom, if auto-suggestion is requested.
Definition: gfx.cpp:1814
GetServiceIntervalClamped
uint16_t GetServiceIntervalClamped(int interval, bool ispercent)
Clamp the service interval to the correct min/max.
Definition: order_cmd.cpp:1906
PositionStatusbar
int PositionStatusbar(Window *w)
(Re)position statusbar window at the screen.
Definition: window.cpp:3381
RoadVehiclesAreBuilt
bool RoadVehiclesAreBuilt()
Verify whether a road vehicle is available.
Definition: road_cmd.cpp:179
PositionNewsMessage
int PositionNewsMessage(Window *w)
(Re)position news message window at the screen.
Definition: window.cpp:3392
EconomySettings::station_noise_level
bool station_noise_level
build new airports when the town noise level is still within accepted limits
Definition: settings_type.h:557
IntSettingDesc::str_val
StringID str_val
(Translated) first string describing the value.
Definition: settings_internal.h:212
ReInitAllWindows
void ReInitAllWindows(bool zoom_changed)
Re-initialize all windows.
Definition: window.cpp:3316
GfxClearSpriteCache
void GfxClearSpriteCache()
Remove all encoded sprites from the sprite cache without discarding sprite location information.
Definition: spritecache.cpp:1036
Station::RecomputeCatchmentForAll
static void RecomputeCatchmentForAll()
Recomputes catchment of all stations.
Definition: station.cpp:523
IntSettingDesc
Base integer type, including boolean, settings.
Definition: settings_internal.h:143
MP_WATER
@ MP_WATER
Water tile.
Definition: tile_type.h:54
UpdateAirportsNoise
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Definition: station_cmd.cpp:2363
MakeVoid
void MakeVoid(Tile t)
Make a nice void tile ;)
Definition: void_map.h:19
station_func.h
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:55
WC_VEHICLE_DETAILS
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
Definition: window_type.h:200
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:628
safeguards.h
AI::GetInfoList
static const ScriptInfoList * GetInfoList()
Wrapper function for AIScanner::GetAIInfoList.
Definition: ai_core.cpp:303
music_driver.hpp
Train
'Train' is either a loco or a wagon.
Definition: train.h:89
VehicleDefaultSettings::servint_aircraft
uint16_t servint_aircraft
service interval for aircraft
Definition: settings_type.h:603
_networking
bool _networking
are we in networking mode?
Definition: network.cpp:59
v_PositionMainToolbar
static void v_PositionMainToolbar(int32_t)
Reposition the main toolbar as the setting changed.
Definition: settings_table.cpp:119
VehicleDefaultSettings
Default settings for vehicles.
Definition: settings_type.h:599
EconomySettings::found_town
TownFounding found_town
town founding.
Definition: settings_type.h:556
error.h
stdafx.h
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
settings_table.h
viewport_func.h
pathfinder_type.h
sound_driver.hpp
VehicleSettings::roadveh_acceleration_model
uint8_t roadveh_acceleration_model
realistic acceleration for road vehicles
Definition: settings_type.h:519
Map::SizeX
static debug_inline uint SizeX()
Get the size of the map along the X.
Definition: map_func.h:270
InvalidateNewGRFChangeWindows
static void InvalidateNewGRFChangeWindows(int32_t)
Update any possible saveload window and delete any newgrf dialogue as its widget parts might change.
Definition: settings_table.cpp:327
rail_gui.h
IntSettingDesc::str_help
StringID str_help
(Translated) string with help text; gui only.
Definition: settings_internal.h:211
Ship
All ships have this type.
Definition: ship.h:24
_current_company
CompanyID _current_company
Company currently doing an action.
Definition: company_cmd.cpp:50
vehicle_func.h
WC_GAME_OPTIONS
@ WC_GAME_OPTIONS
Game options window; Window numbers:
Definition: window_type.h:619
WC_SELECT_STATION
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:242
station_base.h
CheckRoadSide
static bool CheckRoadSide(int32_t &)
Check whether the road side may be changed.
Definition: settings_table.cpp:365
Pool::PoolItem<&_vehicle_pool >::Iterate
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition: pool_type.hpp:384
Map::MaxY
static uint MaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
Definition: map_func.h:306
SettingTitleWallclock
static StringID SettingTitleWallclock(const IntSettingDesc &sd)
Switch setting title depending on wallclock setting.
Definition: settings_table.cpp:85
NetworkServerSendConfigUpdate
void NetworkServerSendConfigUpdate()
Send Config Update.
Definition: network_server.cpp:2029
WC_BUILD_VEHICLE
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
Definition: window_type.h:383
abs
constexpr T abs(const T a)
Returns the absolute value of (scalar) variable.
Definition: math_func.hpp:23
Map::Size
static debug_inline uint Size()
Get the size of the map.
Definition: map_func.h:288
video_driver.hpp
SetDParam
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings.cpp:104
CompanyServiceInterval
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
Definition: company_cmd.cpp:1190
InvalidateWindowClassesData
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Definition: window.cpp:3217
IntSettingDesc::str
StringID str
(translated) string with descriptive text; gui and console
Definition: settings_internal.h:210
SetTileType
void SetTileType(Tile tile, TileType type)
Set the type of a tile.
Definition: tile_map.h:131
BaseStation
Base class for all station-ish types.
Definition: base_station_base.h:64
VehicleDefaultSettings::servint_trains
uint16_t servint_trains
service interval for trains
Definition: settings_type.h:601
company_func.h
WL_ERROR
@ WL_ERROR
Errors (eg. saving/loading failed)
Definition: error.h:26
SpecializedVehicle< Train, Type >::Iterate
static Pool::IterateWrapper< Train > Iterate(size_t from=0)
Returns an iterable ensemble of all valid vehicles of type T.
Definition: vehicle_base.h:1270
SettingHelpWallclock
static StringID SettingHelpWallclock(const IntSettingDesc &sd)
Switch setting help depending on wallclock setting.
Definition: settings_table.cpp:91
SettingsValueAbsolute
static void SettingsValueAbsolute(const IntSettingDesc &sd, uint first_param, int32_t value)
A negative value has another string (the one after "strval").
Definition: settings_table.cpp:112
network.h
VehicleDefaultSettings::servint_ships
uint16_t servint_ships
service interval for ships
Definition: settings_type.h:604
VehicleDefaultSettings::servint_ispercent
bool servint_ispercent
service intervals are in percents
Definition: settings_type.h:600
window_func.h
v_PositionStatusbar
static void v_PositionStatusbar(int32_t)
Reposition the statusbar as the setting changed.
Definition: settings_table.cpp:125
MarkWholeScreenDirty
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1552
TileXY
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
Definition: map_func.h:385
TileHeight
static debug_inline uint TileHeight(Tile tile)
Returns the height of a tile.
Definition: tile_map.h:29
ReplaceAsteriskWithEmptyPassword
static bool ReplaceAsteriskWithEmptyPassword(std::string &newval)
Replace a passwords that are a literal asterisk with an empty string.
Definition: settings_table.cpp:510
config.h
fontcache.h
WC_TOWN_VIEW
@ WC_TOWN_VIEW
Town view; Window numbers:
Definition: window_type.h:333
GetGameSettings
GameSettings & GetGameSettings()
Get the settings-object applicable for the current situation: the newgame settings when we're in the ...
Definition: settings_type.h:660
ClientSettings::company
CompanySettings company
default values for per-company settings
Definition: settings_type.h:638
PositionNetworkChatWindow
int PositionNetworkChatWindow(Window *w)
(Re)position network chat window at the screen.
Definition: window.cpp:3403
CCF_TRACK
@ CCF_TRACK
Valid changes while vehicle is driving, and possibly changing tracks.
Definition: train.h:48
GameSettings::vehicle
VehicleSettings vehicle
options for vehicles
Definition: settings_type.h:627
RoadVehAccelerationModelChanged
static void RoadVehAccelerationModelChanged(int32_t)
This function updates realistic acceleration caches when the setting "Road vehicle acceleration model...
Definition: settings_table.cpp:270
IsTileType
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Definition: tile_map.h:150
Pool::PoolItem<&_company_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:324
RoadVehSlopeSteepnessChanged
static void RoadVehSlopeSteepnessChanged(int32_t)
This function updates the road vehicle acceleration cache after a steepness change.
Definition: settings_table.cpp:289
TileX
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
Definition: map_func.h:427
TrainSlopeSteepnessChanged
static void TrainSlopeSteepnessChanged(int32_t)
This function updates the train acceleration cache after a steepness change.
Definition: settings_table.cpp:260
Company
Definition: company_base.h:116
game_config.hpp
WC_SPRITE_ALIGNER
@ WC_SPRITE_ALIGNER
Sprite aligner (debug); Window numbers:
Definition: window_type.h:681
SetWindowClassesDirty
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
Definition: window.cpp:3108
NetworkServerUpdateGameInfo
void NetworkServerUpdateGameInfo()
Update the server's NetworkServerGameInfo due to changes in settings.
Definition: network_server.cpp:2037
BuildLinkStatsLegend
void BuildLinkStatsLegend()
Populate legend table for the link stat view.
Definition: smallmap_gui.cpp:216
VehicleDefaultSettings::servint_roadveh
uint16_t servint_roadveh
service interval for road vehicles
Definition: settings_type.h:602
WC_SMALLMAP
@ WC_SMALLMAP
Small map; Window numbers:
Definition: window_type.h:104
roadveh_cmd.h
network_func.h
_settings_newgame
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
Definition: settings.cpp:56
INVALID_STRING_ID
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Definition: strings_type.h:17
Map::SizeY
static uint SizeY()
Get the size of the map along the Y.
Definition: map_func.h:279
OneOfManySettingDesc::ParseSingleValue
static size_t ParseSingleValue(const char *str, size_t len, const std::vector< std::string > &many)
Find the index value of a ONEofMANY type in a string separated by |.
Definition: settings.cpp:179
WL_CRITICAL
@ WL_CRITICAL
Critical errors, the MessageBox is shown in all cases.
Definition: error.h:27
BuildLandLegend
void BuildLandLegend()
(Re)build the colour tables for the legends.
Definition: smallmap_gui.cpp:292
ai_config.hpp
news_func.h
roadveh.h