Change: make nlohmann a mandatory library to build OpenTTD (#11235)
This commit is contained in:
@@ -31,9 +31,7 @@
|
||||
#include "../base_media_base.h"
|
||||
#include "../blitter/factory.hpp"
|
||||
|
||||
#ifdef WITH_NLOHMANN_JSON
|
||||
#include <nlohmann/json.hpp>
|
||||
#endif /* WITH_NLOHMANN_JSON */
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
@@ -41,8 +39,6 @@ extern std::string _savegame_id;
|
||||
|
||||
NetworkSurveyHandler _survey = {};
|
||||
|
||||
#ifdef WITH_NLOHMANN_JSON
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(NetworkSurveyHandler::Reason, {
|
||||
{NetworkSurveyHandler::Reason::PREVIEW, "preview"},
|
||||
{NetworkSurveyHandler::Reason::LEAVE, "leave"},
|
||||
@@ -334,8 +330,6 @@ std::string SurveyMemoryToText(uint64_t memory)
|
||||
return fmt::format("{} MiB", Ceil(memory, 4));
|
||||
}
|
||||
|
||||
#endif /* WITH_NLOHMANN_JSON */
|
||||
|
||||
/**
|
||||
* Create the payload for the survey.
|
||||
*
|
||||
@@ -345,9 +339,6 @@ std::string SurveyMemoryToText(uint64_t memory)
|
||||
*/
|
||||
std::string NetworkSurveyHandler::CreatePayload(Reason reason, bool for_preview)
|
||||
{
|
||||
#ifndef WITH_NLOHMANN_JSON
|
||||
return "";
|
||||
#else
|
||||
nlohmann::json survey;
|
||||
|
||||
survey["schema"] = NETWORK_SURVEY_VERSION;
|
||||
@@ -381,7 +372,6 @@ std::string NetworkSurveyHandler::CreatePayload(Reason reason, bool for_preview)
|
||||
/* For preview, we indent with 4 whitespaces to make things more readable. */
|
||||
int indent = for_preview ? 4 : -1;
|
||||
return survey.dump(indent);
|
||||
#endif /* WITH_NLOHMANN_JSON */
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user