Fix uninitialized oldMaxMana variable in Player::setMana (#1152)

This commit is contained in:
vfjpl 2021-06-16 23:25:43 +02:00 committed by GitHub
parent 1e29b5cb01
commit 9ce2cab9ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -59,7 +59,7 @@ LocalPlayer::LocalPlayer()
void LocalPlayer::lockWalk(int millis)
{
m_walkLockExpiration = std::max<int>(m_walkLockExpiration, (ticks_t) g_clock.millis() + millis);
m_walkLockExpiration = std::max<ticks_t>(m_walkLockExpiration, g_clock.millis() + millis);
}
bool LocalPlayer::canWalk(Otc::Direction)
@ -102,8 +102,9 @@ void LocalPlayer::walk(const Position& oldPos, const Position& newPos)
if(newPos == m_lastPrewalkDestination) {
updateWalk();
// was to another direction, replace the walk
} else
} else {
Creature::walk(oldPos, newPos);
}
}
// no prewalk was going on, this must be an server side automated walk
else {
@ -259,8 +260,9 @@ void LocalPlayer::updateWalkOffset(int totalPixelsWalked)
m_walkOffset.x = totalPixelsWalked;
else if(m_direction == Otc::West || m_direction == Otc::NorthWest || m_direction == Otc::SouthWest)
m_walkOffset.x = -totalPixelsWalked;
} else
} else {
Creature::updateWalkOffset(totalPixelsWalked);
}
}
void LocalPlayer::updateWalk()
@ -425,7 +427,7 @@ void LocalPlayer::setMana(double mana, double maxMana)
{
if(m_mana != mana || m_maxMana != maxMana) {
double oldMana = m_mana;
double oldMaxMana;
double oldMaxMana = m_maxMana;
m_mana = mana;
m_maxMana = maxMana;

View File

@ -85,7 +85,7 @@ public:
double getStamina() { return m_stamina; }
double getRegenerationTime() { return m_regenerationTime; }
double getOfflineTrainingTime() { return m_offlineTrainingTime; }
std::vector<int> getSpells() { return m_spells; }
const std::vector<int>& getSpells() { return m_spells; }
ItemPtr getInventoryItem(Otc::InventorySlot inventory) { return m_inventoryItems[inventory]; }
int getBlessings() { return m_blessings; }