Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan Luciano committed Apr 3, 2024
1 parent 81d1e0c commit 815b984
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4888,7 +4888,7 @@ bool Player::canWear(uint16_t lookType, uint8_t addons) const {
return true;
}

for (const auto &[outfitPlayer, addonPlayer] : outfits) {
for (const auto &[outfitPlayer, addonPlayer] : outfitsMap) {

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

View workflow job for this annotation

GitHub Actions / cppcheck

[cppcheck] reported by reviewdog 🐶 Variable 'outfitPlayer' is not assigned a value. Raw Output: src/creatures/players/player.cpp:4891:Variable 'outfitPlayer' is not assigned a value.
if (outfitPlayer == lookType) {
if (addonPlayer == addons || addonPlayer == 3 || addons == 0) {
return true;
Expand Down Expand Up @@ -4929,7 +4929,7 @@ void Player::genReservedStorageRange() {
}

void Player::addOutfit(uint16_t lookType, uint8_t addons) {
for (auto &[outfitPlayer, addonPlayer] : outfits) {
for (auto &[outfitPlayer, addonPlayer] : outfitsMap) {

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

View workflow job for this annotation

GitHub Actions / cppcheck

[cppcheck] reported by reviewdog 🐶 Variable 'outfitPlayer' is not assigned a value. Raw Output: src/creatures/players/player.cpp:4932:Variable 'outfitPlayer' is not assigned a value.
if (outfitPlayer == lookType) {
addonPlayer |= addons;
return;
Expand All @@ -4939,7 +4939,7 @@ void Player::addOutfit(uint16_t lookType, uint8_t addons) {
}

bool Player::removeOutfit(uint16_t lookType) {
for (auto &[outfitPlayer, addonPlayer] : outfits) {
for (auto &[outfitPlayer, addonPlayer] : outfitsMap) {
if (outfitPlayer == lookType) {
outfits.erase(outfitPlayer);
return true;
Expand All @@ -4949,7 +4949,7 @@ bool Player::removeOutfit(uint16_t lookType) {
}

bool Player::removeOutfitAddon(uint16_t lookType, uint8_t addons) {
for (auto &[outfitPlayer, addonPlayer] : outfits) {
for (auto &[outfitPlayer, addonPlayer] : outfitsMap) {

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

View workflow job for this annotation

GitHub Actions / cppcheck

[cppcheck] reported by reviewdog 🐶 Variable 'outfitPlayer' is not assigned a value. Raw Output: src/creatures/players/player.cpp:4952:Variable 'outfitPlayer' is not assigned a value.
if (outfitPlayer == lookType) {
addonPlayer &= ~addons;
return true;
Expand All @@ -4968,7 +4968,7 @@ bool Player::getOutfitAddons(const std::shared_ptr<Outfit> outfit, uint8_t &addo
return false;
}

for (const auto &[lookType, addon] : outfits) {
for (const auto &[lookType, addon] : outfitsMap) {

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

View workflow job for this annotation

GitHub Actions / cppcheck

[cppcheck] reported by reviewdog 🐶 Variable 'lookType' is not assigned a value. Raw Output: src/creatures/players/player.cpp:4971:Variable 'lookType' is not assigned a value.
if (lookType != outfit->lookType) {
continue;
}
Expand Down Expand Up @@ -5738,7 +5738,7 @@ void Player::setCurrentMount(uint16_t mountId) {

bool Player::hasAnyMount() const {
const auto mounts = g_game().mounts.getMounts();
for (const auto mount : mounts) {
for (const auto mount : mountsMap) {
if (hasMount(mount)) {
return true;
}
Expand All @@ -5749,7 +5749,7 @@ bool Player::hasAnyMount() const {
uint16_t Player::getRandomMountId() const {
std::vector<uint16_t> playerMounts;
const auto mounts = g_game().mounts.getMounts();
for (const auto mount : mounts) {
for (const auto mount : mountsMap) {
if (hasMount(mount)) {
playerMounts.push_back(mount->id);
}
Expand Down
4 changes: 2 additions & 2 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2693,8 +2693,8 @@ class Player final : public Creature, public Cylinder, public Bankable {

std::vector<uint16_t> quickLootListItemIds;

std::map<uint16_t, uint8_t> outfits;
std::unordered_set<uint16_t> mounts;
std::map<uint16_t, uint8_t> outfitsMap;
std::unordered_set<uint16_t> mountsMap;
std::vector<FamiliarEntry> familiars;

std::vector<std::unique_ptr<PreySlot>> preys;
Expand Down
4 changes: 2 additions & 2 deletions src/io/functions/iologindata_load_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void IOLoginDataLoad::loadPlayerDefaultOutfit(std::shared_ptr<Player> player, DB
queryOutfits << "SELECT `outfit_id`, `addons` FROM `player_outfits` WHERE `player_id` = " << player->getGUID();
if ((result = db.storeQuery(queryOutfits.str()))) {
do {
player->outfits.emplace(result->getNumber<uint16_t>("outfit_id"), result->getNumber<uint8_t>("addons"));
player->outfitsMap.emplace(result->getNumber<uint16_t>("outfit_id"), result->getNumber<uint8_t>("addons"));
} while (result->next());
}

Expand All @@ -288,7 +288,7 @@ void IOLoginDataLoad::loadPlayerDefaultOutfit(std::shared_ptr<Player> player, DB
queryMounts << "SELECT `mount_id` FROM `player_mounts` WHERE `player_id` = " << player->getGUID();
if ((result = db.storeQuery(queryMounts.str()))) {
do {
player->mounts.emplace(result->getNumber<uint16_t>("mount_id"));
player->mountsMap.emplace(result->getNumber<uint16_t>("mount_id"));
} while (result->next());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/io/functions/iologindata_save_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ bool IOLoginDataSave::savePlayerOutfits(std::shared_ptr<Player> player) {

DBInsert outfitQuery("INSERT INTO `player_outfits` (`player_id`, `outfit_id`, `addons`) VALUES ");

for (const auto &it : player->outfits) {
for (const auto &it : player->outfitsMap) {
query << player->getGUID() << ',' << it.first << ',' << it.second;
if (!outfitQuery.addRow(query)) {
return false;
Expand Down Expand Up @@ -843,7 +843,7 @@ bool IOLoginDataSave::savePlayerMounts(std::shared_ptr<Player> player) {

DBInsert mountQuery("INSERT INTO `player_mounts` (`player_id`, `mount_id`) VALUES ");

for (const auto &mountId : player->mounts) {
for (const auto &mountId : player->mountsMap) {
query << player->getGUID() << ',' << mountId;
if (!mountQuery.addRow(query)) {
return false;
Expand Down

0 comments on commit 815b984

Please sign in to comment.