OpenTTD Source  14.0-beta3
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 <http://www.gnu.org/licenses/>.
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"
21 
22 #include "currency.h"
23 #include "fontcache.h"
24 #include "language.h"
25 
26 #include "ai/ai_info.hpp"
27 #include "game/game.hpp"
28 #include "game/game_info.hpp"
29 
30 #include "music/music_driver.hpp"
31 #include "sound/sound_driver.hpp"
32 #include "video/video_driver.hpp"
33 
34 #include "base_media_base.h"
35 #include "blitter/factory.hpp"
36 
37 #include "social_integration.h"
38 
39 #ifdef WITH_ALLEGRO
40 # include <allegro.h>
41 #endif /* WITH_ALLEGRO */
42 #ifdef WITH_FONTCONFIG
43 # include <fontconfig/fontconfig.h>
44 #endif /* WITH_FONTCONFIG */
45 #ifdef WITH_PNG
46  /* pngconf.h, included by png.h doesn't like something in the
47  * freetype headers. As such it's not alphabetically sorted. */
48 # include <png.h>
49 #endif /* WITH_PNG */
50 #ifdef WITH_FREETYPE
51 # include <ft2build.h>
52 # include FT_FREETYPE_H
53 #endif /* WITH_FREETYPE */
54 #ifdef WITH_HARFBUZZ
55 # include <hb.h>
56 #endif /* WITH_HARFBUZZ */
57 #ifdef WITH_ICU_I18N
58 # include <unicode/uversion.h>
59 #endif /* WITH_ICU_I18N */
60 #ifdef WITH_LIBLZMA
61 # include <lzma.h>
62 #endif
63 #ifdef WITH_LZO
64 #include <lzo/lzo1x.h>
65 #endif
66 #if defined(WITH_SDL) || defined(WITH_SDL2)
67 # include <SDL.h>
68 #endif /* WITH_SDL || WITH_SDL2 */
69 #ifdef WITH_ZLIB
70 # include <zlib.h>
71 #endif
72 #ifdef WITH_CURL
73 # include <curl/curl.h>
74 #endif
75 
76 #include "safeguards.h"
77 
79  {GRFStatus::GCS_UNKNOWN, "unknown"},
80  {GRFStatus::GCS_DISABLED, "disabled"},
81  {GRFStatus::GCS_NOT_FOUND, "not found"},
82  {GRFStatus::GCS_INITIALISED, "initialised"},
83  {GRFStatus::GCS_ACTIVATED, "activated"},
84 })
85 
87  {SocialIntegrationPlugin::State::RUNNING, "running"},
88  {SocialIntegrationPlugin::State::FAILED, "failed"},
89  {SocialIntegrationPlugin::State::PLATFORM_NOT_RUNNING, "platform_not_running"},
90  {SocialIntegrationPlugin::State::UNLOADED, "unloaded"},
91  {SocialIntegrationPlugin::State::DUPLICATE, "duplicate"},
92  {SocialIntegrationPlugin::State::UNSUPPORTED_API, "unsupported_api"},
93  {SocialIntegrationPlugin::State::INVALID_SIGNATURE, "invalid_signature"},
94 })
95 
96 
98 static const std::string _vehicle_type_to_string[] = {
99  "train",
100  "roadveh",
101  "ship",
102  "aircraft",
103 };
104 
115 static auto &GenericSettingTables()
116 {
117  static const SettingTable _generic_setting_tables[] = {
118  _difficulty_settings,
119  _economy_settings,
120  _game_settings,
121  _gui_settings,
122  _linkgraph_settings,
123  _locale_settings,
124  _multimedia_settings,
125  _network_settings,
126  _news_display_settings,
127  _pathfinding_settings,
128  _script_settings,
129  _world_settings,
130  };
131  return _generic_setting_tables;
132 }
133 
142 static void SurveySettingsTable(nlohmann::json &survey, const SettingTable &table, void *object, bool skip_if_default)
143 {
144  for (auto &desc : table) {
145  const SettingDesc *sd = GetSettingDesc(desc);
146  /* Skip any old settings we no longer save/load. */
147  if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
148 
149  auto name = sd->GetName();
150  if (skip_if_default && sd->IsDefaultValue(object)) continue;
151  survey[name] = sd->FormatValue(object);
152  }
153 }
154 
160 void SurveySettings(nlohmann::json &survey, bool skip_if_default)
161 {
162  SurveySettingsTable(survey, _misc_settings, nullptr, skip_if_default);
163 #if defined(_WIN32) && !defined(DEDICATED)
164  SurveySettingsTable(survey, _win32_settings, nullptr, skip_if_default);
165 #endif
166  for (auto &table : GenericSettingTables()) {
167  SurveySettingsTable(survey, table, &_settings_game, skip_if_default);
168  }
169  SurveySettingsTable(survey, _currency_settings, &_custom_currency, skip_if_default);
170  SurveySettingsTable(survey, _company_settings, &_settings_client.company, skip_if_default);
171 }
172 
178 void SurveyCompiler(nlohmann::json &survey)
179 {
180 #if defined(_MSC_VER)
181  survey["name"] = "MSVC";
182  survey["version"] = _MSC_VER;
183 #elif defined(__ICC) && defined(__GNUC__)
184  survey["name"] = "ICC";
185  survey["version"] = __ICC;
186 # if defined(__GNUC__)
187  survey["extra"] = fmt::format("GCC {}.{}.{} mode", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
188 # endif
189 #elif defined(__GNUC__)
190  survey["name"] = "GCC";
191  survey["version"] = fmt::format("{}.{}.{}", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
192 #else
193  survey["name"] = "unknown";
194 #endif
195 
196 #if defined(__VERSION__)
197  survey["extra"] = __VERSION__;
198 #endif
199 }
200 
206 void SurveyOpenTTD(nlohmann::json &survey)
207 {
208  survey["version"]["revision"] = std::string(_openttd_revision);
209  survey["version"]["modified"] = _openttd_revision_modified;
210  survey["version"]["tagged"] = _openttd_revision_tagged;
211  survey["version"]["hash"] = std::string(_openttd_revision_hash);
212  survey["version"]["newgrf"] = fmt::format("{:X}", _openttd_newgrf_version);
213  survey["version"]["content"] = std::string(_openttd_content_version);
214  survey["build_date"] = std::string(_openttd_build_date);
215  survey["bits"] =
216 #ifdef POINTER_IS_64BIT
217  64
218 #else
219  32
220 #endif
221  ;
222  survey["endian"] =
223 #if (TTD_ENDIAN == TTD_LITTLE_ENDIAN)
224  "little"
225 #else
226  "big"
227 #endif
228  ;
229  survey["dedicated_build"] =
230 #ifdef DEDICATED
231  "yes"
232 #else
233  "no"
234 #endif
235  ;
236 }
237 
243 void SurveyConfiguration(nlohmann::json &survey)
244 {
245  survey["network"] = _networking ? (_network_server ? "server" : "client") : "no";
246  if (_current_language != nullptr) {
247  survey["language"]["filename"] = _current_language->file.filename().string();
248  survey["language"]["name"] = _current_language->name;
249  survey["language"]["isocode"] = _current_language->isocode;
250  }
251  if (BlitterFactory::GetCurrentBlitter() != nullptr) {
252  survey["blitter"] = BlitterFactory::GetCurrentBlitter()->GetName();
253  }
254  if (MusicDriver::GetInstance() != nullptr) {
255  survey["music_driver"] = MusicDriver::GetInstance()->GetName();
256  }
257  if (SoundDriver::GetInstance() != nullptr) {
258  survey["sound_driver"] = SoundDriver::GetInstance()->GetName();
259  }
260  if (VideoDriver::GetInstance() != nullptr) {
261  survey["video_driver"] = VideoDriver::GetInstance()->GetName();
262  survey["video_info"] = VideoDriver::GetInstance()->GetInfoString();
263  }
264  if (BaseGraphics::GetUsedSet() != nullptr) {
265  survey["graphics_set"] = fmt::format("{}.{}", BaseGraphics::GetUsedSet()->name, BaseGraphics::GetUsedSet()->version);
266  const GRFConfig *extra_cfg = BaseGraphics::GetUsedSet()->GetExtraConfig();
267  if (extra_cfg != nullptr && extra_cfg->num_params > 0) {
268  survey["graphics_set_parameters"] = std::span<const uint32_t>(extra_cfg->param.data(), extra_cfg->num_params);
269  } else {
270  survey["graphics_set_parameters"] = std::span<const uint32_t>();
271  }
272  }
273  if (BaseMusic::GetUsedSet() != nullptr) {
274  survey["music_set"] = fmt::format("{}.{}", BaseMusic::GetUsedSet()->name, BaseMusic::GetUsedSet()->version);
275  }
276  if (BaseSounds::GetUsedSet() != nullptr) {
277  survey["sound_set"] = fmt::format("{}.{}", BaseSounds::GetUsedSet()->name, BaseSounds::GetUsedSet()->version);
278  }
279 }
280 
286 void SurveyFont(nlohmann::json &survey)
287 {
288  survey["small"] = FontCache::Get(FS_SMALL)->GetFontName();
289  survey["medium"] = FontCache::Get(FS_NORMAL)->GetFontName();
290  survey["large"] = FontCache::Get(FS_LARGE)->GetFontName();
291  survey["mono"] = FontCache::Get(FS_MONO)->GetFontName();
292 }
293 
299 void SurveyCompanies(nlohmann::json &survey)
300 {
301  for (const Company *c : Company::Iterate()) {
302  auto &company = survey[std::to_string(c->index)];
303  if (c->ai_info == nullptr) {
304  company["type"] = "human";
305  } else {
306  company["type"] = "ai";
307  company["script"] = fmt::format("{}.{}", c->ai_info->GetName(), c->ai_info->GetVersion());
308  }
309 
310  for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
311  uint amount = c->group_all[type].num_vehicle;
312  company["vehicles"][_vehicle_type_to_string[type]] = amount;
313  }
314 
315  company["infrastructure"]["road"] = c->infrastructure.GetRoadTotal();
316  company["infrastructure"]["tram"] = c->infrastructure.GetTramTotal();
317  company["infrastructure"]["rail"] = c->infrastructure.GetRailTotal();
318  company["infrastructure"]["signal"] = c->infrastructure.signal;
319  company["infrastructure"]["water"] = c->infrastructure.water;
320  company["infrastructure"]["station"] = c->infrastructure.station;
321  company["infrastructure"]["airport"] = c->infrastructure.airport;
322  }
323 }
324 
330 void SurveyTimers(nlohmann::json &survey)
331 {
332  survey["ticks"] = TimerGameTick::counter;
333  survey["seconds"] = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - _switch_mode_time).count();
334 
335  TimerGameEconomy::YearMonthDay economy_ymd = TimerGameEconomy::ConvertDateToYMD(TimerGameEconomy::date);
336  survey["economy"] = fmt::format("{:04}-{:02}-{:02} ({})", economy_ymd.year, economy_ymd.month + 1, economy_ymd.day, TimerGameEconomy::date_fract);
337 
338  TimerGameCalendar::YearMonthDay ymd = TimerGameCalendar::ConvertDateToYMD(TimerGameCalendar::date);
339  survey["calendar"] = fmt::format("{:04}-{:02}-{:02} ({})", ymd.year, ymd.month + 1, ymd.day, TimerGameCalendar::date_fract);
340 }
341 
347 void SurveyGrfs(nlohmann::json &survey)
348 {
349  for (GRFConfig *c = _grfconfig; c != nullptr; c = c->next) {
350  auto grfid = fmt::format("{:08x}", BSWAP32(c->ident.grfid));
351  auto &grf = survey[grfid];
352 
353  grf["md5sum"] = FormatArrayAsHex(c->ident.md5sum);
354  grf["status"] = c->status;
355 
356  if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_UNSET) grf["palette"] = "unset";
357  if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_DOS) grf["palette"] = "dos";
358  if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_WINDOWS) grf["palette"] = "windows";
359  if ((c->palette & GRFP_GRF_MASK) == GRFP_GRF_ANY) grf["palette"] = "any";
360 
361  if ((c->palette & GRFP_BLT_MASK) == GRFP_BLT_UNSET) grf["blitter"] = "unset";
362  if ((c->palette & GRFP_BLT_MASK) == GRFP_BLT_32BPP) grf["blitter"] = "32bpp";
363 
364  grf["is_static"] = HasBit(c->flags, GCF_STATIC);
365  grf["parameters"] = std::span<const uint32_t>(c->param.data(), c->num_params);
366  }
367 }
368 
374 void SurveyGameScript(nlohmann::json &survey)
375 {
376  if (Game::GetInfo() == nullptr) return;
377 
378  survey = fmt::format("{}.{}", Game::GetInfo()->GetName(), Game::GetInfo()->GetVersion());
379 }
380 
386 void SurveyLibraries(nlohmann::json &survey)
387 {
388 #ifdef WITH_ALLEGRO
389  survey["allegro"] = std::string(allegro_id);
390 #endif /* WITH_ALLEGRO */
391 
392 #ifdef WITH_FONTCONFIG
393  int version = FcGetVersion();
394  survey["fontconfig"] = fmt::format("{}.{}.{}", version / 10000, (version / 100) % 100, version % 100);
395 #endif /* WITH_FONTCONFIG */
396 
397 #ifdef WITH_FREETYPE
398  FT_Library library;
399  int major, minor, patch;
400  FT_Init_FreeType(&library);
401  FT_Library_Version(library, &major, &minor, &patch);
402  FT_Done_FreeType(library);
403  survey["freetype"] = fmt::format("{}.{}.{}", major, minor, patch);
404 #endif /* WITH_FREETYPE */
405 
406 #if defined(WITH_HARFBUZZ)
407  survey["harfbuzz"] = hb_version_string();
408 #endif /* WITH_HARFBUZZ */
409 
410 #if defined(WITH_ICU_I18N)
411  /* 4 times 0-255, separated by dots (.) and a trailing '\0' */
412  char buf[4 * 3 + 3 + 1];
413  UVersionInfo ver;
414  u_getVersion(ver);
415  u_versionToString(ver, buf);
416  survey["icu_i18n"] = buf;
417 #endif /* WITH_ICU_I18N */
418 
419 #ifdef WITH_LIBLZMA
420  survey["lzma"] = lzma_version_string();
421 #endif
422 
423 #ifdef WITH_LZO
424  survey["lzo"] = lzo_version_string();
425 #endif
426 
427 #ifdef WITH_PNG
428  survey["png"] = png_get_libpng_ver(nullptr);
429 #endif /* WITH_PNG */
430 
431 #ifdef WITH_SDL
432  const SDL_version *sdl_v = SDL_Linked_Version();
433  survey["sdl"] = fmt::format("{}.{}.{}", sdl_v->major, sdl_v->minor, sdl_v->patch);
434 #elif defined(WITH_SDL2)
435  SDL_version sdl2_v;
436  SDL_GetVersion(&sdl2_v);
437  survey["sdl2"] = fmt::format("{}.{}.{}", sdl2_v.major, sdl2_v.minor, sdl2_v.patch);
438 #endif
439 
440 #ifdef WITH_ZLIB
441  survey["zlib"] = zlibVersion();
442 #endif
443 
444 #ifdef WITH_CURL
445  auto *curl_v = curl_version_info(CURLVERSION_NOW);
446  survey["curl"] = curl_v->version;
447  survey["curl_ssl"] = curl_v->ssl_version == nullptr ? "none" : curl_v->ssl_version;
448 #endif
449 }
450 
456 void SurveyPlugins(nlohmann::json &survey)
457 {
459 
460  for (auto &plugin : _plugins) {
461  auto &platform = survey[plugin->social_platform];
462  platform.push_back({
463  {"name", plugin->name},
464  {"version", plugin->version},
465  {"basepath", plugin->basepath},
466  {"state", plugin->state},
467  });
468  }
469 }
470 
479 std::string SurveyMemoryToText(uint64_t memory)
480 {
481  memory = memory / 1024; // KiB
482  memory = CeilDiv(memory, 1024); // MiB
483 
484  /* Anything above 512 MiB we represent in GiB. */
485  if (memory > 512) {
486  return fmt::format("{} GiB", CeilDiv(memory, 1024));
487  }
488 
489  /* Anything above 64 MiB we represent in a multiplier of 128 MiB. */
490  if (memory > 64) {
491  return fmt::format("{} MiB", Ceil(memory, 128));
492  }
493 
494  /* Anything else in a multiplier of 4 MiB. */
495  return fmt::format("{} MiB", Ceil(memory, 4));
496 }
SurveyConfiguration
void SurveyConfiguration(nlohmann::json &survey)
Convert generic game information to JSON.
Definition: survey.cpp:243
game.hpp
SaveLoad::version_to
SaveLoadVersion version_to
Save/load the variable before this savegame version.
Definition: saveload.h:700
social_integration.h
factory.hpp
FormatArrayAsHex
std::string FormatArrayAsHex(std::span< const byte > data)
Format a byte array into a continuous hex string.
Definition: string.cpp:88
SurveyLibraries
void SurveyLibraries(nlohmann::json &survey)
Convert compiled libraries information to JSON.
Definition: survey.cpp:386
SurveyTimers
void SurveyTimers(nlohmann::json &survey)
Convert timer information to JSON.
Definition: survey.cpp:330
TimerGameTick::counter
static TickCounter counter
Monotonic counter, in ticks, since start of game.
Definition: timer_game_tick.h:33
Driver::GetName
virtual const char * GetName() const =0
Get the name of this driver.
SettingDesc::IsDefaultValue
virtual bool IsDefaultValue(void *object) const =0
Check whether the value is the same as the default value.
GCS_ACTIVATED
@ GCS_ACTIVATED
GRF file has been activated.
Definition: newgrf_config.h:39
GRFStatus
GRFStatus
Status of GRF.
Definition: newgrf_config.h:34
game_info.hpp
Ceil
constexpr uint Ceil(uint a, uint b)
Computes ceil(a / b) * b for non-negative a and b.
Definition: math_func.hpp:331
TimerGameCalendar::date_fract
static DateFract date_fract
Fractional part of the day.
Definition: timer_game_calendar.h:35
timer_game_calendar.h
currency.h
_network_server
bool _network_server
network-server is active
Definition: network.cpp:60
Game::GetInfo
static class GameInfo * GetInfo()
Get the current GameInfo.
Definition: game.hpp:76
SettingDesc::save
SaveLoad save
Internal structure (going to savegame, parts to config).
Definition: settings_internal.h:78
FS_LARGE
@ FS_LARGE
Index of the large font in the font tables.
Definition: gfx_type.h:205
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:479
GCS_NOT_FOUND
@ GCS_NOT_FOUND
GRF file was not found in the local cache.
Definition: newgrf_config.h:37
base_media_base.h
CeilDiv
constexpr uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
Definition: math_func.hpp:320
TimerGameEconomy::date_fract
static DateFract date_fract
Fractional part of the day.
Definition: timer_game_economy.h:38
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:54
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
ai_info.hpp
SurveySettings
void SurveySettings(nlohmann::json &survey, bool skip_if_default)
Convert settings to JSON.
Definition: survey.cpp:160
GRFP_GRF_DOS
@ GRFP_GRF_DOS
The NewGRF says the DOS palette can be used.
Definition: newgrf_config.h:71
BSWAP32
static uint32_t BSWAP32(uint32_t x)
Perform a 32 bits endianness bitswap on x.
Definition: bitmath_func.hpp:345
survey.h
GCS_INITIALISED
@ GCS_INITIALISED
GRF file has been initialised.
Definition: newgrf_config.h:38
GRFConfig
Information about GRF, used in the game and (part of it) in savegames.
Definition: newgrf_config.h:147
MusicDriver::GetInstance
static MusicDriver * GetInstance()
Get the currently active instance of the music driver.
Definition: music_driver.hpp:46
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition: gfx_type.h:203
VEH_COMPANY_END
@ VEH_COMPANY_END
Last company-ownable type.
Definition: vehicle_type.h:29
GRFP_GRF_ANY
@ GRFP_GRF_ANY
The NewGRF says any palette can be used.
Definition: newgrf_config.h:73
SettingDesc::GetName
constexpr const std::string & GetName() const
Get the name of this setting.
Definition: settings_internal.h:87
FS_SMALL
@ FS_SMALL
Index of the small font in the font tables.
Definition: gfx_type.h:204
SettingDesc::FormatValue
virtual std::string FormatValue(const void *object) const =0
Format the value of the setting associated with this object.
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:55
BlitterFactory::GetCurrentBlitter
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition: factory.hpp:138
timer_game_tick.h
LanguagePackHeader::name
char name[32]
the international name of this language
Definition: language.h:29
SurveyOpenTTD
void SurveyOpenTTD(nlohmann::json &survey)
Convert generic OpenTTD information to JSON.
Definition: survey.cpp:206
SurveyCompanies
void SurveyCompanies(nlohmann::json &survey)
Convert company information to JSON.
Definition: survey.cpp:299
_current_language
const LanguageMetadata * _current_language
The currently loaded language.
Definition: strings.cpp:54
TimerGameCalendar::ConvertDateToYMD
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
Definition: timer_game_calendar.cpp:42
safeguards.h
music_driver.hpp
GRFP_BLT_32BPP
@ GRFP_BLT_32BPP
The NewGRF prefers a 32 bpp blitter.
Definition: newgrf_config.h:77
_switch_mode_time
std::chrono::steady_clock::time_point _switch_mode_time
The time when the switch mode was requested.
Definition: gfx.cpp:49
_networking
bool _networking
are we in networking mode?
Definition: network.cpp:59
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:373
settings_type.h
GRFP_GRF_MASK
@ GRFP_GRF_MASK
Bitmask to get only the NewGRF supplied information.
Definition: newgrf_config.h:74
language.h
SurveyGrfs
void SurveyGrfs(nlohmann::json &survey)
Convert GRF information to JSON.
Definition: survey.cpp:347
TimerGameEconomy::ConvertDateToYMD
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
Definition: timer_game_economy.cpp:46
stdafx.h
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
settings_table.h
VideoDriver::GetInstance
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
Definition: video_driver.hpp:200
LanguagePackHeader::isocode
char isocode[16]
the ISO code for the language (not country code)
Definition: language.h:31
sound_driver.hpp
GCS_UNKNOWN
@ GCS_UNKNOWN
The status of this grf file is unknown.
Definition: newgrf_config.h:35
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:1230
LanguageMetadata::file
std::filesystem::path file
Name of the file we read this data from.
Definition: language.h:94
GenericSettingTables
static auto & GenericSettingTables()
List of all the generic setting tables.
Definition: survey.cpp:115
Blitter::GetName
virtual const char * GetName()=0
Get the name of the blitter, the same as the Factory-instance returns.
GCS_DISABLED
@ GCS_DISABLED
GRF file is disabled.
Definition: newgrf_config.h:36
rev.h
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:384
GRFP_GRF_WINDOWS
@ GRFP_GRF_WINDOWS
The NewGRF says the Windows palette can be used.
Definition: newgrf_config.h:72
_plugins
static std::vector< std::unique_ptr< InternalSocialIntegrationPlugin > > _plugins
List of loaded plugins.
Definition: social_integration.cpp:50
FontCache::GetFontName
virtual std::string GetFontName()=0
Get the name of this font.
GRFConfig::param
std::array< uint32_t, 0x80 > param
GRF parameters.
Definition: newgrf_config.h:167
SettingDesc
Properties of config file settings.
Definition: settings_internal.h:71
SurveyCompiler
void SurveyCompiler(nlohmann::json &survey)
Convert compiler information to JSON.
Definition: survey.cpp:178
_vehicle_type_to_string
static const std::string _vehicle_type_to_string[]
Lookup table to convert a VehicleType to a string.
Definition: survey.cpp:98
video_driver.hpp
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:142
GRFConfig::next
struct GRFConfig * next
NOSAVE: Next item in the linked list.
Definition: newgrf_config.h:174
SaveLoad::version_from
SaveLoadVersion version_from
Save/load the variable starting from this savegame version.
Definition: saveload.h:699
network.h
_grfconfig
GRFConfig * _grfconfig
First item in list of current GRF set up.
Definition: newgrf_config.cpp:164
GRFConfig::num_params
uint8_t num_params
Number of used parameters.
Definition: newgrf_config.h:168
FS_MONO
@ FS_MONO
Index of the monospaced font in the font tables.
Definition: gfx_type.h:206
SoundDriver::GetInstance
static SoundDriver * GetInstance()
Get the currently active instance of the sound driver.
Definition: sound_driver.hpp:35
fontcache.h
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition: timer_game_calendar.h:34
ClientSettings::company
CompanySettings company
default values for per-company settings
Definition: settings_type.h:638
BaseMedia< GraphicsSet >::GetUsedSet
static const GraphicsSet * GetUsedSet()
Return the used set.
Definition: base_media_func.h:394
SocialIntegrationPlugin::State
State
Definition: social_integration.h:15
Company
Definition: company_base.h:116
SurveyGameScript
void SurveyGameScript(nlohmann::json &survey)
Convert game-script information to JSON.
Definition: survey.cpp:374
SurveyFont
void SurveyFont(nlohmann::json &survey)
Convert font information to JSON.
Definition: survey.cpp:286
SurveyPlugins
void SurveyPlugins(nlohmann::json &survey)
Convert plugin information to JSON.
Definition: survey.cpp:456
SocialIntegration::GetPlugins
static std::vector< SocialIntegrationPlugin * > GetPlugins()
Get the list of loaded social integration plugins.
Definition: social_integration.cpp:149
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:26
timer_game_economy.h
GCF_STATIC
@ GCF_STATIC
GRF file is used statically (can be used in any MP game)
Definition: newgrf_config.h:25
FontCache::Get
static FontCache * Get(FontSize fs)
Get the font cache of a given font size.
Definition: fontcache.h:144
TimerGameEconomy::date
static Date date
Current date in days (day counter).
Definition: timer_game_economy.h:37
GRFP_BLT_MASK
@ GRFP_BLT_MASK
Bitmask to only get the blitter information.
Definition: newgrf_config.h:78
HasBit
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103