Skip to content

Commit

Permalink
Allow disabling tips if empty (or no) tips.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
Benau committed May 21, 2021
1 parent a3e1732 commit 10da628
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/guiengine/engine.cpp
Expand Up @@ -1432,7 +1432,7 @@ namespace GUIEngine
void renderLoading(bool clearIcons, bool launching, bool update_tips)
{
#ifndef SERVER_ONLY
if (update_tips)
if (!TipsManager::get()->isEmpty() && update_tips)
{
core::stringw tip = TipsManager::get()->getTip("general");
//I18N: Tip shown in gui for giving player hints
Expand Down
3 changes: 2 additions & 1 deletion src/states_screens/race_result_gui.cpp
Expand Up @@ -189,7 +189,8 @@ void RaceResultGUI::init()
}

#ifndef SERVER_ONLY
if (!human_win && !NetworkConfig::get()->isNetworking())
if (!human_win && !NetworkConfig::get()->isNetworking() &&
!TipsManager::get()->isEmpty())
{
std::string tipset = "race";
if (RaceManager::get()->isSoccerMode())
Expand Down
4 changes: 4 additions & 0 deletions src/tips/tips_manager.cpp
Expand Up @@ -36,7 +36,11 @@ TipsManager* TipsManager::m_tips_manager = NULL;
TipsManager::TipsManager()
{
const std::string file_name = file_manager->getAsset("tips.xml");
if (file_name.empty())
return;
const XMLNode *root = file_manager->createXMLTree(file_name);
if (!root)
return;
unsigned int num_nodes = root->getNumNodes();

for (unsigned int i = 0; i < num_nodes; i++)
Expand Down
2 changes: 2 additions & 0 deletions src/tips/tips_manager.hpp
Expand Up @@ -70,6 +70,8 @@ class TipsManager
/** Get a tip by ID. */
const irr::core::stringw& getTip(const std::string& id) const;
// ------------------------------------------------------------------------
bool isEmpty() const { return m_all_tip_sets.empty(); }
// ------------------------------------------------------------------------
}; // class TipsManager

#endif
Expand Down

0 comments on commit 10da628

Please sign in to comment.