From 2effe9775db423d61d8a2bdd15c40e6015bac6f5 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 19 Aug 2022 17:34:12 +0200 Subject: Apply C++11 fixits modernize-loop-convert modernize-deprecated-headers --- src/game-server/charactercomponent.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/game-server/charactercomponent.cpp') diff --git a/src/game-server/charactercomponent.cpp b/src/game-server/charactercomponent.cpp index 0248bbe9..68ecc792 100644 --- a/src/game-server/charactercomponent.cpp +++ b/src/game-server/charactercomponent.cpp @@ -41,8 +41,8 @@ #include #include +#include #include -#include Script::Ref CharacterComponent::mDeathCallback; Script::Ref CharacterComponent::mDeathAcceptedCallback; @@ -280,13 +280,12 @@ void CharacterComponent::serialize(Entity &entity, MessageOut &msg) const Possessions &poss = getPossessions(); const InventoryData &inventoryData = poss.getInventory(); - for (auto itemIt = inventoryData.begin(), - itemIt_end = inventoryData.end(); itemIt != itemIt_end; ++itemIt) + for (const auto &itemIt : inventoryData) { - msg.writeInt16(itemIt->first); // slot id - msg.writeInt16(itemIt->second.itemId); - msg.writeInt16(itemIt->second.amount); - msg.writeInt8(itemIt->second.equipmentSlot); + msg.writeInt16(itemIt.first); // slot id + msg.writeInt16(itemIt.second.itemId); + msg.writeInt16(itemIt.second.amount); + msg.writeInt8(itemIt.second.equipmentSlot); } } -- cgit v1.2.3-70-g09d2