Merge branch 'master' into jgrpp

# Conflicts:
#	src/crashlog.cpp
#	src/gfx.cpp
#	src/network/network_client.cpp
#	src/openttd.cpp
#	src/openttd.h
#	src/saveload/saveload.cpp
#	src/survey.cpp
This commit is contained in:
Jonathan G Rennison
2024-03-16 18:06:09 +00:00
32 changed files with 857 additions and 749 deletions

View File

@@ -208,6 +208,24 @@ void SurveyOpenTTD(nlohmann::json &survey)
;
}
/**
* Convert game session information to JSON.
*
* @param survey The JSON object.
*/
void SurveyGameSession(nlohmann::json &survey)
{
survey["id"] = _game_session_stats.savegame_id;
if (_game_session_stats.start_time.has_value()) {
survey["seconds"] = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - _game_session_stats.start_time.value()).count();
} else {
survey["seconds"] = 0;
}
if (_game_session_stats.savegame_size.has_value()) {
survey["savegame_size"] = _game_session_stats.savegame_size.value();
}
}
/**
* Convert generic game information to JSON.
*
@@ -303,11 +321,6 @@ void SurveyCompanies(nlohmann::json &survey)
void SurveyTimers(nlohmann::json &survey)
{
survey["ticks"] = _scaled_tick_counter;
if (_switch_mode_time_valid) {
survey["seconds"] = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - _switch_mode_time).count();
} else {
survey["seconds"] = 0;
}
survey["calendar"] = fmt::format("{:04}-{:02}-{:02} ({})", CalTime::CurYear(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract());
survey["economy"] = fmt::format("{:04}-{:02}-{:02} ({})", EconTime::CurYear(), EconTime::CurMonth() + 1, EconTime::CurDay(), EconTime::CurDateFract());