|
OpenTTD Source 20251116-master-g21329071df
|
Functions to survey the current game / system, for crashlog and network-survey. More...
#include "stdafx.h"#include "survey.h"#include "settings_table.h"#include "network/network.h"#include "rev.h"#include "settings_type.h"#include "timer/timer_game_tick.h"#include "timer/timer_game_calendar.h"#include "timer/timer_game_economy.h"#include "3rdparty/fmt/ranges.h"#include "currency.h"#include "fontcache.h"#include "language.h"#include "ai/ai_info.hpp"#include "game/game.hpp"#include "game/game_info.hpp"#include "music/music_driver.hpp"#include "sound/sound_driver.hpp"#include "video/video_driver.hpp"#include "base_media_base.h"#include "base_media_graphics.h"#include "base_media_music.h"#include "base_media_sounds.h"#include "blitter/factory.hpp"#include "social_integration.h"#include <fontconfig/fontconfig.h>#include <png.h>#include <ft2build.h>#include <FT_FREETYPE_H>#include <hb.h>#include <unicode/uversion.h>#include <lzma.h>#include <lzo/lzo1x.h>#include <SDL.h>#include <zlib.h>#include "safeguards.h"Go to the source code of this file.
Functions | |
| NLOHMANN_JSON_SERIALIZE_ENUM (GRFStatus, { {GRFStatus::GCS_UNKNOWN, "unknown"}, {GRFStatus::GCS_DISABLED, "disabled"}, {GRFStatus::GCS_NOT_FOUND, "not found"}, {GRFStatus::GCS_INITIALISED, "initialised"}, {GRFStatus::GCS_ACTIVATED, "activated"}, }) NLOHMANN_JSON_SERIALIZE_ENUM(SocialIntegrationPlugin | |
| static auto & | GenericSettingTables () |
| List of all the generic setting tables. | |
| static void | SurveySettingsTable (nlohmann::json &survey, const SettingTable &table, void *object, bool skip_if_default) |
| Convert a settings table to JSON. | |
| void | SurveySettings (nlohmann::json &survey, bool skip_if_default) |
| Convert settings to JSON. | |
| void | SurveyCompiler (nlohmann::json &survey) |
| Convert compiler information to JSON. | |
| void | SurveyOpenTTD (nlohmann::json &survey) |
| Convert generic OpenTTD information to JSON. | |
| void | SurveyGameSession (nlohmann::json &survey) |
| Convert game session information to JSON. | |
| void | SurveyConfiguration (nlohmann::json &survey) |
| Convert generic game information to JSON. | |
| void | SurveyFont (nlohmann::json &survey) |
| Convert font information to JSON. | |
| void | SurveyCompanies (nlohmann::json &survey) |
| Convert company information to JSON. | |
| void | SurveyTimers (nlohmann::json &survey) |
| Convert timer information to JSON. | |
| void | SurveyGrfs (nlohmann::json &survey) |
| Convert GRF information to JSON. | |
| void | SurveyGameScript (nlohmann::json &survey) |
| Convert game-script information to JSON. | |
| void | SurveyLibraries (nlohmann::json &survey) |
| Convert compiled libraries information to JSON. | |
| void | SurveyPlugins (nlohmann::json &survey) |
| Convert plugin information to JSON. | |
| std::string | SurveyMemoryToText (uint64_t memory) |
| Change the bytes of memory into a textual version rounded up to the biggest unit. | |
Variables | |
| static const std::string | _vehicle_type_to_string [] |
| Lookup table to convert a VehicleType to a string. | |
Functions to survey the current game / system, for crashlog and network-survey.
Definition in file survey.cpp.
|
static |
List of all the generic setting tables.
There are a few tables that are special and not processed like the rest:
Definition at line 119 of file survey.cpp.
Referenced by SurveySettings().
| NLOHMANN_JSON_SERIALIZE_ENUM | ( | GRFStatus | , |
| { {GRFStatus::GCS_UNKNOWN, "unknown"}, {GRFStatus::GCS_DISABLED, "disabled"}, {GRFStatus::GCS_NOT_FOUND, "not found"}, {GRFStatus::GCS_INITIALISED, "initialised"}, {GRFStatus::GCS_ACTIVATED, "activated"}, } | |||
| ) |
Definition at line 82 of file survey.cpp.
| void SurveyCompanies | ( | nlohmann::json & | survey | ) |
Convert company information to JSON.
| survey | The JSON object. |
Definition at line 312 of file survey.cpp.
References _vehicle_type_to_string, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Iterate(), and VEH_COMPANY_END.
Referenced by CrashLog::FillCrashLog().
| void SurveyCompiler | ( | nlohmann::json & | survey | ) |
Convert compiler information to JSON.
| survey | The JSON object. |
Definition at line 182 of file survey.cpp.
Referenced by CrashLog::FillCrashLog().
| void SurveyConfiguration | ( | nlohmann::json & | survey | ) |
Convert generic game information to JSON.
| survey | The JSON object. |
Definition at line 256 of file survey.cpp.
References _current_language, _network_server, _networking, LanguageMetadata::file, FS2OTTD(), BlitterFactory::GetCurrentBlitter(), MusicDriver::GetInstance(), SoundDriver::GetInstance(), VideoDriver::GetInstance(), Driver::GetName(), Blitter::GetName(), BaseMedia< MusicSet >::GetUsedSet(), BaseMedia< SoundsSet >::GetUsedSet(), BaseMedia< GraphicsSet >::GetUsedSet(), LanguagePackHeader::isocode, LanguagePackHeader::name, and GRFConfig::param.
Referenced by CrashLog::FillCrashLog().
| void SurveyFont | ( | nlohmann::json & | survey | ) |
Convert font information to JSON.
| survey | The JSON object. |
Definition at line 299 of file survey.cpp.
References FS_LARGE, FS_MONO, FS_NORMAL, FS_SMALL, FontCache::Get(), and FontCache::GetFontName().
Referenced by CrashLog::FillCrashLog().
| void SurveyGameScript | ( | nlohmann::json & | survey | ) |
Convert game-script information to JSON.
| survey | The JSON object. |
Definition at line 386 of file survey.cpp.
References Game::GetInfo().
Referenced by CrashLog::FillCrashLog().
| void SurveyGameSession | ( | nlohmann::json & | survey | ) |
Convert game session information to JSON.
| survey | The JSON object. |
Definition at line 242 of file survey.cpp.
References _game_session_stats, GameSessionStats::savegame_id, GameSessionStats::savegame_size, and GameSessionStats::start_time.
Referenced by CrashLog::FillCrashLog().
| void SurveyGrfs | ( | nlohmann::json & | survey | ) |
Convert GRF information to JSON.
| survey | The JSON object. |
Definition at line 359 of file survey.cpp.
References _grfconfig, FormatArrayAsHex(), GRFP_BLT_32BPP, GRFP_BLT_MASK, GRFP_BLT_UNSET, GRFP_GRF_ANY, GRFP_GRF_DOS, GRFP_GRF_MASK, GRFP_GRF_UNSET, GRFP_GRF_WINDOWS, and Static.
Referenced by CrashLog::FillCrashLog().
| void SurveyLibraries | ( | nlohmann::json & | survey | ) |
Convert compiled libraries information to JSON.
| survey | The JSON object. |
Definition at line 398 of file survey.cpp.
Referenced by CrashLog::FillCrashLog().
| std::string SurveyMemoryToText | ( | uint64_t | memory | ) |
Change the bytes of memory into a textual version rounded up to the biggest unit.
For example, 16751108096 would become 16 GiB.
| memory | The bytes of memory. |
Definition at line 488 of file survey.cpp.
| void SurveyOpenTTD | ( | nlohmann::json & | survey | ) |
Convert generic OpenTTD information to JSON.
| survey | The JSON object. |
Definition at line 210 of file survey.cpp.
Referenced by CrashLog::FillCrashLog().
| void SurveyPlugins | ( | nlohmann::json & | survey | ) |
Convert plugin information to JSON.
| survey | The JSON object. |
Definition at line 465 of file survey.cpp.
References _plugins, and SocialIntegration::GetPlugins().
Referenced by CrashLog::FillCrashLog().
| void SurveySettings | ( | nlohmann::json & | survey, |
| bool | skip_if_default | ||
| ) |
Convert settings to JSON.
| survey | The JSON object. |
Definition at line 164 of file survey.cpp.
References _settings_client, _settings_game, ClientSettings::company, GenericSettingTables(), GetCustomCurrency(), and SurveySettingsTable().
Referenced by CrashLog::FillCrashLog().
|
static |
Convert a settings table to JSON.
| survey | The JSON object. |
| table | The settings table to convert. |
| object | The object to get the settings from. |
| skip_if_default | If true, skip any settings that are on their default value. |
Definition at line 146 of file survey.cpp.
References SettingDesc::FormatValue(), SettingDesc::GetName(), GetSettingDesc(), SettingDesc::IsDefaultValue(), SettingDesc::save, SlIsObjectCurrentlyValid(), SaveLoad::version_from, and SaveLoad::version_to.
Referenced by SurveySettings().
| void SurveyTimers | ( | nlohmann::json & | survey | ) |
Convert timer information to JSON.
| survey | The JSON object. |
Definition at line 343 of file survey.cpp.
References TimerGameCalendar::ConvertDateToYMD(), TimerGameEconomy::ConvertDateToYMD(), TimerGameTick::counter, TimerGameCalendar::date, TimerGameEconomy::date, TimerGameCalendar::date_fract, and TimerGameEconomy::date_fract.
Referenced by CrashLog::FillCrashLog().
|
static |
Lookup table to convert a VehicleType to a string.
Definition at line 102 of file survey.cpp.
Referenced by SurveyCompanies().