OpenTTD Source: src/survey.cpp Source File

OpenTTD Source 15.3

survey.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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#include "stdafx.h"
11
12#include "survey.h"
13
14#include "settings_table.h"
15#include "network/network.h"
16#include "rev.h"
17#include "settings_type.h"
18#include "timer/timer_game_tick.h"
19#include "timer/timer_game_calendar.h"
20#include "timer/timer_game_economy.h"
21#include "3rdparty/fmt/ranges.h"
22
23#include "currency.h"
24#include "fontcache.h"
25#include "language.h"
26
27#include "ai/ai_info.hpp"
28#include "game/game.hpp"
29#include "game/game_info.hpp"
30
31#include "music/music_driver.hpp"
32#include "sound/sound_driver.hpp"
33#include "video/video_driver.hpp"
34
35#include "base_media_base.h"
36#include "base_media_graphics.h"
37#include "base_media_music.h"
38#include "base_media_sounds.h"
39#include "blitter/factory.hpp"
40
41#include "social_integration.h"
42
43#ifdef WITH_ALLEGRO
44# include <allegro.h>
45#endif /* WITH_ALLEGRO */
46#ifdef WITH_FONTCONFIG
47# include <fontconfig/fontconfig.h>
48#endif /* WITH_FONTCONFIG */
49#ifdef WITH_PNG
50 /* pngconf.h, included by png.h doesn't like something in the
51 * freetype headers. As such it's not alphabetically sorted. */
52# include <png.h>
53#endif /* WITH_PNG */
54#ifdef WITH_FREETYPE
55# include <ft2build.h>
56# include FT_FREETYPE_H
57#endif /* WITH_FREETYPE */
58#ifdef WITH_HARFBUZZ
59# include <hb.h>
60#endif /* WITH_HARFBUZZ */
61#ifdef WITH_ICU_I18N
62# include <unicode/uversion.h>
63#endif /* WITH_ICU_I18N */
64#ifdef WITH_LIBLZMA
65# include <lzma.h>
66#endif
67#ifdef WITH_LZO
68#include <lzo/lzo1x.h>
69#endif
70#ifdef WITH_SDL2
71#include <SDL.h>
72#endif /* WITH_SDL2 */
73#ifdef WITH_ZLIB
74# include <zlib.h>
75#endif
76#ifdef WITH_CURL
77# include <curl/curl.h>
78#endif
79
80#include "safeguards.h"
81
82 NLOHMANN_JSON_SERIALIZE_ENUM(GRFStatus, {
83 {GRFStatus::GCS_UNKNOWN, "unknown"},
84 {GRFStatus::GCS_DISABLED, "disabled"},
85 {GRFStatus::GCS_NOT_FOUND, "not found"},
86 {GRFStatus::GCS_INITIALISED, "initialised"},
87 {GRFStatus::GCS_ACTIVATED, "activated"},
88})
89
90 NLOHMANN_JSON_SERIALIZE_ENUM(SocialIntegrationPlugin::State, {
91 {SocialIntegrationPlugin::State::RUNNING, "running"},
92 {SocialIntegrationPlugin::State::FAILED, "failed"},
93 {SocialIntegrationPlugin::State::PLATFORM_NOT_RUNNING, "platform_not_running"},
94 {SocialIntegrationPlugin::State::UNLOADED, "unloaded"},
95 {SocialIntegrationPlugin::State::DUPLICATE, "duplicate"},
96 {SocialIntegrationPlugin::State::UNSUPPORTED_API, "unsupported_api"},
97 {SocialIntegrationPlugin::State::INVALID_SIGNATURE, "invalid_signature"},
98})
99
100
102 static const std::string _vehicle_type_to_string[] = {
103 "train",
104 "roadveh",
105 "ship",
106 "aircraft",
107};
108
119 static auto &GenericSettingTables()
120{
121 static const SettingTable _generic_setting_tables[] = {
122 _difficulty_settings,
123 _economy_settings,
124 _game_settings,
125 _gui_settings,
126 _linkgraph_settings,
127 _locale_settings,
128 _multimedia_settings,
129 _network_settings,
130 _news_display_settings,
131 _pathfinding_settings,
132 _script_settings,
133 _world_settings,
134 };
135 return _generic_setting_tables;
136}
137
146 static void SurveySettingsTable(nlohmann::json &survey, const SettingTable &table, void *object, bool skip_if_default)
147{
148 for (auto &desc : table) {
149 const SettingDesc *sd = GetSettingDesc(desc);
150 /* Skip any old settings we no longer save/load. */
151 if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
152
153 const auto &name = sd->GetName();
154 if (skip_if_default && sd->IsDefaultValue(object)) continue;
155 survey[name] = sd->FormatValue(object);
156 }
157}
158
164 void SurveySettings(nlohmann::json &survey, bool skip_if_default)
165{
166 SurveySettingsTable(survey, _misc_settings, nullptr, skip_if_default);
167#if defined(_WIN32) && !defined(DEDICATED)
168 SurveySettingsTable(survey, _win32_settings, nullptr, skip_if_default);
169#endif
170 for (auto &table : GenericSettingTables()) {
171 SurveySettingsTable(survey, table, &_settings_game, skip_if_default);
172 }
173 SurveySettingsTable(survey, _currency_settings, &GetCustomCurrency(), skip_if_default);
174 SurveySettingsTable(survey, _company_settings, &_settings_client.company, skip_if_default);
175}
176
182 void SurveyCompiler(nlohmann::json &survey)
183{
184#if defined(_MSC_VER)
185 survey["name"] = "MSVC";
186 survey["version"] = _MSC_VER;
187#elif defined(__ICC) && defined(__GNUC__)
188 survey["name"] = "ICC";
189 survey["version"] = __ICC;
190# if defined(__GNUC__)
191 survey["extra"] = fmt::format("GCC {}.{}.{} mode", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
192# endif
193#elif defined(__GNUC__)
194 survey["name"] = "GCC";
195 survey["version"] = fmt::format("{}.{}.{}", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
196#else
197 survey["name"] = "unknown";
198#endif
199
200#if defined(__VERSION__)
201 survey["extra"] = __VERSION__;
202#endif
203}
204
210 void SurveyOpenTTD(nlohmann::json &survey)
211{
212 survey["version"]["revision"] = std::string(_openttd_revision);
213 survey["version"]["modified"] = _openttd_revision_modified;
214 survey["version"]["tagged"] = _openttd_revision_tagged;
215 survey["version"]["hash"] = std::string(_openttd_revision_hash);
216 survey["version"]["newgrf"] = fmt::format("{:X}", _openttd_newgrf_version);
217 survey["version"]["content"] = std::string(_openttd_content_version);
218 survey["build_date"] = std::string(_openttd_build_date);
219 survey["bits"] =
220#ifdef POINTER_IS_64BIT
221 64
222#else
223 32
224#endif
225 ;
226 if constexpr (std::endian::native == std::endian::little) survey["endian"] = "little";
227 if constexpr (std::endian::native == std::endian::big) survey["endian"] = "big";
228 survey["dedicated_build"] =
229#ifdef DEDICATED
230 "yes"
231#else
232 "no"
233#endif
234 ;
235}
236
242 void SurveyGameSession(nlohmann::json &survey)
243{
244 survey["id"] = _game_session_stats.savegame_id;
245 survey["seconds"] = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - _game_session_stats.start_time).count();
246 if (_game_session_stats.savegame_size.has_value()) {
247 survey["savegame_size"] = _game_session_stats.savegame_size.value();
248 }
249}
250
256 void SurveyConfiguration(nlohmann::json &survey)
257{
258 survey["network"] = _networking ? (_network_server ? "server" : "client") : "no";
259 if (_current_language != nullptr) {
260 survey["language"]["filename"] = FS2OTTD(_current_language->file.filename().native());
261 survey["language"]["name"] = _current_language->name;
262 survey["language"]["isocode"] = _current_language->isocode;
263 }
264 if (BlitterFactory::GetCurrentBlitter() != nullptr) {
265 survey["blitter"] = BlitterFactory::GetCurrentBlitter()->GetName();
266 }
267 if (MusicDriver::GetInstance() != nullptr) {
268 survey["music_driver"] = MusicDriver::GetInstance()->GetName();
269 }
270 if (SoundDriver::GetInstance() != nullptr) {
271 survey["sound_driver"] = SoundDriver::GetInstance()->GetName();
272 }
273 if (VideoDriver::GetInstance() != nullptr) {
274 survey["video_driver"] = VideoDriver::GetInstance()->GetName();
275 survey["video_info"] = VideoDriver::GetInstance()->GetInfoString();
276 }
277 if (BaseGraphics::GetUsedSet() != nullptr) {
278 survey["graphics_set"] = fmt::format("{}.{}", BaseGraphics::GetUsedSet()->name, fmt::join(BaseGraphics::GetUsedSet()->version, "."));
279 const GRFConfig *extra_cfg = BaseGraphics::GetUsedSet()->GetExtraConfig();
280 if (extra_cfg != nullptr && !extra_cfg->param.empty()) {
281 survey["graphics_set_parameters"] = std::span<const uint32_t>(extra_cfg->param);
282 } else {
283 survey["graphics_set_parameters"] = std::span<const uint32_t>();
284 }
285 }
286 if (BaseMusic::GetUsedSet() != nullptr) {
287 survey["music_set"] = fmt::format("{}.{}", BaseMusic::GetUsedSet()->name, fmt::join(BaseMusic::GetUsedSet()->version, "."));
288 }
289 if (BaseSounds::GetUsedSet() != nullptr) {
290 survey["sound_set"] = fmt::format("{}.{}", BaseSounds::GetUsedSet()->name, fmt::join(BaseSounds::GetUsedSet()->version, "."));
291 }
292}
293
299 void SurveyFont(nlohmann::json &survey)
300{
301 survey["small"] = FontCache::Get(FS_SMALL)->GetFontName();
302 survey["medium"] = FontCache::Get(FS_NORMAL)->GetFontName();
303 survey["large"] = FontCache::Get(FS_LARGE)->GetFontName();
304 survey["mono"] = FontCache::Get(FS_MONO)->GetFontName();
305}
306
312 void SurveyCompanies(nlohmann::json &survey)
313{
314 for (const Company *c : Company::Iterate()) {
315 auto &company = survey[fmt::format("{}", c->index.base())];
316 if (c->ai_info == nullptr) {
317 company["type"] = "human";
318 } else {
319 company["type"] = "ai";
320 company["script"] = fmt::format("{}.{}", c->ai_info->GetName(), c->ai_info->GetVersion());
321 }
322
323 for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
324 uint amount = c->group_all[type].num_vehicle;
325 company["vehicles"][_vehicle_type_to_string[type]] = amount;
326 }
327
328 company["infrastructure"]["road"] = c->infrastructure.GetRoadTotal();
329 company["infrastructure"]["tram"] = c->infrastructure.GetTramTotal();
330 company["infrastructure"]["rail"] = c->infrastructure.GetRailTotal();
331 company["infrastructure"]["signal"] = c->infrastructure.signal;
332 company["infrastructure"]["water"] = c->infrastructure.water;
333 company["infrastructure"]["station"] = c->infrastructure.station;
334 company["infrastructure"]["airport"] = c->infrastructure.airport;
335 }
336}
337
343 void SurveyTimers(nlohmann::json &survey)
344{
345 survey["ticks"] = TimerGameTick::counter;
346
347 TimerGameEconomy::YearMonthDay economy_ymd = TimerGameEconomy::ConvertDateToYMD(TimerGameEconomy::date);
348 survey["economy"] = fmt::format("{:04}-{:02}-{:02} ({})", economy_ymd.year, economy_ymd.month + 1, economy_ymd.day, TimerGameEconomy::date_fract);
349
350 TimerGameCalendar::YearMonthDay ymd = TimerGameCalendar::ConvertDateToYMD(TimerGameCalendar::date);
351 survey["calendar"] = fmt::format("{:04}-{:02}-{:02} ({})", ymd.year, ymd.month + 1, ymd.day, TimerGameCalendar::date_fract);
352}
353
359 void SurveyGrfs(nlohmann::json &survey)
360{
361 for (const auto &c : _grfconfig) {
362 auto grfid = fmt::format("{:08x}", std::byteswap(c->ident.grfid));
363 auto &grf = survey[std::move(grfid)];
364
365 grf["md5sum"] = FormatArrayAsHex(c->ident.md5sum);
366 grf["status"] = c->status;
367
368 if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_UNSET) grf["palette"] = "unset";
369 if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_DOS) grf["palette"] = "dos";
370 if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_WINDOWS) grf["palette"] = "windows";
371 if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_ANY) grf["palette"] = "any";
372
373 if ((c->palette & GRFP_BLT_MASK) == GRFP_BLT_UNSET) grf["blitter"] = "unset";
374 if ((c->palette & GRFP_BLT_MASK) == GRFP_BLT_32BPP) grf["blitter"] = "32bpp";
375
376 grf["is_static"] = c->flags.Test(GRFConfigFlag::Static);
377 grf["parameters"] = std::span<const uint32_t>(c->param);
378 }
379}
380
386 void SurveyGameScript(nlohmann::json &survey)
387{
388 if (Game::GetInfo() == nullptr) return;
389
390 survey = fmt::format("{}.{}", Game::GetInfo()->GetName(), Game::GetInfo()->GetVersion());
391}
392
398 void SurveyLibraries(nlohmann::json &survey)
399{
400#ifdef WITH_ALLEGRO
401 survey["allegro"] = std::string(allegro_id);
402#endif /* WITH_ALLEGRO */
403
404#ifdef WITH_FONTCONFIG
405 int version = FcGetVersion();
406 survey["fontconfig"] = fmt::format("{}.{}.{}", version / 10000, (version / 100) % 100, version % 100);
407#endif /* WITH_FONTCONFIG */
408
409#ifdef WITH_FREETYPE
410 FT_Library library;
411 int major, minor, patch;
412 FT_Init_FreeType(&library);
413 FT_Library_Version(library, &major, &minor, &patch);
414 FT_Done_FreeType(library);
415 survey["freetype"] = fmt::format("{}.{}.{}", major, minor, patch);
416#endif /* WITH_FREETYPE */
417
418#if defined(WITH_HARFBUZZ)
419 survey["harfbuzz"] = hb_version_string();
420#endif /* WITH_HARFBUZZ */
421
422#if defined(WITH_ICU_I18N)
423 /* 4 times 0-255, separated by dots (.) and a trailing '\0' */
424 char buf[4 * 3 + 3 + 1];
425 UVersionInfo ver;
426 u_getVersion(ver);
427 u_versionToString(ver, buf);
428 survey["icu_i18n"] = buf;
429#endif /* WITH_ICU_I18N */
430
431#ifdef WITH_LIBLZMA
432 survey["lzma"] = lzma_version_string();
433#endif
434
435#ifdef WITH_LZO
436 survey["lzo"] = lzo_version_string();
437#endif
438
439#ifdef WITH_PNG
440 survey["png"] = png_get_libpng_ver(nullptr);
441#endif /* WITH_PNG */
442
443#ifdef WITH_SDL2
444 SDL_version sdl2_v;
445 SDL_GetVersion(&sdl2_v);
446 survey["sdl2"] = fmt::format("{}.{}.{}", sdl2_v.major, sdl2_v.minor, sdl2_v.patch);
447#endif
448
449#ifdef WITH_ZLIB
450 survey["zlib"] = zlibVersion();
451#endif
452
453#ifdef WITH_CURL
454 auto *curl_v = curl_version_info(CURLVERSION_NOW);
455 survey["curl"] = curl_v->version;
456 survey["curl_ssl"] = curl_v->ssl_version == nullptr ? "none" : curl_v->ssl_version;
457#endif
458}
459
465 void SurveyPlugins(nlohmann::json &survey)
466{
467 auto _plugins = SocialIntegration::GetPlugins();
468
469 for (auto &plugin : _plugins) {
470 auto &platform = survey[plugin->social_platform];
471 platform.push_back({
472 {"name", plugin->name},
473 {"version", plugin->version},
474 {"basepath", plugin->basepath},
475 {"state", plugin->state},
476 });
477 }
478}
479
488std::string SurveyMemoryToText(uint64_t memory)
489{
490 memory = memory / 1024; // KiB
491 memory = CeilDiv(memory, 1024); // MiB
492
493 /* Anything above 512 MiB we represent in GiB. */
494 if (memory > 512) {
495 return fmt::format("{} GiB", CeilDiv(memory, 1024));
496 }
497
498 /* Anything above 64 MiB we represent in a multiplier of 128 MiB. */
499 if (memory > 64) {
500 return fmt::format("{} MiB", Ceil(memory, 128));
501 }
502
503 /* Anything else in a multiplier of 4 MiB. */
504 return fmt::format("{} MiB", Ceil(memory, 4));
505}
ai_info.hpp
AIInfo keeps track of all information of an AI, like Author, Description, ...
base_media_base.h
Generic functions for replacing base data (graphics, sounds).
base_media_graphics.h
Generic functions for replacing base graphics data.
base_media_music.h
Generic functions for replacing base music data.
base_media_sounds.h
Generic functions for replacing base sounds data.
BaseMedia< GraphicsSet >::GetUsedSet
static const GraphicsSet * GetUsedSet()
Return the used set.
Definition base_media_func.h:400
BlitterFactory::GetCurrentBlitter
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition factory.hpp:136
Blitter::GetName
virtual std::string_view GetName()=0
Get the name of the blitter, the same as the Factory-instance returns.
Driver::GetName
virtual std::string_view GetName() const =0
Get the name of this driver.
FontCache::GetFontName
virtual std::string GetFontName()=0
Get the name of this font.
FontCache::Get
static FontCache * Get(FontSize fs)
Get the font cache of a given font size.
Definition fontcache.h:130
Game::GetInfo
static class GameInfo * GetInfo()
Get the current GameInfo.
Definition game.hpp:70
MusicDriver::GetInstance
static MusicDriver * GetInstance()
Get the currently active instance of the music driver.
Definition music_driver.hpp:46
SocialIntegrationPlugin::State
State
Definition social_integration.h:15
SocialIntegrationPlugin::PLATFORM_NOT_RUNNING
@ PLATFORM_NOT_RUNNING
The plugin failed to initialize because the Social Platform is not running.
Definition social_integration.h:19
SocialIntegrationPlugin::UNSUPPORTED_API
@ UNSUPPORTED_API
The plugin does not support the current API version.
Definition social_integration.h:22
SocialIntegrationPlugin::RUNNING
@ RUNNING
The plugin is successfully loaded and running.
Definition social_integration.h:16
SocialIntegrationPlugin::FAILED
@ FAILED
The plugin failed to initialize.
Definition social_integration.h:18
SocialIntegrationPlugin::DUPLICATE
@ DUPLICATE
Another plugin of the same Social Platform is already loaded.
Definition social_integration.h:21
SocialIntegrationPlugin::INVALID_SIGNATURE
@ INVALID_SIGNATURE
The signature of the plugin is invalid.
Definition social_integration.h:23
SocialIntegrationPlugin::UNLOADED
@ UNLOADED
The plugin is unloaded upon request.
Definition social_integration.h:20
SocialIntegration::GetPlugins
static std::vector< SocialIntegrationPlugin * > GetPlugins()
Get the list of loaded social integration plugins.
Definition social_integration.cpp:149
SoundDriver::GetInstance
static SoundDriver * GetInstance()
Get the currently active instance of the sound driver.
Definition sound_driver.hpp:35
TimerGameCalendar::ConvertDateToYMD
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
Definition timer_game_calendar.cpp:42
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition timer_game_calendar.h:33
TimerGameCalendar::date_fract
static DateFract date_fract
Fractional part of the day.
Definition timer_game_calendar.h:34
TimerGameEconomy::date
static Date date
Current date in days (day counter).
Definition timer_game_economy.h:38
TimerGameEconomy::date_fract
static DateFract date_fract
Fractional part of the day.
Definition timer_game_economy.h:39
TimerGameEconomy::ConvertDateToYMD
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
Definition timer_game_economy.cpp:47
TimerGameTick::counter
static TickCounter counter
Monotonic counter, in ticks, since start of game.
Definition timer_game_tick.h:60
VideoDriver::GetInstance
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
Definition video_driver.hpp:192
currency.h
Functions to handle different currencies.
GetCustomCurrency
CurrencySpec & GetCustomCurrency()
Get the custom currency.
Definition currency.h:110
factory.hpp
Factory to 'query' all available blitters.
fontcache.h
Functions to read fonts from files and cache them.
game.hpp
Base functions for all Games.
game_info.hpp
GameInfo keeps track of all information of an Game, like Author, Description, ...
_game_session_stats
GameSessionStats _game_session_stats
Statistics about the current session.
Definition gfx.cpp:51
FS_MONO
@ FS_MONO
Index of the monospaced font in the font tables.
Definition gfx_type.h:252
FS_SMALL
@ FS_SMALL
Index of the small font in the font tables.
Definition gfx_type.h:250
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition gfx_type.h:249
FS_LARGE
@ FS_LARGE
Index of the large font in the font tables.
Definition gfx_type.h:251
language.h
Information about languages and their files.
_current_language
const LanguageMetadata * _current_language
The currently loaded language.
Definition strings.cpp:54
CeilDiv
constexpr uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
Definition math_func.hpp:310
Ceil
constexpr uint Ceil(uint a, uint b)
Computes ceil(a / b) * b for non-negative a and b.
Definition math_func.hpp:321
music_driver.hpp
Base for all music playback.
_networking
bool _networking
are we in networking mode?
Definition network.cpp:67
_network_server
bool _network_server
network-server is active
Definition network.cpp:68
network.h
Basic functions/variables used all over the place.
NLOHMANN_JSON_SERIALIZE_ENUM
NLOHMANN_JSON_SERIALIZE_ENUM(NetworkSurveyHandler::Reason, { {NetworkSurveyHandler::Reason::PREVIEW, "preview"}, {NetworkSurveyHandler::Reason::LEAVE, "leave"}, {NetworkSurveyHandler::Reason::EXIT, "exit"}, {NetworkSurveyHandler::Reason::CRASH, "crash"}, }) std
Create the payload for the survey.
Definition network_survey.cpp:24
_grfconfig
GRFConfigList _grfconfig
First item in list of current GRF set up.
Definition newgrf_config.cpp:154
GRFStatus
GRFStatus
Status of GRF.
Definition newgrf_config.h:33
GCS_INITIALISED
@ GCS_INITIALISED
GRF file has been initialised.
Definition newgrf_config.h:37
GCS_DISABLED
@ GCS_DISABLED
GRF file is disabled.
Definition newgrf_config.h:35
GCS_NOT_FOUND
@ GCS_NOT_FOUND
GRF file was not found in the local cache.
Definition newgrf_config.h:36
GCS_UNKNOWN
@ GCS_UNKNOWN
The status of this grf file is unknown.
Definition newgrf_config.h:34
GCS_ACTIVATED
@ GCS_ACTIVATED
GRF file has been activated.
Definition newgrf_config.h:38
Static
@ Static
GRF file is used statically (can be used in any MP game)
Definition newgrf_config.h:23
GRFP_GRF_UNSET
@ GRFP_GRF_UNSET
The NewGRF provided no information.
Definition newgrf_config.h:70
GRFP_BLT_UNSET
@ GRFP_BLT_UNSET
The NewGRF provided no information or doesn't care about a 32 bpp blitter.
Definition newgrf_config.h:76
GRFP_GRF_WINDOWS
@ GRFP_GRF_WINDOWS
The NewGRF says the Windows palette can be used.
Definition newgrf_config.h:72
GRFP_GRF_DOS
@ GRFP_GRF_DOS
The NewGRF says the DOS palette can be used.
Definition newgrf_config.h:71
GRFP_GRF_ANY
@ GRFP_GRF_ANY
The NewGRF says any palette can be used.
Definition newgrf_config.h:73
GRFP_BLT_MASK
@ GRFP_BLT_MASK
Bitmask to only get the blitter information.
Definition newgrf_config.h:78
GRFP_BLT_32BPP
@ GRFP_BLT_32BPP
The NewGRF prefers a 32 bpp blitter.
Definition newgrf_config.h:77
GRFP_GRF_MASK
@ GRFP_GRF_MASK
Bitmask to get only the NewGRF supplied information.
Definition newgrf_config.h:74
rev.h
declaration of OTTD revision dependent variables
safeguards.h
A number of safeguards to prevent using unsafe methods.
SlIsObjectCurrentlyValid
bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to)
Checks if some version from/to combination falls within the range of the active savegame version.
Definition saveload.h:1305
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:61
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition settings.cpp:60
GetSettingDesc
static constexpr const SettingDesc * GetSettingDesc(const SettingVariant &desc)
Helper to convert the type of the iterated settings description to a pointer to it.
Definition settings_internal.h:384
settings_table.h
Definition of the configuration tables of the settings.
settings_type.h
Types related to global configuration settings.
_plugins
static std::vector< std::unique_ptr< InternalSocialIntegrationPlugin > > _plugins
List of loaded plugins.
Definition social_integration.cpp:50
social_integration.h
Interface definitions for game to report/respond to social integration.
sound_driver.hpp
Base for all sound drivers.
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
FormatArrayAsHex
std::string FormatArrayAsHex(std::span< const uint8_t > data)
Format a byte array into a continuous hex string.
Definition string.cpp:77
ClientSettings::company
CompanySettings company
default values for per-company settings
Definition settings_type.h:652
Company
Definition company_base.h:127
GRFConfig
Information about GRF, used in the game and (part of it) in savegames.
Definition newgrf_config.h:158
GRFConfig::param
std::vector< uint32_t > param
GRF parameters.
Definition newgrf_config.h:185
GameSessionStats::start_time
std::chrono::steady_clock::time_point start_time
Time when the current game was started.
Definition openttd.h:56
GameSessionStats::savegame_id
std::string savegame_id
Unique ID of the savegame.
Definition openttd.h:57
GameSessionStats::savegame_size
std::optional< size_t > savegame_size
Size of the last saved savegame in bytes, or std::nullopt if not saved yet.
Definition openttd.h:58
LanguageMetadata::file
std::filesystem::path file
Name of the file we read this data from.
Definition language.h:90
LanguagePackHeader::isocode
char isocode[16]
the ISO code for the language (not country code)
Definition language.h:31
LanguagePackHeader::name
char name[32]
the international name of this language
Definition language.h:29
Pool::PoolItem<&_company_pool >::Iterate
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition pool_type.hpp:436
SaveLoad::version_to
SaveLoadVersion version_to
Save/load the variable before this savegame version.
Definition saveload.h:738
SaveLoad::version_from
SaveLoadVersion version_from
Save/load the variable starting from this savegame version.
Definition saveload.h:737
SettingDesc
Properties of config file settings.
Definition settings_internal.h:71
SettingDesc::GetName
constexpr const std::string & GetName() const
Get the name of this setting.
Definition settings_internal.h:87
SettingDesc::FormatValue
virtual std::string FormatValue(const void *object) const =0
Format the value of the setting associated with this object.
SettingDesc::IsDefaultValue
virtual bool IsDefaultValue(void *object) const =0
Check whether the value is the same as the default value.
SettingDesc::save
SaveLoad save
Internal structure (going to savegame, parts to config).
Definition settings_internal.h:78
SurveySettings
void SurveySettings(nlohmann::json &survey, bool skip_if_default)
Convert settings to JSON.
Definition survey.cpp:164
SurveyPlugins
void SurveyPlugins(nlohmann::json &survey)
Convert plugin information to JSON.
Definition survey.cpp:465
SurveyTimers
void SurveyTimers(nlohmann::json &survey)
Convert timer information to JSON.
Definition survey.cpp:343
SurveySettingsTable
static void SurveySettingsTable(nlohmann::json &survey, const SettingTable &table, void *object, bool skip_if_default)
Convert a settings table to JSON.
Definition survey.cpp:146
SurveyGameSession
void SurveyGameSession(nlohmann::json &survey)
Convert game session information to JSON.
Definition survey.cpp:242
SurveyMemoryToText
std::string SurveyMemoryToText(uint64_t memory)
Change the bytes of memory into a textual version rounded up to the biggest unit.
Definition survey.cpp:488
SurveyGameScript
void SurveyGameScript(nlohmann::json &survey)
Convert game-script information to JSON.
Definition survey.cpp:386
SurveyConfiguration
void SurveyConfiguration(nlohmann::json &survey)
Convert generic game information to JSON.
Definition survey.cpp:256
SurveyOpenTTD
void SurveyOpenTTD(nlohmann::json &survey)
Convert generic OpenTTD information to JSON.
Definition survey.cpp:210
SurveyFont
void SurveyFont(nlohmann::json &survey)
Convert font information to JSON.
Definition survey.cpp:299
SurveyCompanies
void SurveyCompanies(nlohmann::json &survey)
Convert company information to JSON.
Definition survey.cpp:312
GenericSettingTables
static auto & GenericSettingTables()
List of all the generic setting tables.
Definition survey.cpp:119
SurveyCompiler
void SurveyCompiler(nlohmann::json &survey)
Convert compiler information to JSON.
Definition survey.cpp:182
SurveyLibraries
void SurveyLibraries(nlohmann::json &survey)
Convert compiled libraries information to JSON.
Definition survey.cpp:398
_vehicle_type_to_string
static const std::string _vehicle_type_to_string[]
Lookup table to convert a VehicleType to a string.
Definition survey.cpp:102
SurveyGrfs
void SurveyGrfs(nlohmann::json &survey)
Convert GRF information to JSON.
Definition survey.cpp:359
survey.h
Functions to survey the current game / system, for crashlog and network-survey.
timer_game_calendar.h
Definition of the game-calendar-timer.
timer_game_economy.h
Definition of the game-economy-timer.
timer_game_tick.h
Definition of the tick-based game-timer.
VehicleType
VehicleType
Available vehicle types.
Definition vehicle_type.h:22
VEH_COMPANY_END
@ VEH_COMPANY_END
Last company-ownable type.
Definition vehicle_type.h:30
video_driver.hpp
Base of all video drivers.
FS2OTTD
std::string FS2OTTD(std::wstring_view name)
Convert to OpenTTD's encoding from a wide string.
Definition win32.cpp:340