From 3928a49d5e16025f766270cbda9045091d1fce38 Mon Sep 17 00:00:00 2001 From: CodingJellyfish Date: Sat, 6 Jan 2024 12:17:57 +0800 Subject: [PATCH] Fix #4923 (#4981) --- src/states_screens/dialogs/addons_loading.cpp | 14 +++++++++++++- src/states_screens/dialogs/addons_loading.hpp | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/states_screens/dialogs/addons_loading.cpp b/src/states_screens/dialogs/addons_loading.cpp index 0e34f235d..0a02fdd36 100644 --- a/src/states_screens/dialogs/addons_loading.cpp +++ b/src/states_screens/dialogs/addons_loading.cpp @@ -18,10 +18,12 @@ #include "states_screens/dialogs/addons_loading.hpp" +#include "audio/sfx_manager.hpp" #include "addons/addons_manager.hpp" #include "config/player_manager.hpp" #include "config/user_config.hpp" #include "guiengine/engine.hpp" +#include "guiengine/message_queue.hpp" #include "guiengine/scalable_font.hpp" #include "guiengine/widgets.hpp" #include "input/input_manager.hpp" @@ -55,7 +57,7 @@ AddonsLoading::AddonsLoading(const std::string &id) , m_addon(*(addons_manager->getAddon(id)) ) #endif { - + m_message_shown = false; m_icon_shown = false; #ifdef SERVER_ONLY m_icon_downloaded = std::make_shared(false); @@ -279,6 +281,16 @@ void AddonsLoading::voteClicked() dismiss(); new VoteDialog(addon_id); } + else + { + SFXManager::get()->quickSound("anvil"); + if (!m_message_shown) + { + MessageQueue::add(MessageQueue::MT_ERROR, + _("You must be logged in to rate this addon.")); + m_message_shown = true; + } + } #endif } // voteClicked diff --git a/src/states_screens/dialogs/addons_loading.hpp b/src/states_screens/dialogs/addons_loading.hpp index a6cfbde7f..c5e00a6cb 100644 --- a/src/states_screens/dialogs/addons_loading.hpp +++ b/src/states_screens/dialogs/addons_loading.hpp @@ -51,6 +51,8 @@ private: /** True if the icon is being displayed. */ bool m_icon_shown; + /** True if the error message has shown once. */ + bool m_message_shown; std::shared_ptr m_icon_downloaded; /** A pointer to the download request, which gives access