Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: load conditions properly into player #1601

Merged
merged 3 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/io/functions/iologindata_load_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -230,14 +230,10 @@ void IOLoginDataLoad::loadPlayerConditions(const Player* player, DBResult_ptr re
PropStream propStream;
propStream.init(attr, attrSize);

std::list<std::unique_ptr<Condition>> conditionList;
Condition* condition = Condition::createCondition(propStream);
while (condition) {
std::unique_ptr<Condition> 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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/functions/iologindata_load_player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down