Allow disabling tips if empty (or no) tips.xml

This commit is contained in:
Benau 2021-05-21 23:33:47 +08:00
parent a3e1732ac7
commit 10da6285fc
4 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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())

View File

@ -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++)

View File

@ -70,6 +70,8 @@ public:
/** 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