Skip to content

Commit

Permalink
Code format - (Clang-format)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 21, 2023
1 parent 41e1e95 commit f6ab67e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/items/functions/item/item_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/items/weapons/weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -41,11 +41,11 @@ void Weapons::clear(bool isFromXML /*= false*/) {
++it;
}
}

if (numRemoved > 0) {
g_logger().debug("Removed '{}' Weapon from XML.", numRemoved);
}

return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/items/weapons/weapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Weapon : public Script {
}

bool isFromXML() const {
return m_fromXML;
return m_fromXML;
}

protected:
Expand Down
12 changes: 6 additions & 6 deletions src/lua/creature/movement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>& moveEvent) {

eventList.remove_if([&](const std::shared_ptr<MoveEvent> &moveEvent) {
bool removed = moveEvent && moveEvent->isFromXML();
if (removed) {
g_logger().debug("MoveEvent with id '{}' is from XML and will be removed.", pair.first);
Expand Down
38 changes: 19 additions & 19 deletions src/utils/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, WeaponType_t> 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);
Expand All @@ -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<std::string, MoveEvent_t> 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);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f6ab67e

Please sign in to comment.