From 9cb5aec3d82f797593e026d023d1ba2a7715f27d Mon Sep 17 00:00:00 2001 From: Luan Santos Date: Thu, 14 Sep 2023 23:18:35 -0700 Subject: [PATCH 1/2] fix: load conditions properly into player --- src/io/functions/iologindata_load_player.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/io/functions/iologindata_load_player.cpp b/src/io/functions/iologindata_load_player.cpp index 39dcf910fc1..dcd40fe04bc 100644 --- a/src/io/functions/iologindata_load_player.cpp +++ b/src/io/functions/iologindata_load_player.cpp @@ -230,14 +230,10 @@ void IOLoginDataLoad::loadPlayerConditions(const Player* player, DBResult_ptr re PropStream propStream; propStream.init(attr, attrSize); - std::list> conditionList; Condition* condition = Condition::createCondition(propStream); while (condition) { - std::unique_ptr uniqueCondition(condition); - if (uniqueCondition->unserialize(propStream)) { - conditionList.push_front(std::move(uniqueCondition)); - } else { - uniqueCondition.release(); // Release memory ownership + if (condition->unserialize(propStream)) { + player->storedConditionList.push_front(condition); } condition = Condition::createCondition(propStream); } From e3d7e798fc4c79ff424dc5fadd47acd8a869281a Mon Sep 17 00:00:00 2001 From: Luan Santos Date: Fri, 15 Sep 2023 09:41:40 -0700 Subject: [PATCH 2/2] fix: remove const --- src/io/functions/iologindata_load_player.cpp | 2 +- src/io/functions/iologindata_load_player.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/functions/iologindata_load_player.cpp b/src/io/functions/iologindata_load_player.cpp index dcd40fe04bc..f8e6e785563 100644 --- a/src/io/functions/iologindata_load_player.cpp +++ b/src/io/functions/iologindata_load_player.cpp @@ -219,7 +219,7 @@ void IOLoginDataLoad::loadPlayerBlessings(Player* player, DBResult_ptr result) { } } -void IOLoginDataLoad::loadPlayerConditions(const Player* player, DBResult_ptr result) { +void IOLoginDataLoad::loadPlayerConditions(Player* player, DBResult_ptr result) { if (!result || !player) { g_logger().warn("[IOLoginData::loadPlayer] - Player or Result nullptr: {}", __FUNCTION__); return; diff --git a/src/io/functions/iologindata_load_player.hpp b/src/io/functions/iologindata_load_player.hpp index 9ea937c7de0..b1c9fe7c18d 100644 --- a/src/io/functions/iologindata_load_player.hpp +++ b/src/io/functions/iologindata_load_player.hpp @@ -17,7 +17,7 @@ class IOLoginDataLoad : public IOLoginData { static bool preLoadPlayer(Player* player, const std::string &name); static void loadPlayerExperience(Player* player, DBResult_ptr result); static void loadPlayerBlessings(Player* player, DBResult_ptr result); - static void loadPlayerConditions(const Player* player, DBResult_ptr result); + static void loadPlayerConditions(Player* player, DBResult_ptr result); static void loadPlayerDefaultOutfit(Player* player, DBResult_ptr result); static void loadPlayerSkullSystem(Player* player, DBResult_ptr result); static void loadPlayerSkill(Player* player, DBResult_ptr result);