summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:21:43 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-29 14:18:06 +0100
commite7c285e3423ddd660447f6a6fc6bbae25f99f386 (patch)
tree1d700f09a5e96a2a0d390af30581097bdec0bf77 /src/net/manaserv
parente1a7c1d0ca30c2c4a293ffbff6b9c51c881d23e3 (diff)
downloadmana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.gz
mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.bz2
mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.xz
mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.zip
Apply C++11 fixits
modernize-loop-convert modernize-deprecated-headers
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/charhandler.cpp7
-rw-r--r--src/net/manaserv/inventoryhandler.cpp23
2 files changed, 13 insertions, 17 deletions
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index d5a5497e..c8c23c7f 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -397,11 +397,10 @@ void CharHandler::updateCharacters()
character->data.mAttributes[CHAR_POINTS] = info.characterPoints;
character->data.mAttributes[CORR_POINTS] = info.correctionPoints;
- for (auto it = info.attribute.begin(),
- it_end = info.attribute.end(); it != it_end; it++)
+ for (const auto &it : info.attribute)
{
- character->data.mStats[i].base = it->second.base;
- character->data.mStats[i].mod = it->second.mod;
+ character->data.mStats[i].base = it.second.base;
+ character->data.mStats[i].mod = it.second.mod;
}
mCharacters.push_back(character);
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index af482400..8898db55 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -99,13 +99,12 @@ void EquipBackend::triggerUnequip(int slotIndex) const
void EquipBackend::clear()
{
- for (auto i = mSlots.begin(), i_end = mSlots.end();
- i != i_end; ++i)
+ for (auto &slot : mSlots)
{
- if (i->second.item)
+ if (slot.second.item)
{
- delete i->second.item;
- i->second.item = nullptr;
+ delete slot.second.item;
+ slot.second.item = nullptr;
}
}
mSlots.clear();
@@ -280,22 +279,20 @@ void EquipBackend::readBoxNode(xmlNodePtr slotNode)
bool EquipBackend::isWeaponSlot(int slotTypeId) const
{
- for (auto it = mSlots.begin(), it_end = mSlots.end();
- it != it_end; ++it)
+ for (const auto &slot : mSlots)
{
- if (it->second.slotTypeId == (unsigned)slotTypeId)
- return it->second.weaponSlot;
+ if (slot.second.slotTypeId == (unsigned)slotTypeId)
+ return slot.second.weaponSlot;
}
return false;
}
bool EquipBackend::isAmmoSlot(int slotTypeId) const
{
- for (auto it = mSlots.begin(), it_end = mSlots.end();
- it != it_end; ++it)
+ for (const auto &slot : mSlots)
{
- if (it->second.slotTypeId == (unsigned)slotTypeId)
- return it->second.ammoSlot;
+ if (slot.second.slotTypeId == (unsigned)slotTypeId)
+ return slot.second.ammoSlot;
}
return false;
}