1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-15 18:49:10 +00:00

Add: track savegame size to report with survey (#12304)

This commit is contained in:
Patric Stout
2024-03-16 08:58:56 +01:00
committed by Michael Lutz
parent c947f754bf
commit e8b314afc2
12 changed files with 48 additions and 17 deletions

View File

@@ -48,7 +48,7 @@ static const size_t COMPAT_MTU = 1460; ///< Number of bytes we can pack in a sin
static const byte NETWORK_GAME_ADMIN_VERSION = 3; ///< What version of the admin network do we use?
static const byte NETWORK_GAME_INFO_VERSION = 7; ///< What version of game-info do we use?
static const byte NETWORK_COORDINATOR_VERSION = 6; ///< What version of game-coordinator-protocol do we use?
static const byte NETWORK_SURVEY_VERSION = 1; ///< What version of the survey do we use?
static const byte NETWORK_SURVEY_VERSION = 2; ///< What version of the survey do we use?
static const uint NETWORK_NAME_LENGTH = 80; ///< The maximum length of the server name and map name, in bytes including '\0'
static const uint NETWORK_COMPANY_NAME_LENGTH = 128; ///< The maximum length of the company name, in bytes including '\0'

View File

@@ -882,7 +882,8 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
SendMapOk();
/* As we skipped switch-mode, update the time we "switched". */
_switch_mode_time = std::chrono::steady_clock::now();
_game_session_stats.start_time = std::chrono::steady_clock::now();
_game_session_stats.savegame_size = std::nullopt;
ShowClientList();

View File

@@ -19,8 +19,6 @@
#include "../safeguards.h"
extern std::string _savegame_id;
NetworkSurveyHandler _survey = {};
NLOHMANN_JSON_SERIALIZE_ENUM(NetworkSurveyHandler::Reason, {
@@ -43,7 +41,6 @@ std::string NetworkSurveyHandler::CreatePayload(Reason reason, bool for_preview)
survey["schema"] = NETWORK_SURVEY_VERSION;
survey["reason"] = reason;
survey["id"] = _savegame_id;
survey["date"] = fmt::format("{:%Y-%m-%d %H:%M:%S} (UTC)", fmt::gmtime(time(nullptr)));
#ifdef SURVEY_KEY
@@ -53,6 +50,8 @@ std::string NetworkSurveyHandler::CreatePayload(Reason reason, bool for_preview)
survey["key"] = "";
#endif
SurveyGameSession(survey["session"]);
{
auto &info = survey["info"];
SurveyOS(info["os"]);