Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/codeql.yml # .github/workflows/commit-checker.yml # .github/workflows/release-linux-legacy.yml # .github/workflows/release-linux.yml # .github/workflows/release-macos.yml # .github/workflows/release-windows-store.yml # .github/workflows/release-windows.yml # .github/workflows/upload-cdn.yml # .github/workflows/upload-gog.yml # .github/workflows/upload-steam.yml # src/console_cmds.cpp # src/core/math_func.hpp # src/fios.cpp # src/fios.h # src/intro_gui.cpp # src/network/network_server.cpp # src/openttd.cpp # src/settings.cpp # src/settings_gui.cpp # src/settings_internal.h # src/settings_table.cpp # src/settings_type.h # src/table/settings.h.preamble # src/table/settings/company_settings.ini # src/table/settings/currency_settings.ini # src/table/settings/difficulty_settings.ini # src/table/settings/economy_settings.ini # src/table/settings/game_settings.ini # src/table/settings/gui_settings.ini # src/table/settings/linkgraph_settings.ini # src/table/settings/locale_settings.ini # src/table/settings/misc_settings.ini # src/table/settings/multimedia_settings.ini # src/table/settings/network_private_settings.ini # src/table/settings/network_settings.ini # src/table/settings/news_display_settings.ini # src/table/settings/old_gameopt_settings.ini # src/table/settings/pathfinding_settings.ini # src/table/settings/script_settings.ini # src/table/settings/win32_settings.ini # src/table/settings/window_settings.ini # src/table/settings/world_settings.ini # src/viewport.cpp # src/viewport_func.h # src/window.cpp
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
#include "base_media_base.h"
|
||||
#include "blitter/factory.hpp"
|
||||
|
||||
#include "social_integration.h"
|
||||
|
||||
#include "core/format.hpp"
|
||||
|
||||
#ifdef WITH_ALLEGRO
|
||||
@@ -86,6 +88,17 @@ NLOHMANN_JSON_SERIALIZE_ENUM(GRFStatus, {
|
||||
{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"},
|
||||
{SocialIntegrationPlugin::State::INVALID_SIGNATURE, "invalid_signature"},
|
||||
})
|
||||
|
||||
|
||||
/** Lookup table to convert a VehicleType to a string. */
|
||||
static const std::string _vehicle_type_to_string[] = {
|
||||
"train",
|
||||
@@ -413,6 +426,33 @@ void SurveyLibraries(nlohmann::json &survey)
|
||||
#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},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const char *PluginStateToString(SocialIntegrationPlugin::State state)
|
||||
{
|
||||
const char *output = "";
|
||||
to_json<const char *>(output, state);
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the bytes of memory into a textual version rounded up to the biggest unit.
|
||||
*
|
||||
|
Reference in New Issue
Block a user