From f6ab67ed1f9f2004e3398ed16b42366d4059cc21 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 21 Sep 2023 20:15:47 +0000 Subject: [PATCH] Code format - (Clang-format) --- src/items/functions/item/item_parse.cpp | 2 +- src/items/weapons/weapons.cpp | 6 ++-- src/items/weapons/weapons.hpp | 2 +- src/lua/creature/movement.cpp | 12 ++++---- src/utils/tools.cpp | 38 ++++++++++++------------- src/utils/tools.hpp | 4 +-- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/items/functions/item/item_parse.cpp b/src/items/functions/item/item_parse.cpp index c43dd945f12..91a7610d9fd 100644 --- a/src/items/functions/item/item_parse.cpp +++ b/src/items/functions/item/item_parse.cpp @@ -1188,7 +1188,7 @@ void ItemParse::parseUnscriptedItems(const std::string_view &tmpStrValue, pugi:: auto stringKey = asLowerCaseString(subKeyAttribute.as_string()); if (stringKey == "eventtype") { - const auto& eventTypeName = asLowerCaseString(subValueAttribute.as_string()); + const auto &eventTypeName = asLowerCaseString(subValueAttribute.as_string()); eventType = getMoveEventType(eventTypeName); g_logger().debug("Found event type '{}'", eventTypeName); break; diff --git a/src/items/weapons/weapons.cpp b/src/items/weapons/weapons.cpp index d6a5dd33563..666f7704856 100644 --- a/src/items/weapons/weapons.cpp +++ b/src/items/weapons/weapons.cpp @@ -32,7 +32,7 @@ const Weapon* Weapons::getWeapon(const Item* item) const { void Weapons::clear(bool isFromXML /*= false*/) { if (isFromXML) { int numRemoved = 0; - for (auto it = weapons.begin(); it != weapons.end(); ) { + for (auto it = weapons.begin(); it != weapons.end();) { if (it->second && it->second->isFromXML()) { g_logger().debug("Weapon with id '{}' is from XML and will be removed.", it->first); it = weapons.erase(it); @@ -41,11 +41,11 @@ void Weapons::clear(bool isFromXML /*= false*/) { ++it; } } - + if (numRemoved > 0) { g_logger().debug("Removed '{}' Weapon from XML.", numRemoved); } - + return; } diff --git a/src/items/weapons/weapons.hpp b/src/items/weapons/weapons.hpp index 064e38852da..4e4b0763442 100644 --- a/src/items/weapons/weapons.hpp +++ b/src/items/weapons/weapons.hpp @@ -178,7 +178,7 @@ class Weapon : public Script { } bool isFromXML() const { - return m_fromXML; + return m_fromXML; } protected: diff --git a/src/lua/creature/movement.cpp b/src/lua/creature/movement.cpp index b5c0a499eff..ca56ece88a4 100644 --- a/src/lua/creature/movement.cpp +++ b/src/lua/creature/movement.cpp @@ -18,15 +18,15 @@ void MoveEvents::clear(bool isFromXML /*= false*/) { if (isFromXML) { int numRemoved = 0; - for (auto& pair : itemIdMap) { - MoveEventList& moveEventList = pair.second; - + for (auto &pair : itemIdMap) { + MoveEventList &moveEventList = pair.second; + for (int moveEventType = 0; moveEventType < MOVE_EVENT_LAST; ++moveEventType) { - auto& eventList = moveEventList.moveEvent[moveEventType]; + auto &eventList = moveEventList.moveEvent[moveEventType]; int originalSize = eventList.size(); - - eventList.remove_if([&](const std::shared_ptr& moveEvent) { + + eventList.remove_if([&](const std::shared_ptr &moveEvent) { bool removed = moveEvent && moveEvent->isFromXML(); if (removed) { g_logger().debug("MoveEvent with id '{}' is from XML and will be removed.", pair.first); diff --git a/src/utils/tools.cpp b/src/utils/tools.cpp index c8b4f4583cd..848086bf21f 100644 --- a/src/utils/tools.cpp +++ b/src/utils/tools.cpp @@ -1074,17 +1074,17 @@ std::string getWeaponName(WeaponType_t weaponType) { } } -WeaponType_t getWeaponType(const std::string& name) { +WeaponType_t getWeaponType(const std::string &name) { static const std::unordered_map type_mapping = { - {"none", WeaponType_t::WEAPON_NONE}, - {"sword", WeaponType_t::WEAPON_SWORD}, - {"club", WeaponType_t::WEAPON_CLUB}, - {"axe", WeaponType_t::WEAPON_AXE}, - {"shield", WeaponType_t::WEAPON_SHIELD}, - {"distance", WeaponType_t::WEAPON_DISTANCE}, - {"wand", WeaponType_t::WEAPON_WAND}, - {"ammo", WeaponType_t::WEAPON_AMMO}, - {"missile", WeaponType_t::WEAPON_MISSILE} + { "none", WeaponType_t::WEAPON_NONE }, + { "sword", WeaponType_t::WEAPON_SWORD }, + { "club", WeaponType_t::WEAPON_CLUB }, + { "axe", WeaponType_t::WEAPON_AXE }, + { "shield", WeaponType_t::WEAPON_SHIELD }, + { "distance", WeaponType_t::WEAPON_DISTANCE }, + { "wand", WeaponType_t::WEAPON_WAND }, + { "ammo", WeaponType_t::WEAPON_AMMO }, + { "missile", WeaponType_t::WEAPON_MISSILE } }; auto it = type_mapping.find(name); @@ -1095,16 +1095,16 @@ WeaponType_t getWeaponType(const std::string& name) { return WEAPON_NONE; } -MoveEvent_t getMoveEventType(const std::string& name) { +MoveEvent_t getMoveEventType(const std::string &name) { static const std::unordered_map move_event_type_mapping = { - {"stepin", MOVE_EVENT_STEP_IN}, - {"stepout", MOVE_EVENT_STEP_OUT}, - {"equip", MOVE_EVENT_EQUIP}, - {"deequip", MOVE_EVENT_DEEQUIP}, - {"additem", MOVE_EVENT_ADD_ITEM}, - {"removeitem", MOVE_EVENT_REMOVE_ITEM}, - {"additemitemtile", MOVE_EVENT_ADD_ITEM_ITEMTILE}, - {"removeitemitemtile", MOVE_EVENT_REMOVE_ITEM_ITEMTILE} + { "stepin", MOVE_EVENT_STEP_IN }, + { "stepout", MOVE_EVENT_STEP_OUT }, + { "equip", MOVE_EVENT_EQUIP }, + { "deequip", MOVE_EVENT_DEEQUIP }, + { "additem", MOVE_EVENT_ADD_ITEM }, + { "removeitem", MOVE_EVENT_REMOVE_ITEM }, + { "additemitemtile", MOVE_EVENT_ADD_ITEM_ITEMTILE }, + { "removeitemitemtile", MOVE_EVENT_REMOVE_ITEM_ITEMTILE } }; auto it = move_event_type_mapping.find(name); diff --git a/src/utils/tools.hpp b/src/utils/tools.hpp index 62ce0cdadf6..b41d69768a2 100644 --- a/src/utils/tools.hpp +++ b/src/utils/tools.hpp @@ -96,8 +96,8 @@ std::string ucwords(std::string str); bool booleanString(const std::string &str); std::string getWeaponName(WeaponType_t weaponType); -WeaponType_t getWeaponType(const std::string& name); -MoveEvent_t getMoveEventType(const std::string& name); +WeaponType_t getWeaponType(const std::string &name); +MoveEvent_t getMoveEventType(const std::string &name); std::string getCombatName(CombatType_t combatType); CombatType_t getCombatTypeByName(const std::string &combatname);