OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
25 #if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA)
26 #define HAS_TRUETYPE_FONT
48 #include "table/strings.h"
49 #include "table/settings.h"
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 };
60 SettingTable _linkgraph_settings{ _linkgraph_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 };
72 #if defined(_WIN32) && !defined(DEDICATED)
88 if (_game_mode != GM_MENU) {
106 static void StationSpreadChanged(int32 p1)
112 static void CloseSignalGUI(int32 new_value)
114 if (new_value == 0) {
119 static void UpdateConsists(int32 new_value)
123 if (t->IsFrontEngine() || t->IsFreeWagon()) t->ConsistChanged(
CCF_TRACK);
129 static void UpdateAllServiceInterval(int32 new_value)
131 bool update_vehicles;
135 update_vehicles =
false;
138 update_vehicles =
true;
141 if (new_value != 0) {
153 if (update_vehicles) {
156 if (v->owner ==
_current_company && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
158 v->SetServiceIntervalIsPercent(new_value != 0);
166 static bool CanUpdateServiceInterval(
VehicleType type, int32 &new_value)
177 return interval == new_value;
180 static void UpdateServiceInterval(
VehicleType type, int32 new_value)
184 if (v->owner ==
_current_company && v->type == type && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
185 v->SetServiceInterval(new_value);
193 static void TrainAccelerationModelChanged(int32 new_value)
196 if (t->IsFrontEngine()) {
197 t->tcache.cached_max_curve_speed = t->GetCurveSpeedLimit();
198 t->UpdateAcceleration();
215 if (t->IsFrontEngine()) t->CargoChanged();
227 if (rv->IsFrontEngine()) {
246 if (rv->IsFrontEngine()) rv->CargoChanged();
250 static void TownFoundingChanged(int32 new_value)
259 static void ZoomMinMaxChanged(int32 new_value)
261 extern void ConstrainAllViewportsZoom();
262 ConstrainAllViewportsZoom();
272 static void SpriteZoomMinChanged(int32 new_value)
292 static void InvalidateCompanyLiveryWindow(int32 new_value)
295 ResetVehicleColourMap();
298 static void DifficultyNoiseChange(int32 new_value)
300 if (_game_mode == GM_NORMAL) {
308 static void MaxNoAIsChange(int32 new_value)
340 static std::vector<std::string> _old_landscape_values{
"normal",
"hilly",
"desert",
"candy"};
344 static bool CheckFreeformEdges(int32 &new_value)
346 if (_game_mode == GM_MENU)
return true;
347 if (new_value != 0) {
350 if (
TileX(s->tile) == 0 ||
TileY(s->tile) == 0) {
357 if (st->IsInUse() && (
TileX(st->xy) == 0 ||
TileY(st->xy) == 0)) {
363 for (uint i = 0; i <
MapMaxX(); i++) {
369 for (uint i = 1; i <
MapMaxX(); i++) {
375 for (uint i = 0; i <
MapMaxY(); i++) {
381 for (uint i = 1; i <
MapMaxY(); i++) {
391 static void UpdateFreeformEdges(int32 new_value)
393 if (_game_mode == GM_MENU)
return;
395 if (new_value != 0) {
400 for (uint i = 0; i <
MapMaxX(); i++) {
404 for (uint i = 0; i <
MapMaxY(); i++) {
418 if (_game_mode == GM_MENU)
return true;
428 static bool CheckMaxHeightLevel(int32 &new_value)
430 if (_game_mode == GM_NORMAL)
return false;
431 if (_game_mode != GM_EDITOR)
return true;
446 static void StationCatchmentChanged(int32 new_value)
452 static void MaxVehiclesChanged(int32 new_value)
458 static void InvalidateShipPathCache(int32 new_value)
472 if (newval.compare(
"*") == 0) newval.clear();
void LoadStringWidthTable(bool monospace)
Initialize _stringwidth_table cache.
Buses, trucks and trams belong to this class.
@ WC_SAVELOAD
Saveload window; Window numbers:
void BuildOwnerLegend()
Completes the array for the owned property legend.
uint32 TileIndex
The index/ID of a Tile.
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-...
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
static Titem * Get(size_t index)
Returns Titem with given index.
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
uint16 GetServiceIntervalClamped(uint interval, bool ispercent)
Clamp the service interval to the correct min/max.
static void v_PositionMainToolbar(int32 new_value)
Reposition the main toolbar as the setting changed.
int PositionMainToolbar(Window *w)
(Re)position main toolbar window at the screen.
static void SetTileType(TileIndex tile, TileType type)
Set the type of a tile.
@ WC_COMPANY_COLOUR
Company colour selection; Window numbers:
@ WC_FOUND_TOWN
Found a town; Window numbers:
bool _network_server
network-server is active
@ WC_ENGINE_PREVIEW
Engine preview window; Window numbers:
static void TrainSlopeSteepnessChanged(int32 new_value)
This function updates the train acceleration cache after a steepness change.
VehicleDefaultSettings vehicle
default settings for vehicles
ClientSettings _settings_client
The current settings for this game.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
static size_t ConvertLandscape(const char *value)
Conversion callback for _gameopt_settings_game.landscape It converts (or try) between old values and ...
static bool CheckRoadSide(int32 &new_value)
Check whether the road side may be changed.
@ WC_BUILD_STATION
Build station; Window numbers:
ZoomLevel _gui_zoom
GUI Zoom level.
uint16 servint_ships
service interval for ships
static void v_PositionStatusbar(int32 new_value)
Reposition the statusbar as the setting changed.
static void UpdateClientConfigValues()
Update the game info, and send it to the clients when we are running as a server.
static uint TileX(TileIndex tile)
Get the X component of a tile.
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.
void UpdateCursorSize()
Update cursor dimension.
static GameSettings & GetGameSettings()
Get the settings-object applicable for the current situation: the newgame settings when we're in the ...
static uint MapSizeX()
Get the size of the map along the X.
int PositionStatusbar(Window *w)
(Re)position statusbar window at the screen.
bool RoadVehiclesAreBuilt()
Verify whether a road vehicle is available.
int PositionNewsMessage(Window *w)
(Re)position news message window at the screen.
bool station_noise_level
build new airports when the town noise level is still within accepted limits
static uint MapSize()
Get the size of the map.
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
A trimmed down version of what std::span will be in C++20.
void ReInitAllWindows(bool zoom_changed)
Re-initialize all windows.
void GfxClearSpriteCache()
Remove all encoded sprites from the sprite cache without discarding sprite location information.
static void RecomputeCatchmentForAll()
Recomputes catchment of all stations.
static void InvalidateNewGRFChangeWindows(int32 new_value)
Update any possible saveload window and delete any newgrf dialogue as its widget parts might change.
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
static void MakeVoid(TileIndex t)
Make a nice void tile ;)
GameSettings _settings_game
Game settings of a running game or the scenario editor.
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
EconomySettings economy
settings to change the economy
static void RedrawSmallmap(int32 new_value)
Redraw the smallmap after a colour scheme change.
static const ScriptInfoList * GetInfoList()
Wrapper function for AIScanner::GetAIInfoList.
'Train' is either a loco or a wagon.
bool _networking
are we in networking mode?
Default settings for vehicles.
TownFounding found_town
town founding.
static uint MapSizeY()
Get the size of the map along the Y.
static bool CheckDynamicEngines(int32 &new_value)
Changing the setting "allow multiple NewGRF sets" is not allowed if there are vehicles.
VehicleType
Available vehicle types.
static void SetTileHeight(TileIndex tile, uint height)
Sets the height of a tile.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
ZoomLevel zoom_min
minimum zoom out level
int8 _gui_zoom_cfg
GUI zoom level in config.
static void RoadVehAccelerationModelChanged(int32 new_value)
This function updates realistic acceleration caches when the setting "Road vehicle acceleration model...
All ships have this type.
CompanyID _current_company
Company currently doing an action.
@ WC_GAME_OPTIONS
Game options window; Window numbers:
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
void NetworkServerSendConfigUpdate()
Send Config Update.
uint16 servint_trains
service interval for trains
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
uint8 roadveh_acceleration_model
realistic acceleration for road vehicles
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
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...
uint16 servint_aircraft
service interval for aircraft
Base class for all station-ish types.
@ WL_ERROR
Errors (eg. saving/loading failed)
static Pool::IterateWrapper< Train > Iterate(size_t from=0)
Returns an iterable ensemble of all valid vehicles of type T.
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
bool servint_ispercent
service intervals are in percents
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
static bool ReplaceAsteriskWithEmptyPassword(std::string &newval)
Replace a passwords that are a literal asterisk with an empty string.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
uint16 servint_roadveh
service interval for road vehicles
@ WC_TOWN_VIEW
Town view; Window numbers:
CompanySettings company
default values for per-company settings
int PositionNetworkChatWindow(Window *w)
(Re)position network chat window at the screen.
@ CCF_TRACK
Valid changes while vehicle is driving, and possibly changing tracks.
VehicleSettings vehicle
options for vehicles
@ WC_BUILD_SIGNAL
Build signal toolbar; Window numbers:
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
void NetworkServerUpdateGameInfo()
Update the server's NetworkServerGameInfo due to changes in settings.
@ WC_SMALLMAP
Small map; Window numbers:
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
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 |.
GUISettings gui
settings related to the GUI
@ WL_CRITICAL
Critical errors, the MessageBox is shown in all cases.
void BuildLandLegend()
(Re)build the colour tables for the legends.
static void RoadVehSlopeSteepnessChanged(int32 new_value)
This function updates the road vehicle acceleration cache after a steepness change.