mirror of https://github.com/OpenTTD/OpenTTD
Add: Social Plugin information in the survey / crashlog
parent
4a61104b91
commit
02e772db66
|
@ -122,6 +122,9 @@ void CrashLog::FillCrashLog()
|
||||||
if (!this->TryExecute("libraries", [&info]() { SurveyLibraries(info["libraries"]); return true; })) {
|
if (!this->TryExecute("libraries", [&info]() { SurveyLibraries(info["libraries"]); return true; })) {
|
||||||
info["libraries"] = "crashed while gathering information";
|
info["libraries"] = "crashed while gathering information";
|
||||||
}
|
}
|
||||||
|
if (!this->TryExecute("plugins", [&info]() { SurveyPlugins(info["plugins"]); return true; })) {
|
||||||
|
info["plugins"] = "crashed while gathering information";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ std::string NetworkSurveyHandler::CreatePayload(Reason reason, bool for_preview)
|
||||||
SurveyFont(info["font"]);
|
SurveyFont(info["font"]);
|
||||||
SurveyCompiler(info["compiler"]);
|
SurveyCompiler(info["compiler"]);
|
||||||
SurveyLibraries(info["libraries"]);
|
SurveyLibraries(info["libraries"]);
|
||||||
|
SurveyPlugins(info["plugins"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "base_media_base.h"
|
#include "base_media_base.h"
|
||||||
#include "blitter/factory.hpp"
|
#include "blitter/factory.hpp"
|
||||||
|
|
||||||
|
#include "social_integration.h"
|
||||||
|
|
||||||
#ifdef WITH_ALLEGRO
|
#ifdef WITH_ALLEGRO
|
||||||
# include <allegro.h>
|
# include <allegro.h>
|
||||||
#endif /* WITH_ALLEGRO */
|
#endif /* WITH_ALLEGRO */
|
||||||
|
@ -81,6 +83,16 @@ NLOHMANN_JSON_SERIALIZE_ENUM(GRFStatus, {
|
||||||
{GRFStatus::GCS_ACTIVATED, "activated"},
|
{GRFStatus::GCS_ACTIVATED, "activated"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
NLOHMANN_JSON_SERIALIZE_ENUM(SocialIntegrationPlugin::State, {
|
||||||
|
{SocialIntegrationPlugin::State::RUNNING, "running"},
|
||||||
|
{SocialIntegrationPlugin::State::FAILED, "failed"},
|
||||||
|
{SocialIntegrationPlugin::State::PLATFORM_NOT_RUNNING, "platform_not_running"},
|
||||||
|
{SocialIntegrationPlugin::State::UNLOADED, "unloaded"},
|
||||||
|
{SocialIntegrationPlugin::State::DUPLICATE, "duplicate"},
|
||||||
|
{SocialIntegrationPlugin::State::UNSUPPORTED_API, "unsupported_api"},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
/** Lookup table to convert a VehicleType to a string. */
|
/** Lookup table to convert a VehicleType to a string. */
|
||||||
static const std::string _vehicle_type_to_string[] = {
|
static const std::string _vehicle_type_to_string[] = {
|
||||||
"train",
|
"train",
|
||||||
|
@ -435,6 +447,26 @@ void SurveyLibraries(nlohmann::json &survey)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert plugin information to JSON.
|
||||||
|
*
|
||||||
|
* @param survey The JSON object.
|
||||||
|
*/
|
||||||
|
void SurveyPlugins(nlohmann::json &survey)
|
||||||
|
{
|
||||||
|
auto _plugins = SocialIntegration::GetPlugins();
|
||||||
|
|
||||||
|
for (auto &plugin : _plugins) {
|
||||||
|
auto &platform = survey[plugin->social_platform];
|
||||||
|
platform.push_back({
|
||||||
|
{"name", plugin->name},
|
||||||
|
{"version", plugin->version},
|
||||||
|
{"basepath", plugin->basepath},
|
||||||
|
{"state", plugin->state},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the bytes of memory into a textual version rounded up to the biggest unit.
|
* Change the bytes of memory into a textual version rounded up to the biggest unit.
|
||||||
*
|
*
|
||||||
|
|
|
@ -21,6 +21,7 @@ void SurveyFont(nlohmann::json &survey);
|
||||||
void SurveyGameScript(nlohmann::json &survey);
|
void SurveyGameScript(nlohmann::json &survey);
|
||||||
void SurveyGrfs(nlohmann::json &survey);
|
void SurveyGrfs(nlohmann::json &survey);
|
||||||
void SurveyLibraries(nlohmann::json &survey);
|
void SurveyLibraries(nlohmann::json &survey);
|
||||||
|
void SurveyPlugins(nlohmann::json &survey);
|
||||||
void SurveyOpenTTD(nlohmann::json &survey);
|
void SurveyOpenTTD(nlohmann::json &survey);
|
||||||
void SurveySettings(nlohmann::json &survey, bool skip_if_default);
|
void SurveySettings(nlohmann::json &survey, bool skip_if_default);
|
||||||
void SurveyTimers(nlohmann::json &survey);
|
void SurveyTimers(nlohmann::json &survey);
|
||||||
|
|
Loading…
Reference in New Issue