Skip to content

Commit

Permalink
fix: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE committed Oct 28, 2024
1 parent c31b462 commit 7f32254
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "creatures/monsters/monsters.hpp"
#include "creatures/players/player.hpp"
#include "creatures/players/wheel/player_wheel.hpp"
#include "creatures/players/wheel/wheel_gems.hpp"
#include "creatures/players/achievement/player_achievement.hpp"
#include "creatures/players/cyclopedia/player_badge.hpp"
#include "creatures/players/cyclopedia/player_cyclopedia.hpp"
Expand Down
14 changes: 7 additions & 7 deletions src/creatures/players/wheel/player_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,8 +1144,8 @@ void PlayerWheel::destroyGem(uint16_t index) {
return;
}

auto backpack = m_player.getInventoryItem(CONST_SLOT_BACKPACK);
auto mainBackpack = backpack ? backpack->getContainer() : nullptr;
const auto &backpack = m_player.getInventoryItem(CONST_SLOT_BACKPACK);
const auto &mainBackpack = backpack ? backpack->getContainer() : nullptr;

uint8_t lesserFragments = 0;
uint8_t greaterFragments = 0;
Expand All @@ -1163,7 +1163,7 @@ void PlayerWheel::destroyGem(uint16_t index) {
}

if (lesserFragments > 0) {
const auto fragmentsItem = Item::CreateItem(ITEM_LESSER_FRAGMENT, lesserFragments);
const auto &fragmentsItem = Item::CreateItem(ITEM_LESSER_FRAGMENT, lesserFragments);
auto returnValue = g_game().internalPlayerAddItem(m_player.getPlayer(), fragmentsItem, false, CONST_SLOT_WHEREEVER);
if (returnValue != RETURNVALUE_NOERROR) {
g_logger().error("Failed to add {} lesser fragments to player with name {}", lesserFragments, m_player.getName());
Expand All @@ -1174,7 +1174,7 @@ void PlayerWheel::destroyGem(uint16_t index) {
}

if (greaterFragments > 0) {
const auto fragmentsItem = Item::CreateItem(ITEM_GREATER_FRAGMENT, greaterFragments);
const auto &fragmentsItem = Item::CreateItem(ITEM_GREATER_FRAGMENT, greaterFragments);
auto returnValue = g_game().internalPlayerAddItem(m_player.getPlayer(), fragmentsItem, false, CONST_SLOT_BACKPACK);
if (returnValue != RETURNVALUE_NOERROR) {
g_logger().error("Failed to add {} greater fragments to player with name {}", greaterFragments, m_player.getName());
Expand Down Expand Up @@ -1267,7 +1267,7 @@ void PlayerWheel::addGems(NetworkMessage &msg) const {

void PlayerWheel::addGradeModifiers(NetworkMessage &msg) const {
msg.addByte(0x2E); // Modifiers for all Vocations
for (auto modPosition : modsBasicPosition) {
for (const auto &modPosition : modsBasicPosition) {
const auto pos = static_cast<uint8_t>(modPosition);
msg.addByte(pos);
uint8_t grade = 0;
Expand All @@ -1285,7 +1285,7 @@ void PlayerWheel::addGradeModifiers(NetworkMessage &msg) const {
const auto modsSupremeIt = modsSupremePositionByVocation.find(vocationBaseId);

if (modsSupremeIt != modsSupremePositionByVocation.end()) {
for (auto modPosition : modsSupremeIt->second.get()) {
for (const auto &modPosition : modsSupremeIt->second.get()) {
const auto pos = static_cast<uint8_t>(modPosition);
msg.addByte(pos);
uint8_t grade = 0;
Expand Down Expand Up @@ -3036,7 +3036,7 @@ std::shared_ptr<Spell> PlayerWheel::getCombatDataSpell(CombatDamage &damage) {
spell = g_spells().getRuneSpellByName(damage.runeSpellName);
}
if (spell) {
const auto spellName = spell->getName();
const auto &spellName = spell->getName();

damage.damageMultiplier += checkFocusMasteryDamage();
if (getHealingLinkUpgrade(spellName)) {
Expand Down

0 comments on commit 7f32254

Please sign in to comment.