OpenTTD Source: src/settings_table.cpp Source File

OpenTTD Source 13.1

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"
19 #include "pathfinder/pathfinder_type.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);
91 PositionNetworkChatWindow(nullptr);
92 }
93 }
94
99 static void RedrawSmallmap(int32 new_value)
100 {
101 BuildLandLegend();
102 BuildOwnerLegend();
103 SetWindowClassesDirty(WC_SMALLMAP);
104 }
105
107 static void UpdateLinkgraphColours(int32 new_value)
108 {
109 BuildLinkStatsLegend();
110 MarkWholeScreenDirty();
111 }
112
113 static void StationSpreadChanged(int32 p1)
114 {
115 InvalidateWindowData(WC_SELECT_STATION, 0);
116 InvalidateWindowData(WC_BUILD_STATION, 0);
117 }
118
119 static void UpdateConsists(int32 new_value)
120 {
121 for (Train *t : Train::Iterate()) {
122 /* Update the consist of all trains so the maximum speed is set correctly. */
123 if (t->IsFrontEngine() || t->IsFreeWagon()) t->ConsistChanged(CCF_TRACK);
124 }
125 InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
126 }
127
128 /* Check service intervals of vehicles, newvalue is value of % or day based servicing */
129 static void UpdateAllServiceInterval(int32 new_value)
130 {
131 bool update_vehicles;
132 VehicleDefaultSettings *vds;
133 if (_game_mode == GM_MENU || !Company::IsValidID(_current_company)) {
134 vds = &_settings_client.company.vehicle;
135 update_vehicles = false;
136 } else {
137 vds = &Company::Get(_current_company)->settings.vehicle;
138 update_vehicles = true;
139 }
140
141 if (new_value != 0) {
142 vds->servint_trains = 50;
143 vds->servint_roadveh = 50;
144 vds->servint_aircraft = 50;
145 vds->servint_ships = 50;
146 } else {
147 vds->servint_trains = 150;
148 vds->servint_roadveh = 150;
149 vds->servint_aircraft = 100;
150 vds->servint_ships = 360;
151 }
152
153 if (update_vehicles) {
154 const Company *c = Company::Get(_current_company);
155 for (Vehicle *v : Vehicle::Iterate()) {
156 if (v->owner == _current_company && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
157 v->SetServiceInterval(CompanyServiceInterval(c, v->type));
158 v->SetServiceIntervalIsPercent(new_value != 0);
159 }
160 }
161 }
162
163 SetWindowClassesDirty(WC_VEHICLE_DETAILS);
164 }
165
166 static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value)
167 {
168 VehicleDefaultSettings *vds;
169 if (_game_mode == GM_MENU || !Company::IsValidID(_current_company)) {
170 vds = &_settings_client.company.vehicle;
171 } else {
172 vds = &Company::Get(_current_company)->settings.vehicle;
173 }
174
175 /* Test if the interval is valid */
176 int32 interval = GetServiceIntervalClamped(new_value, vds->servint_ispercent);
177 return interval == new_value;
178 }
179
180 static void UpdateServiceInterval(VehicleType type, int32 new_value)
181 {
182 if (_game_mode != GM_MENU && Company::IsValidID(_current_company)) {
183 for (Vehicle *v : Vehicle::Iterate()) {
184 if (v->owner == _current_company && v->type == type && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
185 v->SetServiceInterval(new_value);
186 }
187 }
188 }
189
190 SetWindowClassesDirty(WC_VEHICLE_DETAILS);
191 }
192
193 static void TrainAccelerationModelChanged(int32 new_value)
194 {
195 for (Train *t : Train::Iterate()) {
196 if (t->IsFrontEngine()) {
197 t->tcache.cached_max_curve_speed = t->GetCurveSpeedLimit();
198 t->UpdateAcceleration();
199 }
200 }
201
202 /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
203 SetWindowClassesDirty(WC_ENGINE_PREVIEW);
204 InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
205 SetWindowClassesDirty(WC_VEHICLE_DETAILS);
206 }
207
212 static void TrainSlopeSteepnessChanged(int32 new_value)
213 {
214 for (Train *t : Train::Iterate()) {
215 if (t->IsFrontEngine()) t->CargoChanged();
216 }
217 }
218
223 static void RoadVehAccelerationModelChanged(int32 new_value)
224 {
225 if (_settings_game.vehicle.roadveh_acceleration_model != AM_ORIGINAL) {
226 for (RoadVehicle *rv : RoadVehicle::Iterate()) {
227 if (rv->IsFrontEngine()) {
228 rv->CargoChanged();
229 }
230 }
231 }
232
233 /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
234 SetWindowClassesDirty(WC_ENGINE_PREVIEW);
235 InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
236 SetWindowClassesDirty(WC_VEHICLE_DETAILS);
237 }
238
243 static void RoadVehSlopeSteepnessChanged(int32 new_value)
244 {
245 for (RoadVehicle *rv : RoadVehicle::Iterate()) {
246 if (rv->IsFrontEngine()) rv->CargoChanged();
247 }
248 }
249
250 static void TownFoundingChanged(int32 new_value)
251 {
252 if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {
253 CloseWindowById(WC_FOUND_TOWN, 0);
254 } else {
255 InvalidateWindowData(WC_FOUND_TOWN, 0);
256 }
257 }
258
259 static void ZoomMinMaxChanged(int32 new_value)
260 {
261 extern void ConstrainAllViewportsZoom();
262 ConstrainAllViewportsZoom();
263 GfxClearSpriteCache();
264 if (_settings_client.gui.zoom_min > _gui_zoom) {
265 /* Restrict GUI zoom if it is no longer available. */
266 _gui_zoom = _settings_client.gui.zoom_min;
267 UpdateCursorSize();
268 LoadStringWidthTable();
269 }
270 }
271
272 static void SpriteZoomMinChanged(int32 new_value)
273 {
274 GfxClearSpriteCache();
275 /* Force all sprites to redraw at the new chosen zoom level */
276 MarkWholeScreenDirty();
277 }
278
285 static void InvalidateNewGRFChangeWindows(int32 new_value)
286 {
287 InvalidateWindowClassesData(WC_SAVELOAD);
288 CloseWindowByClass(WC_GAME_OPTIONS);
289 ReInitAllWindows(false);
290 }
291
292 static void InvalidateCompanyLiveryWindow(int32 new_value)
293 {
294 InvalidateWindowClassesData(WC_COMPANY_COLOUR, -1);
295 ResetVehicleColourMap();
296 }
297
298 static void DifficultyNoiseChange(int32 new_value)
299 {
300 if (_game_mode == GM_NORMAL) {
301 UpdateAirportsNoise();
302 if (_settings_game.economy.station_noise_level) {
303 InvalidateWindowClassesData(WC_TOWN_VIEW, 0);
304 }
305 }
306 }
307
308 static void MaxNoAIsChange(int32 new_value)
309 {
310 if (GetGameSettings().difficulty.max_no_competitors != 0 &&
311 AI::GetInfoList()->size() == 0 &&
312 (!_networking || _network_server)) {
313 ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, WL_CRITICAL);
314 }
315
316 InvalidateWindowClassesData(WC_GAME_OPTIONS, 0);
317 }
318
324 static bool CheckRoadSide(int32 &new_value)
325 {
326 extern bool RoadVehiclesAreBuilt();
327 return _game_mode == GM_MENU || !RoadVehiclesAreBuilt();
328 }
329
337 static size_t ConvertLandscape(const char *value)
338 {
339 /* try with the old values */
340 static std::vector<std::string> _old_landscape_values{"normal", "hilly", "desert", "candy"};
341 return OneOfManySettingDesc::ParseSingleValue(value, strlen(value), _old_landscape_values);
342 }
343
344 static bool CheckFreeformEdges(int32 &new_value)
345 {
346 if (_game_mode == GM_MENU) return true;
347 if (new_value != 0) {
348 for (Ship *s : Ship::Iterate()) {
349 /* Check if there is a ship on the northern border. */
350 if (TileX(s->tile) == 0 || TileY(s->tile) == 0) {
351 ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
352 return false;
353 }
354 }
355 for (const BaseStation *st : BaseStation::Iterate()) {
356 /* Check if there is a non-deleted buoy on the northern border. */
357 if (st->IsInUse() && (TileX(st->xy) == 0 || TileY(st->xy) == 0)) {
358 ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
359 return false;
360 }
361 }
362 } else {
363 for (uint i = 0; i < MapMaxX(); i++) {
364 if (TileHeight(TileXY(i, 1)) != 0) {
365 ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
366 return false;
367 }
368 }
369 for (uint i = 1; i < MapMaxX(); i++) {
370 if (!IsTileType(TileXY(i, MapMaxY() - 1), MP_WATER) || TileHeight(TileXY(1, MapMaxY())) != 0) {
371 ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
372 return false;
373 }
374 }
375 for (uint i = 0; i < MapMaxY(); i++) {
376 if (TileHeight(TileXY(1, i)) != 0) {
377 ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
378 return false;
379 }
380 }
381 for (uint i = 1; i < MapMaxY(); i++) {
382 if (!IsTileType(TileXY(MapMaxX() - 1, i), MP_WATER) || TileHeight(TileXY(MapMaxX(), i)) != 0) {
383 ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
384 return false;
385 }
386 }
387 }
388 return true;
389 }
390
391 static void UpdateFreeformEdges(int32 new_value)
392 {
393 if (_game_mode == GM_MENU) return;
394
395 if (new_value != 0) {
396 for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0));
397 for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y));
398 } else {
399 /* Make tiles at the border water again. */
400 for (uint i = 0; i < MapMaxX(); i++) {
401 SetTileHeight(TileXY(i, 0), 0);
402 SetTileType(TileXY(i, 0), MP_WATER);
403 }
404 for (uint i = 0; i < MapMaxY(); i++) {
405 SetTileHeight(TileXY(0, i), 0);
406 SetTileType(TileXY(0, i), MP_WATER);
407 }
408 }
409 MarkWholeScreenDirty();
410 }
411
416 static bool CheckDynamicEngines(int32 &new_value)
417 {
418 if (_game_mode == GM_MENU) return true;
419
420 if (!EngineOverrideManager::ResetToCurrentNewGRFConfig()) {
421 ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, WL_ERROR);
422 return false;
423 }
424
425 return true;
426 }
427
428 static bool CheckMaxHeightLevel(int32 &new_value)
429 {
430 if (_game_mode == GM_NORMAL) return false;
431 if (_game_mode != GM_EDITOR) return true;
432
433 /* Check if at least one mountain on the map is higher than the new value.
434 * If yes, disallow the change. */
435 for (TileIndex t = 0; t < MapSize(); t++) {
436 if ((int32)TileHeight(t) > new_value) {
437 ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, WL_ERROR);
438 /* Return old, unchanged value */
439 return false;
440 }
441 }
442
443 return true;
444 }
445
446 static void StationCatchmentChanged(int32 new_value)
447 {
448 Station::RecomputeCatchmentForAll();
449 MarkWholeScreenDirty();
450 }
451
452 static void MaxVehiclesChanged(int32 new_value)
453 {
454 InvalidateWindowClassesData(WC_BUILD_TOOLBAR);
455 MarkWholeScreenDirty();
456 }
457
458 static void InvalidateShipPathCache(int32 new_value)
459 {
460 for (Ship *s : Ship::Iterate()) {
461 s->path.clear();
462 }
463 }
464
470 static bool ReplaceAsteriskWithEmptyPassword(std::string &newval)
471 {
472 if (newval.compare("*") == 0) newval.clear();
473 return true;
474 }
475
477 static void UpdateClientConfigValues()
478 {
479 NetworkServerUpdateGameInfo();
480 if (_network_server) NetworkServerSendConfigUpdate();
481 }
482
483 /* End - Callback Functions */
LoadStringWidthTable
void LoadStringWidthTable(bool monospace)
Initialize _stringwidth_table cache.
Definition: gfx.cpp:1446
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:137
BuildOwnerLegend
void BuildOwnerLegend()
Completes the array for the owned property legend.
Definition: smallmap_gui.cpp:326
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:3252
factory.hpp
EngineOverrideManager::ResetToCurrentNewGRFConfig
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
Definition: engine.cpp:519
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:66
GetServiceIntervalClamped
uint16 GetServiceIntervalClamped(uint interval, bool ispercent)
Clamp the service interval to the correct min/max.
Definition: order_cmd.cpp:1878
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:3431
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:223
WC_FOUND_TOWN
@ WC_FOUND_TOWN
Found a town; Window numbers:
Definition: window_type.h:422
currency.h
elrail_func.h
TF_FORBIDDEN
@ TF_FORBIDDEN
Forbidden.
Definition: town_type.h:96
_network_server
bool _network_server
network-server is active
Definition: network.cpp:59
WC_ENGINE_PREVIEW
@ WC_ENGINE_PREVIEW
Engine preview window; Window numbers:
Definition: window_type.h:582
TrainSlopeSteepnessChanged
static void TrainSlopeSteepnessChanged(int32 new_value)
This function updates the train acceleration cache after a steepness change.
Definition: settings_table.cpp:212
ship.h
void_map.h
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
CompanySettings::vehicle
VehicleDefaultSettings vehicle
default settings for vehicles
Definition: settings_type.h:581
base_media_base.h
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:53
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:337
CheckRoadSide
static bool CheckRoadSide(int32 &new_value)
Check whether the road side may be changed.
Definition: settings_table.cpp:324
WC_BUILD_STATION
@ WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:390
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:224
_gui_zoom
ZoomLevel _gui_zoom
GUI Zoom level.
Definition: gfx.cpp:64
VehicleDefaultSettings::servint_ships
uint16 servint_ships
service interval for ships
Definition: settings_type.h:572
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:477
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:377
ai.hpp
screenshot.h
UpdateCursorSize
void UpdateCursorSize()
Update cursor dimension.
Definition: gfx.cpp:1836
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:628
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:3442
RoadVehiclesAreBuilt
bool RoadVehiclesAreBuilt()
Verify whether a road vehicle is available.
Definition: road_cmd.cpp:186
PositionNewsMessage
int PositionNewsMessage(Window *w)
(Re)position news message window at the screen.
Definition: window.cpp:3453
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:530
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:3375
GfxClearSpriteCache
void GfxClearSpriteCache()
Remove all encoded sprites from the sprite cache without discarding sprite location information.
Definition: spritecache.cpp:1042
Station::RecomputeCatchmentForAll
static void RecomputeCatchmentForAll()
Recomputes catchment of all stations.
Definition: station.cpp:497
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:285
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:2186
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:54
WC_VEHICLE_DETAILS
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
Definition: window_type.h:193
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:596
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:315
music_driver.hpp
Train
'Train' is either a loco or a wagon.
Definition: train.h:88
_networking
bool _networking
are we in networking mode?
Definition: network.cpp:58
VehicleDefaultSettings
Default settings for vehicles.
Definition: settings_type.h:567
EconomySettings::found_town
TownFounding found_town
town founding.
Definition: settings_type.h:529
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:416
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:134
RoadVehAccelerationModelChanged
static void RoadVehAccelerationModelChanged(int32 new_value)
This function updates realistic acceleration caches when the setting "Road vehicle acceleration model...
Definition: settings_table.cpp:223
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:606
WC_SELECT_STATION
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:235
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:1877
VehicleDefaultSettings::servint_trains
uint16 servint_trains
service interval for trains
Definition: settings_type.h:569
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:376
VehicleSettings::roadveh_acceleration_model
uint8 roadveh_acceleration_model
realistic acceleration for road vehicles
Definition: settings_type.h:490
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:1137
CloseWindowByClass
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
Definition: window.cpp:1199
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:3269
VehicleDefaultSettings::servint_aircraft
uint16 servint_aircraft
service interval for aircraft
Definition: settings_type.h:571
UpdateLinkgraphColours
static void UpdateLinkgraphColours(int32 new_value)
Redraw linkgraph links after a colour scheme change.
Definition: settings_table.cpp:107
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:1252
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:568
window_func.h
MarkWholeScreenDirty
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1767
ReplaceAsteriskWithEmptyPassword
static bool ReplaceAsteriskWithEmptyPassword(std::string &newval)
Replace a passwords that are a literal asterisk with an empty string.
Definition: settings_table.cpp:470
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:1187
config.h
VehicleDefaultSettings::servint_roadveh
uint16 servint_roadveh
service interval for road vehicles
Definition: settings_type.h:570
fontcache.h
WC_TOWN_VIEW
@ WC_TOWN_VIEW
Town view; Window numbers:
Definition: window_type.h:326
ClientSettings::company
CompanySettings company
default values for per-company settings
Definition: settings_type.h:606
PositionNetworkChatWindow
int PositionNetworkChatWindow(Window *w)
(Re)position network chat window at the screen.
Definition: window.cpp:3464
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:595
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:117
game_config.hpp
SetWindowClassesDirty
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
Definition: window.cpp:3180
NetworkServerUpdateGameInfo
void NetworkServerUpdateGameInfo()
Update the server's NetworkServerGameInfo due to changes in settings.
Definition: network_server.cpp:1885
BuildLinkStatsLegend
void BuildLinkStatsLegend()
Populate legend table for the link stat view.
Definition: smallmap_gui.cpp:199
WC_SMALLMAP
@ WC_SMALLMAP
Small map; Window numbers:
Definition: window_type.h:97
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:174
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:604
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:243