Skip to content

Commit

Permalink
Some sonar fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Oct 24, 2022
1 parent d0d3482 commit cadb78e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1682,9 +1682,8 @@ bool Player::openShopWindow(Npc* npc)
npc->addShopPlayer(this);

sendShop(npc);

std::map<uint16_t, uint16_t> map;
sendSaleItemList(getAllSaleItemIdAndCount(map));
std::map<uint16_t, uint16_t> inventoryMap;
sendSaleItemList(getAllSaleItemIdAndCount(inventoryMap));
return true;
}

Expand Down Expand Up @@ -3751,7 +3750,7 @@ std::map<uint32_t, uint32_t>& Player::getAllItemTypeCount(std::map<uint32_t, uin
return countMap;
}

std::map<uint16_t, uint16_t>& Player::getAllSaleItemIdAndCount(std::map<uint16_t, uint16_t>& countMap) const
std::map<uint16_t, uint16_t>& Player::getAllSaleItemIdAndCount(std::map<uint16_t, uint16_t> &countMap) const
{
for (auto item : getAllInventoryItems()) {
if (item->getTier() > 0) {
Expand All @@ -3762,6 +3761,7 @@ std::map<uint16_t, uint16_t>& Player::getAllSaleItemIdAndCount(std::map<uint16_t
countMap[item->getID()] += item->getItemCount();
}
}

return countMap;
}

Expand Down
3 changes: 1 addition & 2 deletions src/creatures/players/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -2156,8 +2156,7 @@ class Player final : public Creature, public Cylinder
std::map<uint32_t, uint32_t>& getAllItemTypeCount(std::map<uint32_t,
uint32_t>& countMap) const override;
// Function from player class with correct type sizes (uint16_t)
std::map<uint16_t, uint16_t>& getAllSaleItemIdAndCount(std::map<uint16_t,
uint16_t>& countMap) const;
std::map<uint16_t, uint16_t>& getAllSaleItemIdAndCount(std::map<uint16_t, uint16_t> & countMap) const;
void getAllItemTypeCountAndSubtype(std::map<uint32_t, uint32_t>& countMap) const;
Thing* getThing(size_t index) const override;

Expand Down

0 comments on commit cadb78e

Please sign in to comment.