OpenTTD Source  12.2
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"
25 #if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA)
26 #define HAS_TRUETYPE_FONT
27 #include "fontcache.h"
28 #endif
29 #include "textbuf_gui.h"
30 #include "rail_gui.h"
31 #include "elrail_func.h"
32 #include "error.h"
33 #include "town.h"
34 #include "video/video_driver.hpp"
35 #include "sound/sound_driver.hpp"
36 #include "music/music_driver.hpp"
37 #include "blitter/factory.hpp"
38 #include "base_media_base.h"
39 #include "ai/ai_config.hpp"
40 #include "ai/ai.hpp"
41 #include "game/game_config.hpp"
42 #include "ship.h"
43 #include "smallmap_gui.h"
44 #include "roadveh.h"
45 #include "vehicle_func.h"
46 #include "void_map.h"
47 
48 #include "table/strings.h"
49 #include "table/settings.h"
50 
51 #include "safeguards.h"
52 
53 SettingTable _company_settings{ _company_settings_table };
54 SettingTable _currency_settings{ _currency_settings_table };
55 SettingTable _difficulty_settings{ _difficulty_settings_table };
56 SettingTable _multimedia_settings{ _multimedia_settings_table };
57 SettingTable _economy_settings{ _economy_settings_table };
58 SettingTable _game_settings{ _game_settings_table };
59 SettingTable _gui_settings{ _gui_settings_table };
60 SettingTable _linkgraph_settings{ _linkgraph_settings_table };
61 SettingTable _locale_settings{ _locale_settings_table };
62 SettingTable _misc_settings{ _misc_settings_table };
63 SettingTable _network_private_settings{ _network_private_settings_table };
64 SettingTable _network_secrets_settings{ _network_secrets_settings_table };
65 SettingTable _network_settings{ _network_settings_table };
66 SettingTable _news_display_settings{ _news_display_settings_table };
67 SettingTable _old_gameopt_settings{ _old_gameopt_settings_table };
68 SettingTable _pathfinding_settings{ _pathfinding_settings_table };
69 SettingTable _script_settings{ _script_settings_table };
70 SettingTable _window_settings{ _window_settings_table };
71 SettingTable _world_settings{ _world_settings_table };
72 #if defined(_WIN32) && !defined(DEDICATED)
73 SettingTable _win32_settings{ _win32_settings_table };
74 #endif /* _WIN32 */
75 
76 
77 /* Begin - Callback Functions for the various settings. */
78 
80 static void v_PositionMainToolbar(int32 new_value)
81 {
82  if (_game_mode != GM_MENU) PositionMainToolbar(nullptr);
83 }
84 
86 static void v_PositionStatusbar(int32 new_value)
87 {
88  if (_game_mode != GM_MENU) {
89  PositionStatusbar(nullptr);
90  PositionNewsMessage(nullptr);
92  }
93 }
94 
99 static void RedrawSmallmap(int32 new_value)
100 {
101  BuildLandLegend();
104 }
105 
106 static void StationSpreadChanged(int32 p1)
107 {
110 }
111 
112 static void UpdateConsists(int32 new_value)
113 {
114  for (Train *t : Train::Iterate()) {
115  /* Update the consist of all trains so the maximum speed is set correctly. */
116  if (t->IsFrontEngine() || t->IsFreeWagon()) t->ConsistChanged(CCF_TRACK);
117  }
119 }
120 
121 /* Check service intervals of vehicles, newvalue is value of % or day based servicing */
122 static void UpdateAllServiceInterval(int32 new_value)
123 {
124  bool update_vehicles;
126  if (_game_mode == GM_MENU || !Company::IsValidID(_current_company)) {
128  update_vehicles = false;
129  } else {
130  vds = &Company::Get(_current_company)->settings.vehicle;
131  update_vehicles = true;
132  }
133 
134  if (new_value != 0) {
135  vds->servint_trains = 50;
136  vds->servint_roadveh = 50;
137  vds->servint_aircraft = 50;
138  vds->servint_ships = 50;
139  } else {
140  vds->servint_trains = 150;
141  vds->servint_roadveh = 150;
142  vds->servint_aircraft = 100;
143  vds->servint_ships = 360;
144  }
145 
146  if (update_vehicles) {
148  for (Vehicle *v : Vehicle::Iterate()) {
149  if (v->owner == _current_company && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
150  v->SetServiceInterval(CompanyServiceInterval(c, v->type));
151  v->SetServiceIntervalIsPercent(new_value != 0);
152  }
153  }
154  }
155 
157 }
158 
159 static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value)
160 {
162  if (_game_mode == GM_MENU || !Company::IsValidID(_current_company)) {
164  } else {
165  vds = &Company::Get(_current_company)->settings.vehicle;
166  }
167 
168  /* Test if the interval is valid */
169  int32 interval = GetServiceIntervalClamped(new_value, vds->servint_ispercent);
170  return interval == new_value;
171 }
172 
173 static void UpdateServiceInterval(VehicleType type, int32 new_value)
174 {
175  if (_game_mode != GM_MENU && Company::IsValidID(_current_company)) {
176  for (Vehicle *v : Vehicle::Iterate()) {
177  if (v->owner == _current_company && v->type == type && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
178  v->SetServiceInterval(new_value);
179  }
180  }
181  }
182 
184 }
185 
186 static void TrainAccelerationModelChanged(int32 new_value)
187 {
188  for (Train *t : Train::Iterate()) {
189  if (t->IsFrontEngine()) {
190  t->tcache.cached_max_curve_speed = t->GetCurveSpeedLimit();
191  t->UpdateAcceleration();
192  }
193  }
194 
195  /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
199 }
200 
205 static void TrainSlopeSteepnessChanged(int32 new_value)
206 {
207  for (Train *t : Train::Iterate()) {
208  if (t->IsFrontEngine()) t->CargoChanged();
209  }
210 }
211 
216 static void RoadVehAccelerationModelChanged(int32 new_value)
217 {
219  for (RoadVehicle *rv : RoadVehicle::Iterate()) {
220  if (rv->IsFrontEngine()) {
221  rv->CargoChanged();
222  }
223  }
224  }
225 
226  /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
230 }
231 
236 static void RoadVehSlopeSteepnessChanged(int32 new_value)
237 {
238  for (RoadVehicle *rv : RoadVehicle::Iterate()) {
239  if (rv->IsFrontEngine()) rv->CargoChanged();
240  }
241 }
242 
243 static void TownFoundingChanged(int32 new_value)
244 {
245  if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {
247  } else {
249  }
250 }
251 
252 static void ZoomMinMaxChanged(int32 new_value)
253 {
254  extern void ConstrainAllViewportsZoom();
255  ConstrainAllViewportsZoom();
258  /* Restrict GUI zoom if it is no longer available. */
262  }
263 }
264 
265 static void SpriteZoomMinChanged(int32 new_value)
266 {
268  /* Force all sprites to redraw at the new chosen zoom level */
270 }
271 
278 static void InvalidateNewGRFChangeWindows(int32 new_value)
279 {
283 }
284 
285 static void InvalidateCompanyLiveryWindow(int32 new_value)
286 {
288  ResetVehicleColourMap();
289 }
290 
291 static void DifficultyNoiseChange(int32 new_value)
292 {
293  if (_game_mode == GM_NORMAL) {
297  }
298  }
299 }
300 
301 static void MaxNoAIsChange(int32 new_value)
302 {
303  if (GetGameSettings().difficulty.max_no_competitors != 0 &&
304  AI::GetInfoList()->size() == 0 &&
306  ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, WL_CRITICAL);
307  }
308 
310 }
311 
317 static bool CheckRoadSide(int32 &new_value)
318 {
319  extern bool RoadVehiclesAreBuilt();
320  return _game_mode == GM_MENU || !RoadVehiclesAreBuilt();
321 }
322 
330 static size_t ConvertLandscape(const char *value)
331 {
332  /* try with the old values */
333  static std::vector<std::string> _old_landscape_values{"normal", "hilly", "desert", "candy"};
334  return OneOfManySettingDesc::ParseSingleValue(value, strlen(value), _old_landscape_values);
335 }
336 
337 static bool CheckFreeformEdges(int32 &new_value)
338 {
339  if (_game_mode == GM_MENU) return true;
340  if (new_value != 0) {
341  for (Ship *s : Ship::Iterate()) {
342  /* Check if there is a ship on the northern border. */
343  if (TileX(s->tile) == 0 || TileY(s->tile) == 0) {
344  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
345  return false;
346  }
347  }
348  for (const BaseStation *st : BaseStation::Iterate()) {
349  /* Check if there is a non-deleted buoy on the northern border. */
350  if (st->IsInUse() && (TileX(st->xy) == 0 || TileY(st->xy) == 0)) {
351  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
352  return false;
353  }
354  }
355  } else {
356  for (uint i = 0; i < MapMaxX(); i++) {
357  if (TileHeight(TileXY(i, 1)) != 0) {
358  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
359  return false;
360  }
361  }
362  for (uint i = 1; i < MapMaxX(); i++) {
363  if (!IsTileType(TileXY(i, MapMaxY() - 1), MP_WATER) || TileHeight(TileXY(1, MapMaxY())) != 0) {
364  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
365  return false;
366  }
367  }
368  for (uint i = 0; i < MapMaxY(); i++) {
369  if (TileHeight(TileXY(1, i)) != 0) {
370  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
371  return false;
372  }
373  }
374  for (uint i = 1; i < MapMaxY(); i++) {
375  if (!IsTileType(TileXY(MapMaxX() - 1, i), MP_WATER) || TileHeight(TileXY(MapMaxX(), i)) != 0) {
376  ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
377  return false;
378  }
379  }
380  }
381  return true;
382 }
383 
384 static void UpdateFreeformEdges(int32 new_value)
385 {
386  if (_game_mode == GM_MENU) return;
387 
388  if (new_value != 0) {
389  for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0));
390  for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y));
391  } else {
392  /* Make tiles at the border water again. */
393  for (uint i = 0; i < MapMaxX(); i++) {
394  SetTileHeight(TileXY(i, 0), 0);
395  SetTileType(TileXY(i, 0), MP_WATER);
396  }
397  for (uint i = 0; i < MapMaxY(); i++) {
398  SetTileHeight(TileXY(0, i), 0);
399  SetTileType(TileXY(0, i), MP_WATER);
400  }
401  }
403 }
404 
409 static bool CheckDynamicEngines(int32 &new_value)
410 {
411  if (_game_mode == GM_MENU) return true;
412 
414  ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, WL_ERROR);
415  return false;
416  }
417 
418  return true;
419 }
420 
421 static bool CheckMaxHeightLevel(int32 &new_value)
422 {
423  if (_game_mode == GM_NORMAL) return false;
424  if (_game_mode != GM_EDITOR) return true;
425 
426  /* Check if at least one mountain on the map is higher than the new value.
427  * If yes, disallow the change. */
428  for (TileIndex t = 0; t < MapSize(); t++) {
429  if ((int32)TileHeight(t) > new_value) {
430  ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, WL_ERROR);
431  /* Return old, unchanged value */
432  return false;
433  }
434  }
435 
436  return true;
437 }
438 
439 static void StationCatchmentChanged(int32 new_value)
440 {
443 }
444 
445 static void MaxVehiclesChanged(int32 new_value)
446 {
449 }
450 
451 static void InvalidateShipPathCache(int32 new_value)
452 {
453  for (Ship *s : Ship::Iterate()) {
454  s->path.clear();
455  }
456 }
457 
463 static bool ReplaceAsteriskWithEmptyPassword(std::string &newval)
464 {
465  if (newval.compare("*") == 0) newval.clear();
466  return true;
467 }
468 
471 {
474 }
475 
476 /* End - Callback Functions */
LoadStringWidthTable
void LoadStringWidthTable(bool monospace)
Initialize _stringwidth_table cache.
Definition: gfx.cpp:1430
RoadVehicle
Buses, trucks and trams belong to this class.
Definition: roadveh.h:107
WC_SAVELOAD
@ WC_SAVELOAD
Saveload window; Window numbers:
Definition: window_type.h:136
BuildOwnerLegend
void BuildOwnerLegend()
Completes the array for the owned property legend.
Definition: smallmap_gui.cpp:326
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
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:3234
factory.hpp
EngineOverrideManager::ResetToCurrentNewGRFConfig
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
Definition: engine.cpp:513
Pool::PoolItem<&_company_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:337
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:65
GetServiceIntervalClamped
uint16 GetServiceIntervalClamped(uint interval, bool ispercent)
Clamp the service interval to the correct min/max.
Definition: order_cmd.cpp:1920
train.h
v_PositionMainToolbar
static void v_PositionMainToolbar(int32 new_value)
Reposition the main toolbar as the setting changed.
Definition: settings_table.cpp:80
PositionMainToolbar
int PositionMainToolbar(Window *w)
(Re)position main toolbar window at the screen.
Definition: window.cpp:3398
smallmap_gui.h
SetTileType
static void SetTileType(TileIndex tile, TileType type)
Set the type of a tile.
Definition: tile_map.h:131
WC_COMPANY_COLOUR
@ WC_COMPANY_COLOUR
Company colour selection; Window numbers:
Definition: window_type.h:222
WC_FOUND_TOWN
@ WC_FOUND_TOWN
Found a town; Window numbers:
Definition: window_type.h:421
currency.h
elrail_func.h
TF_FORBIDDEN
@ TF_FORBIDDEN
Forbidden.
Definition: town_type.h:94
_network_server
bool _network_server
network-server is active
Definition: network.cpp:58
WC_ENGINE_PREVIEW
@ WC_ENGINE_PREVIEW
Engine preview window; Window numbers:
Definition: window_type.h:581
TrainSlopeSteepnessChanged
static void TrainSlopeSteepnessChanged(int32 new_value)
This function updates the train acceleration cache after a steepness change.
Definition: settings_table.cpp:205
ship.h
void_map.h
CompanySettings::vehicle
VehicleDefaultSettings vehicle
default settings for vehicles
Definition: settings_type.h:571
base_media_base.h
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:52
town.h
TileY
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Definition: map_func.h:215
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:330
CheckRoadSide
static bool CheckRoadSide(int32 &new_value)
Check whether the road side may be changed.
Definition: settings_table.cpp:317
WC_BUILD_STATION
@ WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:389
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:221
_gui_zoom
ZoomLevel _gui_zoom
GUI Zoom level.
Definition: gfx.cpp:62
VehicleDefaultSettings::servint_ships
uint16 servint_ships
service interval for ships
Definition: settings_type.h:562
v_PositionStatusbar
static void v_PositionStatusbar(int32 new_value)
Reposition the statusbar as the setting changed.
Definition: settings_table.cpp:86
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:470
genworld.h
textbuf_gui.h
TileX
static uint TileX(TileIndex tile)
Get the X component of a tile.
Definition: map_func.h:205
ShowErrorMessage
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=nullptr, uint textref_stack_size=0, const uint32 *textref_stack=nullptr)
Display an error message in a window.
Definition: error_gui.cpp:383
ai.hpp
screenshot.h
UpdateCursorSize
void UpdateCursorSize()
Update cursor dimension.
Definition: gfx.cpp:1820
GetGameSettings
static GameSettings & GetGameSettings()
Get the settings-object applicable for the current situation: the newgame settings when we're in the ...
Definition: settings_type.h:618
MapSizeX
static uint MapSizeX()
Get the size of the map along the X.
Definition: map_func.h:72
PositionStatusbar
int PositionStatusbar(Window *w)
(Re)position statusbar window at the screen.
Definition: window.cpp:3409
RoadVehiclesAreBuilt
bool RoadVehiclesAreBuilt()
Verify whether a road vehicle is available.
Definition: road_cmd.cpp:183
PositionNewsMessage
int PositionNewsMessage(Window *w)
(Re)position news message window at the screen.
Definition: window.cpp:3420
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:520
MapSize
static uint MapSize()
Get the size of the map.
Definition: map_func.h:92
TileHeight
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
Definition: tile_map.h:29
span
A trimmed down version of what std::span will be in C++20.
Definition: span_type.hpp:60
ReInitAllWindows
void ReInitAllWindows(bool zoom_changed)
Re-initialize all windows.
Definition: window.cpp:3347
GfxClearSpriteCache
void GfxClearSpriteCache()
Remove all encoded sprites from the sprite cache without discarding sprite location information.
Definition: spritecache.cpp:1006
Station::RecomputeCatchmentForAll
static void RecomputeCatchmentForAll()
Recomputes catchment of all stations.
Definition: station.cpp:474
InvalidateNewGRFChangeWindows
static void InvalidateNewGRFChangeWindows(int32 new_value)
Update any possible saveload window and delete any newgrf dialogue as its widget parts might change.
Definition: settings_table.cpp:278
MP_WATER
@ MP_WATER
Water tile.
Definition: tile_type.h:52
UpdateAirportsNoise
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Definition: station_cmd.cpp:2225
MakeVoid
static void MakeVoid(TileIndex t)
Make a nice void tile ;)
Definition: void_map.h:19
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:53
WC_VEHICLE_DETAILS
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
Definition: window_type.h:192
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:586
RedrawSmallmap
static void RedrawSmallmap(int32 new_value)
Redraw the smallmap after a colour scheme change.
Definition: settings_table.cpp:99
safeguards.h
AI::GetInfoList
static const ScriptInfoList * GetInfoList()
Wrapper function for AIScanner::GetAIInfoList.
Definition: ai_core.cpp:328
music_driver.hpp
Train
'Train' is either a loco or a wagon.
Definition: train.h:86
_networking
bool _networking
are we in networking mode?
Definition: network.cpp:57
VehicleDefaultSettings
Default settings for vehicles.
Definition: settings_type.h:557
EconomySettings::found_town
TownFounding found_town
town founding.
Definition: settings_type.h:519
error.h
MapSizeY
static uint MapSizeY()
Get the size of the map along the Y.
Definition: map_func.h:82
CheckDynamicEngines
static bool CheckDynamicEngines(int32 &new_value)
Changing the setting "allow multiple NewGRF sets" is not allowed if there are vehicles.
Definition: settings_table.cpp:409
stdafx.h
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
settings_table.h
SetTileHeight
static void SetTileHeight(TileIndex tile, uint height)
Sets the height of a tile.
Definition: tile_map.h:57
IsTileType
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
Definition: tile_map.h:150
pathfinder_type.h
sound_driver.hpp
GUISettings::zoom_min
ZoomLevel zoom_min
minimum zoom out level
Definition: settings_type.h:131
_gui_zoom_cfg
int8 _gui_zoom_cfg
GUI zoom level in config.
Definition: gfx.cpp:65
RoadVehAccelerationModelChanged
static void RoadVehAccelerationModelChanged(int32 new_value)
This function updates realistic acceleration caches when the setting "Road vehicle acceleration model...
Definition: settings_table.cpp:216
rail_gui.h
Ship
All ships have this type.
Definition: ship.h:26
_current_company
CompanyID _current_company
Company currently doing an action.
Definition: company_cmd.cpp:47
vehicle_func.h
WC_GAME_OPTIONS
@ WC_GAME_OPTIONS
Game options window; Window numbers:
Definition: window_type.h:604
WC_SELECT_STATION
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:234
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:386
MapMaxY
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
Definition: map_func.h:111
NetworkServerSendConfigUpdate
void NetworkServerSendConfigUpdate()
Send Config Update.
Definition: network_server.cpp:1874
VehicleDefaultSettings::servint_trains
uint16 servint_trains
service interval for trains
Definition: settings_type.h:559
TileXY
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
Definition: map_func.h:163
WC_BUILD_VEHICLE
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
Definition: window_type.h:375
VehicleSettings::roadveh_acceleration_model
uint8 roadveh_acceleration_model
realistic acceleration for road vehicles
Definition: settings_type.h:480
video_driver.hpp
CompanyServiceInterval
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
Definition: company_cmd.cpp:1147
CloseWindowByClass
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
Definition: window.cpp:1188
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:3251
VehicleDefaultSettings::servint_aircraft
uint16 servint_aircraft
service interval for aircraft
Definition: settings_type.h:561
BaseStation
Base class for all station-ish types.
Definition: base_station_base.h:52
company_func.h
WL_ERROR
@ WL_ERROR
Errors (eg. saving/loading failed)
Definition: error.h:24
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:1235
MapMaxX
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
Definition: map_func.h:102
network.h
VehicleDefaultSettings::servint_ispercent
bool servint_ispercent
service intervals are in percents
Definition: settings_type.h:558
window_func.h
MarkWholeScreenDirty
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1751
ReplaceAsteriskWithEmptyPassword
static bool ReplaceAsteriskWithEmptyPassword(std::string &newval)
Replace a passwords that are a literal asterisk with an empty string.
Definition: settings_table.cpp:463
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
Definition: window.cpp:1176
config.h
VehicleDefaultSettings::servint_roadveh
uint16 servint_roadveh
service interval for road vehicles
Definition: settings_type.h:560
fontcache.h
WC_TOWN_VIEW
@ WC_TOWN_VIEW
Town view; Window numbers:
Definition: window_type.h:325
ClientSettings::company
CompanySettings company
default values for per-company settings
Definition: settings_type.h:596
PositionNetworkChatWindow
int PositionNetworkChatWindow(Window *w)
(Re)position network chat window at the screen.
Definition: window.cpp:3431
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:585
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:326
Company
Definition: company_base.h:115
game_config.hpp
SetWindowClassesDirty
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
Definition: window.cpp:3162
NetworkServerUpdateGameInfo
void NetworkServerUpdateGameInfo()
Update the server's NetworkServerGameInfo due to changes in settings.
Definition: network_server.cpp:1882
WC_SMALLMAP
@ WC_SMALLMAP
Small map; Window numbers:
Definition: window_type.h:96
network_func.h
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
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:173
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:594
WL_CRITICAL
@ WL_CRITICAL
Critical errors, the MessageBox is shown in all cases.
Definition: error.h:25
BuildLandLegend
void BuildLandLegend()
(Re)build the colour tables for the legends.
Definition: smallmap_gui.cpp:275
ai_config.hpp
news_func.h
roadveh.h
RoadVehSlopeSteepnessChanged
static void RoadVehSlopeSteepnessChanged(int32 new_value)
This function updates the road vehicle acceleration cache after a steepness change.
Definition: settings_table.cpp:236