From baf25770879a59223873035b355529ecf35bc070 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Tue, 24 Sep 2024 17:51:36 -0300 Subject: [PATCH] fix: disable irrelevant informations (#2910) The "PlayerBadge" was loading a lot of unnecessary information for all players on the account. I moved the if statement up, ensuring that only the preload and level are properly loaded, which are actually relevant information. If more information is identified that should be loaded in the preload, we should move it to the loadPlayerFirst function. --- src/game/game.cpp | 2 +- src/io/iologindata.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/game.cpp b/src/game/game.cpp index efde91e0a29..673c87a3e9b 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -988,7 +988,7 @@ std::shared_ptr Game::getPlayerByName(const std::string &s, bool allowOf return nullptr; } std::shared_ptr tmpPlayer = std::make_shared(nullptr); - if (!IOLoginData::loadPlayerByName(tmpPlayer, s)) { + if (!IOLoginData::loadPlayerByName(tmpPlayer, s, allowOffline)) { if (!isNewName) { g_logger().error("Failed to load player {} from database", s); } else { diff --git a/src/io/iologindata.cpp b/src/io/iologindata.cpp index fce5d0dc293..41f8cea8985 100644 --- a/src/io/iologindata.cpp +++ b/src/io/iologindata.cpp @@ -123,6 +123,10 @@ bool IOLoginData::loadPlayer(std::shared_ptr player, DBResult_ptr result // Experience load IOLoginDataLoad::loadPlayerExperience(player, result); + if (disableIrrelevantInfo) { + return true; + } + // Blessings load IOLoginDataLoad::loadPlayerBlessings(player, result); @@ -180,10 +184,6 @@ bool IOLoginData::loadPlayer(std::shared_ptr player, DBResult_ptr result // Load instant spells list IOLoginDataLoad::loadPlayerInstantSpellList(player, result); - if (disableIrrelevantInfo) { - return true; - } - // load forge history IOLoginDataLoad::loadPlayerForgeHistory(player, result);