Skip to content

Commit

Permalink
fix: disable irrelevant informations (opentibiabr#2910)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dudantas authored and s2leandro155 committed Sep 26, 2024
1 parent 2a02a3c commit baf2577
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ std::shared_ptr<Player> Game::getPlayerByName(const std::string &s, bool allowOf
return nullptr;
}
std::shared_ptr<Player> tmpPlayer = std::make_shared<Player>(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 {
Expand Down
8 changes: 4 additions & 4 deletions src/io/iologindata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ bool IOLoginData::loadPlayer(std::shared_ptr<Player> player, DBResult_ptr result
// Experience load
IOLoginDataLoad::loadPlayerExperience(player, result);

if (disableIrrelevantInfo) {
return true;
}

// Blessings load
IOLoginDataLoad::loadPlayerBlessings(player, result);

Expand Down Expand Up @@ -180,10 +184,6 @@ bool IOLoginData::loadPlayer(std::shared_ptr<Player> player, DBResult_ptr result
// Load instant spells list
IOLoginDataLoad::loadPlayerInstantSpellList(player, result);

if (disableIrrelevantInfo) {
return true;
}

// load forge history
IOLoginDataLoad::loadPlayerForgeHistory(player, result);

Expand Down

0 comments on commit baf2577

Please sign in to comment.