From c49f1da09ee5f19a45383816d1032bdd95d6775d Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 11 Jan 2026 22:15:36 +0100 Subject: [PATCH] Codefix: incorrect naming of enum class members --- src/crashlog.cpp | 2 +- src/intro_gui.cpp | 2 +- src/network/network_gui.cpp | 2 +- src/network/network_survey.cpp | 8 ++++---- src/network/network_survey.h | 8 ++++---- src/openttd.cpp | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/crashlog.cpp b/src/crashlog.cpp index 1ccc345247..c11cdb5911 100644 --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -260,7 +260,7 @@ bool CrashLog::WriteScreenshot() void CrashLog::SendSurvey() const { if (_game_mode == GM_NORMAL) { - _survey.Transmit(NetworkSurveyHandler::Reason::CRASH, true); + _survey.Transmit(NetworkSurveyHandler::Reason::Crash, true); } } diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index d441474ea5..fad80953db 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -403,7 +403,7 @@ void ShowSelectGameWindow() static void AskExitGameCallback(Window *, bool confirmed) { if (confirmed) { - _survey.Transmit(NetworkSurveyHandler::Reason::EXIT, true); + _survey.Transmit(NetworkSurveyHandler::Reason::Exit, true); _exit_game = true; } } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index c366eef8c0..f752a94e63 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -2342,7 +2342,7 @@ struct SurveyResultTextfileWindow : public TextfileWindow { { this->ConstructWindow(); - auto result = _survey.CreatePayload(NetworkSurveyHandler::Reason::PREVIEW, true); + auto result = _survey.CreatePayload(NetworkSurveyHandler::Reason::Preview, true); this->LoadText(result); this->InvalidateData(); } diff --git a/src/network/network_survey.cpp b/src/network/network_survey.cpp index 2ad90ba06a..638d149189 100644 --- a/src/network/network_survey.cpp +++ b/src/network/network_survey.cpp @@ -22,10 +22,10 @@ NetworkSurveyHandler _survey = {}; NLOHMANN_JSON_SERIALIZE_ENUM(NetworkSurveyHandler::Reason, { - {NetworkSurveyHandler::Reason::PREVIEW, "preview"}, - {NetworkSurveyHandler::Reason::LEAVE, "leave"}, - {NetworkSurveyHandler::Reason::EXIT, "exit"}, - {NetworkSurveyHandler::Reason::CRASH, "crash"}, + {NetworkSurveyHandler::Reason::Preview, "preview"}, + {NetworkSurveyHandler::Reason::Leave, "leave"}, + {NetworkSurveyHandler::Reason::Exit, "exit"}, + {NetworkSurveyHandler::Reason::Crash, "crash"}, }) /** diff --git a/src/network/network_survey.h b/src/network/network_survey.h index 6d39de62e4..df02713703 100644 --- a/src/network/network_survey.h +++ b/src/network/network_survey.h @@ -25,10 +25,10 @@ protected: public: enum class Reason : uint8_t { - PREVIEW, ///< User is previewing the survey result. - LEAVE, ///< User is leaving the game (but not exiting the application). - EXIT, ///< User is exiting the application. - CRASH, ///< Game crashed. + Preview, ///< User is previewing the survey result. + Leave, ///< User is leaving the game (but not exiting the application). + Exit, ///< User is exiting the application. + Crash, ///< Game crashed. }; void Transmit(Reason reason, bool blocking = false); diff --git a/src/openttd.cpp b/src/openttd.cpp index cdcaf33f33..a04386b397 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -820,7 +820,7 @@ void HandleExitGameRequest() _exit_game = true; } else if (_settings_client.gui.autosave_on_exit) { DoExitSave(); - _survey.Transmit(NetworkSurveyHandler::Reason::EXIT, true); + _survey.Transmit(NetworkSurveyHandler::Reason::Exit, true); _exit_game = true; } else { AskExitGame(); @@ -1053,7 +1053,7 @@ void SwitchToMode(SwitchMode new_mode) if (new_mode != SM_SAVE_GAME) ChangeAutosaveFrequency(true); /* Transmit the survey if we were in normal-mode and not saving. It always means we leaving the current game. */ - if (_game_mode == GM_NORMAL && new_mode != SM_SAVE_GAME) _survey.Transmit(NetworkSurveyHandler::Reason::LEAVE); + if (_game_mode == GM_NORMAL && new_mode != SM_SAVE_GAME) _survey.Transmit(NetworkSurveyHandler::Reason::Leave); /* Keep track when we last switch mode. Used for survey, to know how long someone was in a game. */ if (new_mode != SM_SAVE_GAME) {