File diff r28551:f762d05f819e → r28552:48eaa3286eee
src/survey.cpp
Show inline comments
 
@@ -34,6 +34,8 @@
 
#include "base_media_base.h"
 
#include "blitter/factory.hpp"
 

	
 
#include "social_integration.h"
 

	
 
#ifdef WITH_ALLEGRO
 
#	include <allegro.h>
 
#endif /* WITH_ALLEGRO */
 
@@ -81,6 +83,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",
 
@@ -436,6 +449,26 @@ void SurveyLibraries(nlohmann::json &sur
 
}
 

	
 
/**
 
 * 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.
 
 *
 
 * For example, 16751108096 would become 16 GiB.