Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
luanluciano93 committed Sep 28, 2024
2 parents 7d9d351 + 09c16ff commit baf5128
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/creatures/npcs/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,13 @@ void Npc::onPlayerSellItem(std::shared_ptr<Player> player, uint16_t itemId, uint
continue;
}

if (const auto &container = item->getContainer()) {
if (container->size() > 0) {

Check warning on line 391 in src/creatures/npcs/npc.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

container-size-empty

the 'empty' method should be used to check for emptiness instead of 'size'
player->sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must empty the container before selling it.");
continue;
}
}

if (parent && item->getParent() != parent) {
continue;
}
Expand Down
8 changes: 7 additions & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4120,6 +4120,12 @@ std::map<uint32_t, uint32_t> &Player::getAllItemTypeCount(std::map<uint32_t, uin

std::map<uint16_t, uint16_t> &Player::getAllSaleItemIdAndCount(std::map<uint16_t, uint16_t> &countMap) const {
for (const auto &item : getAllInventoryItems(false, true)) {
if (const auto &container = item->getContainer()) {
if (container->size() > 0) {

Check warning on line 4124 in src/creatures/players/player.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

container-size-empty

the 'empty' method should be used to check for emptiness instead of 'size'
continue;
}
}

countMap[item->getID()] += item->getItemCount();
}

Expand Down Expand Up @@ -7213,7 +7219,7 @@ void Player::forgeFuseItems(ForgeAction_t actionType, uint16_t firstItemId, uint
}

for (const auto &[mapTier, mapPrice] : itemClassification->tiers) {
if (mapTier == firstForgingItem->getTier()) {
if (mapTier == firstForgingItem->getTier() + 1) {
cost = mapPrice.convergenceFusionPrice;
break;
}
Expand Down

0 comments on commit baf5128

Please sign in to comment.