From 0fdd8b042bc868ddd85ee0247cd07bb9e7febac2 Mon Sep 17 00:00:00 2001 From: Beats Date: Mon, 24 Jun 2024 13:23:51 -0400 Subject: [PATCH] fix: clang format (#2710) --- .clang-format | 4 +- .github/workflows/clang-lint.yml | 6 +- src/canary_server.cpp | 10 +- src/creatures/appearance/outfit/outfit.cpp | 4 +- src/creatures/combat/combat.cpp | 40 +-- src/creatures/combat/condition.cpp | 2 +- src/creatures/combat/spells.cpp | 20 +- src/creatures/creature.cpp | 2 +- src/creatures/creatures_definitions.hpp | 12 +- src/creatures/interactions/chat.cpp | 16 +- src/creatures/monsters/monster.cpp | 28 +-- src/creatures/monsters/monsters.cpp | 20 +- src/creatures/npcs/npc.cpp | 4 +- .../achievement/player_achievement.cpp | 4 +- .../players/cyclopedia/player_badge.cpp | 2 +- .../players/cyclopedia/player_title.cpp | 2 +- src/creatures/players/grouping/familiars.cpp | 2 +- src/creatures/players/grouping/groups.cpp | 2 +- src/creatures/players/grouping/party.hpp | 2 +- .../players/imbuements/imbuements.cpp | 6 +- src/creatures/players/player.cpp | 32 +-- src/creatures/players/player.hpp | 10 +- src/creatures/players/vocations/vocation.cpp | 12 +- src/database/databasemanager.cpp | 4 +- src/game/game.cpp | 94 +++---- src/game/movement/teleport.cpp | 4 +- src/io/io_bosstiary.cpp | 6 +- src/io/iobestiary.cpp | 6 +- src/io/iomap.cpp | 54 ++-- src/io/ioprey.cpp | 6 +- src/items/decay/decay.cpp | 8 +- src/items/functions/item/item_parse.cpp | 4 +- src/items/item.cpp | 32 +-- src/items/items.cpp | 8 +- src/items/tile.cpp | 2 +- src/items/weapons/weapons.cpp | 4 +- src/lua/callbacks/event_callback.cpp | 230 +++++++++--------- src/lua/creature/actions.cpp | 10 +- src/lua/creature/actions.hpp | 8 +- src/lua/creature/creatureevent.cpp | 60 ++--- src/lua/creature/events.cpp | 194 +++++++-------- src/lua/creature/movement.cpp | 32 +-- src/lua/creature/movement.hpp | 8 +- src/lua/creature/raids.cpp | 104 ++++---- src/lua/creature/talkaction.cpp | 4 +- .../functions/core/game/game_functions.cpp | 4 +- .../creatures/combat/spell_functions.cpp | 22 +- .../creatures/creature_functions.cpp | 2 +- .../creatures/monster/loot_functions.cpp | 12 +- .../monster/monster_type_functions.cpp | 12 +- .../creatures/npc/shop_functions.cpp | 12 +- .../creatures/player/player_functions.cpp | 16 +- src/lua/functions/events/action_functions.cpp | 2 +- .../events/creature_event_functions.cpp | 4 +- .../events/global_event_functions.cpp | 14 +- .../functions/events/move_event_functions.cpp | 8 +- src/lua/functions/items/item_functions.cpp | 2 +- src/lua/functions/items/weapon_functions.cpp | 16 +- src/lua/functions/lua_functions_loader.cpp | 4 +- src/lua/global/baseevents.cpp | 6 +- src/lua/global/globalevent.cpp | 16 +- src/lua/scripts/lua_environment.cpp | 4 +- src/lua/scripts/scripts.cpp | 2 +- src/map/house/house.cpp | 4 +- src/map/house/housetile.cpp | 6 +- src/map/mapcache.cpp | 2 +- src/map/spectators.cpp | 10 +- src/server/network/connection/connection.cpp | 2 +- src/server/network/protocol/protocol.cpp | 2 +- src/server/network/protocol/protocol.hpp | 2 +- src/server/network/protocol/protocolgame.cpp | 46 ++-- src/server/network/protocol/protocollogin.cpp | 2 +- .../network/protocol/protocolstatus.cpp | 4 +- src/server/server.hpp | 8 +- src/server/signals.cpp | 4 +- src/utils/simd.hpp | 2 +- 76 files changed, 688 insertions(+), 688 deletions(-) diff --git a/.clang-format b/.clang-format index de45e1b2e7a..289f5508316 100644 --- a/.clang-format +++ b/.clang-format @@ -111,7 +111,7 @@ QualifierAlignment: Left ReferenceAlignment: Right ReflowComments: true RemoveBracesLLVM: false -SortIncludes: false +SortIncludes: Never SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false @@ -138,4 +138,4 @@ StatementMacros: - QT_REQUIRE_VERSION TabWidth: 4 UseCRLF: false -UseTab: true +UseTab: AlignWithSpaces diff --git a/.github/workflows/clang-lint.yml b/.github/workflows/clang-lint.yml index 67e6427d853..b57e407cbb9 100644 --- a/.github/workflows/clang-lint.yml +++ b/.github/workflows/clang-lint.yml @@ -37,17 +37,17 @@ jobs: - name: Run clang format lint if: ${{ github.ref != 'refs/heads/main' }} - uses: DoozyX/clang-format-lint-action@v0.16.2 + uses: DoozyX/clang-format-lint-action@v0.17 with: source: "src" exclude: "src/protobuf" extensions: "cpp,hpp,h" - clangFormatVersion: 16 + clangFormatVersion: 17 inplace: true - name: Run add and commit if: ${{ github.ref != 'refs/heads/main' }} - uses: EndBug/add-and-commit@v9 + uses: EndBug/add-and-commit@v9.1.4 with: author_name: GitHub Actions author_email: github-actions[bot]@users.noreply.github.com diff --git a/src/canary_server.cpp b/src/canary_server.cpp index 17a36ff3d23..e49a86d7d9f 100644 --- a/src/canary_server.cpp +++ b/src/canary_server.cpp @@ -93,8 +93,8 @@ int CanaryServer::run() { #ifndef _WIN32 if (getuid() == 0 || geteuid() == 0) { logger.warn("{} has been executed as root user, " - "please consider running it as a normal user", - ProtocolStatus::SERVER_NAME); + "please consider running it as a normal user", + ProtocolStatus::SERVER_NAME); } #endif @@ -213,7 +213,7 @@ void CanaryServer::logInfos() { logger.info("A server developed by: {}", ProtocolStatus::SERVER_DEVELOPERS); logger.info("Visit our website for updates, support, and resources: " - "https://docs.opentibiabr.com/"); + "https://docs.opentibiabr.com/"); } /** @@ -234,7 +234,7 @@ void CanaryServer::toggleForceCloseButton() { void CanaryServer::badAllocationHandler() { // Use functions that only use stack allocation g_logger().error("Allocation failed, server out of memory, " - "decrease the size of your map or compile in 64 bits mode"); + "decrease the size of your map or compile in 64 bits mode"); if (isatty(STDIN_FILENO)) { getchar(); @@ -318,7 +318,7 @@ void CanaryServer::initializeDatabase() { DatabaseManager::updateDatabase(); if (g_configManager().getBoolean(OPTIMIZE_DATABASE, __FUNCTION__) - && !DatabaseManager::optimizeTables()) { + && !DatabaseManager::optimizeTables()) { logger.debug("No tables were optimized"); } } diff --git a/src/creatures/appearance/outfit/outfit.cpp b/src/creatures/appearance/outfit/outfit.cpp index 97120659333..251bf7bde35 100644 --- a/src/creatures/appearance/outfit/outfit.cpp +++ b/src/creatures/appearance/outfit/outfit.cpp @@ -58,8 +58,8 @@ bool Outfits::loadFromXml() { } if (auto lookType = pugi::cast(lookTypeAttribute.value()); - g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS, __FUNCTION__) && lookType != 0 - && !g_game().isLookTypeRegistered(lookType)) { + g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS, __FUNCTION__) && lookType != 0 + && !g_game().isLookTypeRegistered(lookType)) { g_logger().warn("[Outfits::loadFromXml] An unregistered creature looktype type with id '{}' was ignored to prevent client crash.", lookType); continue; } diff --git a/src/creatures/combat/combat.cpp b/src/creatures/combat/combat.cpp index 175fad49e20..87f7500d0a9 100644 --- a/src/creatures/combat/combat.cpp +++ b/src/creatures/combat/combat.cpp @@ -657,8 +657,8 @@ CombatDamage Combat::applyImbuementElementalDamage(std::shared_ptr attac } if (imbuementInfo.imbuement->combatType == COMBAT_NONE - || damage.primary.type == COMBAT_HEALING - || damage.secondary.type == COMBAT_HEALING) { + || damage.primary.type == COMBAT_HEALING + || damage.secondary.type == COMBAT_HEALING) { continue; } @@ -1256,8 +1256,8 @@ void Combat::doCombatHealth(std::shared_ptr caster, std::shared_ptr caster, std::shared_ptr target, const Position &origin, CombatDamage &damage, const CombatParams ¶ms) { bool canCombat = !params.aggressive || (caster != target && Combat::canDoCombat(caster, target, params.aggressive) == RETURNVALUE_NOERROR); if ((caster && target) - && (caster == target || canCombat) - && (params.impactEffect != CONST_ME_NONE)) { + && (caster == target || canCombat) + && (params.impactEffect != CONST_ME_NONE)) { g_game().addMagicEffect(target->getPosition(), params.impactEffect); } @@ -1300,8 +1300,8 @@ void Combat::doCombatMana(std::shared_ptr caster, std::shared_ptr caster, std::shared_ptr target, const Position &origin, CombatDamage &damage, const CombatParams ¶ms) { bool canCombat = !params.aggressive || (caster != target && Combat::canDoCombat(caster, target, params.aggressive) == RETURNVALUE_NOERROR); if ((caster && target) - && (caster == target || canCombat) - && (params.impactEffect != CONST_ME_NONE)) { + && (caster == target || canCombat) + && (params.impactEffect != CONST_ME_NONE)) { g_game().addMagicEffect(target->getPosition(), params.impactEffect); } @@ -1368,8 +1368,8 @@ void Combat::doCombatDispel(std::shared_ptr caster, const Position &po void Combat::doCombatDispel(std::shared_ptr caster, std::shared_ptr target, const CombatParams ¶ms) { bool canCombat = !params.aggressive || (caster != target && Combat::canDoCombat(caster, target, params.aggressive) == RETURNVALUE_NOERROR); if ((caster && target) - && (caster == target || canCombat) - && (params.impactEffect != CONST_ME_NONE)) { + && (caster == target || canCombat) + && (params.impactEffect != CONST_ME_NONE)) { g_game().addMagicEffect(target->getPosition(), params.impactEffect); } @@ -1408,7 +1408,7 @@ void Combat::doCombatDefault(std::shared_ptr caster, std::shared_ptrgetPosition(), params.impactEffect); + g_game().addMagicEffect(target->getPosition(), params.impactEffect); } */ @@ -1540,8 +1540,8 @@ void ValueCallback::getMinMaxValues(std::shared_ptr player, CombatDamage // onGetPlayerMinMaxValues(...) if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[ValueCallback::getMinMaxValues - Player {} formula {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), fmt::underlying(type)); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), fmt::underlying(type)); return; } @@ -1633,8 +1633,8 @@ void TileCallback::onTileCombat(std::shared_ptr creature, std::shared_ // onTileCombat(creature, pos) if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[TileCallback::onTileCombat - Creature {} type {} on tile x: {} y: {} z: {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), fmt::underlying(type), (tile->getPosition()).getX(), (tile->getPosition()).getY(), (tile->getPosition()).getZ()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), fmt::underlying(type), (tile->getPosition()).getX(), (tile->getPosition()).getY(), (tile->getPosition()).getZ()); return; } @@ -1664,8 +1664,8 @@ void TargetCallback::onTargetCombat(std::shared_ptr creature, std::sha // onTargetCombat(creature, target) if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[TargetCallback::onTargetCombat - Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName()); return; } @@ -1724,8 +1724,8 @@ void ChainCallback::onChainCombat(std::shared_ptr creature, uint8_t &m // onChainCombat(creature) if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[ChainCallback::onTargetCombat - Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName()); return; } @@ -1766,8 +1766,8 @@ bool ChainPickerCallback::onChainCombat(std::shared_ptr creature, std: // onChainCombat(creature, target) if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[ChainPickerCallback::onTargetCombat - Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName()); return true; } @@ -2178,7 +2178,7 @@ void Combat::applyExtensions(std::shared_ptr caster, std::shared_ptrgetInventoryItem(CONST_SLOT_LEFT); - playerWeapon != nullptr && playerWeapon->getTier() > 0) { + playerWeapon != nullptr && playerWeapon->getTier() > 0) { double_t fatalChance = playerWeapon->getFatalChance(); double_t randomChance = uniform_random(0, 10000) / 100; if (fatalChance > 0 && randomChance < fatalChance) { diff --git a/src/creatures/combat/condition.cpp b/src/creatures/combat/condition.cpp index 7f477f1d859..b9603d010a2 100644 --- a/src/creatures/combat/condition.cpp +++ b/src/creatures/combat/condition.cpp @@ -2042,7 +2042,7 @@ bool ConditionFeared::executeCondition(std::shared_ptr creature, int32 g_dispatcher().addEvent([id = creature->getID(), listDir = listDir.data()] { g_game().forcePlayerAutoWalk(id, listDir); }, - "ConditionFeared::executeCondition"); + "ConditionFeared::executeCondition"); g_logger().debug("[ConditionFeared::executeCondition] Walking Scheduled"); } diff --git a/src/creatures/combat/spells.cpp b/src/creatures/combat/spells.cpp index dd4305de14e..f8852c5e534 100644 --- a/src/creatures/combat/spells.cpp +++ b/src/creatures/combat/spells.cpp @@ -108,7 +108,7 @@ void Spells::clear() { bool Spells::hasInstantSpell(const std::string &word) const { if (auto iterate = instants.find(word); - iterate != instants.end()) { + iterate != instants.end()) { return true; } return false; @@ -127,8 +127,8 @@ bool Spells::registerInstantLuaEvent(const std::shared_ptr instant // Checks if there is any spell registered with the same name if (hasInstantSpell(words)) { g_logger().warn("[Spells::registerInstantLuaEvent] - " - "Duplicate registered instant spell with words: {}, on spell with name: {}", - words, instantName); + "Duplicate registered instant spell with words: {}, on spell with name: {}", + words, instantName); return false; } // Register spell word in the map @@ -166,7 +166,7 @@ std::list Spells::getSpellsByVocation(uint16_t vocationId) { vocSpellsIt = vocSpells.find(vocationId); if (vocSpellsIt != vocSpells.end() - && vocSpellsIt->second) { + && vocSpellsIt->second) { spellsList.push_back(it.second->getSpellId()); } } @@ -361,8 +361,8 @@ bool CombatSpell::executeCastSpell(std::shared_ptr creature, const Lua // onCastSpell(creature, var) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CombatSpell::executeCastSpell - Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName()); return false; } @@ -950,8 +950,8 @@ bool InstantSpell::executeCastSpell(std::shared_ptr creature, const Lu // onCastSpell(creature, var) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[InstantSpell::executeCastSpell - Creature {} words {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), getWords()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), getWords()); return false; } @@ -1095,8 +1095,8 @@ bool RuneSpell::executeCastSpell(std::shared_ptr creature, const LuaVa // onCastSpell(creature, var, isHotkey) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[RuneSpell::executeCastSpell - Creature {} runeId {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), getRuneItemId()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), getRuneItemId()); return false; } diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index d033d59c829..c68ab4f351b 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -828,7 +828,7 @@ bool Creature::dropCorpse(std::shared_ptr lastHitCreature, std::shared g_dispatcher().addEvent([player, corpseContainer, corpsePosition = corpse->getPosition()] { g_game().playerQuickLootCorpse(player, corpseContainer, corpsePosition); }, - "Game::playerQuickLootCorpse"); + "Game::playerQuickLootCorpse"); } } } diff --git a/src/creatures/creatures_definitions.hpp b/src/creatures/creatures_definitions.hpp index 33f62dbd2aa..74ec6c5f2c8 100644 --- a/src/creatures/creatures_definitions.hpp +++ b/src/creatures/creatures_definitions.hpp @@ -1524,12 +1524,12 @@ using StashItemList = std::map; using ItemsTierCountList = std::map>; /* - > ItemsTierCountList structure: - |- [itemID] - |- [itemTier] - |- Count - | ... - | ... + > ItemsTierCountList structure: + |- [itemID] + |- [itemTier] + |- Count + | ... + | ... */ struct ProtocolFamiliars { diff --git a/src/creatures/interactions/chat.cpp b/src/creatures/interactions/chat.cpp index e16af670fcc..900247e457a 100644 --- a/src/creatures/interactions/chat.cpp +++ b/src/creatures/interactions/chat.cpp @@ -145,8 +145,8 @@ bool ChatChannel::executeCanJoinEvent(const std::shared_ptr &player) { LuaScriptInterface* scriptInterface = g_chat().getScriptInterface(); if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[CanJoinChannelEvent::execute - Player {}, on channel {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), getName()); return false; } @@ -171,8 +171,8 @@ bool ChatChannel::executeOnJoinEvent(const std::shared_ptr &player) { LuaScriptInterface* scriptInterface = g_chat().getScriptInterface(); if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[OnJoinChannelEvent::execute - Player {}, on channel {}] " - "Call stack overflow. Too many lua script calls being nested", - player->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested", + player->getName(), getName()); return false; } @@ -197,8 +197,8 @@ bool ChatChannel::executeOnLeaveEvent(const std::shared_ptr &player) { LuaScriptInterface* scriptInterface = g_chat().getScriptInterface(); if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[OnLeaveChannelEvent::execute - Player {}, on channel {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), getName()); return false; } @@ -223,8 +223,8 @@ bool ChatChannel::executeOnSpeakEvent(const std::shared_ptr &player, Spe LuaScriptInterface* scriptInterface = g_chat().getScriptInterface(); if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[OnSpeakChannelEvent::execute - Player {}, type {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), fmt::underlying(type)); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), fmt::underlying(type)); return false; } diff --git a/src/creatures/monsters/monster.cpp b/src/creatures/monsters/monster.cpp index 5e0a7d16bb4..4b993cbab0e 100644 --- a/src/creatures/monsters/monster.cpp +++ b/src/creatures/monsters/monster.cpp @@ -50,8 +50,8 @@ Monster::Monster(const std::shared_ptr mType) : for (const std::string &scriptName : mType->info.scripts) { if (!registerCreatureEvent(scriptName)) { g_logger().warn("[Monster::Monster] - " - "Unknown event name: {}", - scriptName); + "Unknown event name: {}", + scriptName); } } } @@ -138,8 +138,8 @@ void Monster::onCreatureAppear(std::shared_ptr creature, bool isLogin) LuaScriptInterface* scriptInterface = mType->info.scriptInterface; if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[Monster::onCreatureAppear - Monster {} creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - getName(), creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + getName(), creature->getName()); return; } @@ -176,8 +176,8 @@ void Monster::onRemoveCreature(std::shared_ptr creature, bool isLogout LuaScriptInterface* scriptInterface = mType->info.scriptInterface; if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[Monster::onCreatureDisappear - Monster {} creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - getName(), creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + getName(), creature->getName()); return; } @@ -217,8 +217,8 @@ void Monster::onCreatureMove(const std::shared_ptr &creature, const st LuaScriptInterface* scriptInterface = mType->info.scriptInterface; if (!scriptInterface->reserveScriptEnv()) { g_logger().error("[Monster::onCreatureMove - Monster {} creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - getName(), creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + getName(), creature->getName()); return; } @@ -291,8 +291,8 @@ void Monster::onCreatureSay(std::shared_ptr creature, SpeakClasses typ LuaScriptInterface* scriptInterface = mType->info.scriptInterface; if (!scriptInterface->reserveScriptEnv()) { g_logger().error("Monster {} creature {}] Call stack overflow. Too many lua " - "script calls being nested.", - getName(), creature->getName()); + "script calls being nested.", + getName(), creature->getName()); return; } @@ -771,8 +771,8 @@ void Monster::onThink(uint32_t interval) { LuaScriptInterface* scriptInterface = mType->info.scriptInterface; if (!scriptInterface->reserveScriptEnv()) { g_logger().error("Monster {} Call stack overflow. Too many lua script calls " - "being nested.", - getName()); + "being nested.", + getName()); return; } @@ -2041,8 +2041,8 @@ void Monster::dropLoot(std::shared_ptr corpse, std::shared_ptr spell, spell } if (std::string spellName = asLowerCaseString(spell->name); - spellName == "melee") { + spellName == "melee") { sb.isMelee = true; if (spell->attack > 0 && spell->skill > 0) { @@ -164,8 +164,8 @@ bool Monsters::deserializeSpell(const std::shared_ptr spell, spell condition->setOutfit(outfit); } else { g_logger().error("[Monsters::deserializeSpell] - " - "Missing outfit monster or item in outfit spell for: {}", - description); + "Missing outfit monster or item in outfit spell for: {}", + description); return false; } @@ -208,8 +208,8 @@ bool Monsters::deserializeSpell(const std::shared_ptr spell, spell } else if (spellName == "condition") { if (spell->conditionType == CONDITION_NONE) { g_logger().error("[Monsters::deserializeSpell] - " - "{} condition is not set for: {}", - description, spell->name); + "{} condition is not set for: {}", + description, spell->name); } } else if (spellName == "strength") { // @@ -217,8 +217,8 @@ bool Monsters::deserializeSpell(const std::shared_ptr spell, spell // } else { g_logger().error("[Monsters::deserializeSpell] - " - "{} unknown or missing parameter on spell with name: {}", - description, spell->name); + "{} unknown or missing parameter on spell with name: {}", + description, spell->name); } if (spell->shoot != CONST_ANI_NONE) { @@ -295,9 +295,9 @@ bool MonsterType::loadCallback(LuaScriptInterface* scriptInterface) { std::shared_ptr Monsters::getMonsterType(const std::string &name, bool silent /* = false*/) const { std::string lowerCaseName = asLowerCaseString(name); if (auto it = monsters.find(lowerCaseName); - it != monsters.end() - // We will only return the MonsterType if it match the exact name of the monster - && it->first.find(lowerCaseName) != it->first.npos) { + it != monsters.end() + // We will only return the MonsterType if it match the exact name of the monster + && it->first.find(lowerCaseName) != it->first.npos) { return it->second; } if (!silent) { diff --git a/src/creatures/npcs/npc.cpp b/src/creatures/npcs/npc.cpp index 8f6fa370087..fdbf58853b4 100644 --- a/src/creatures/npcs/npc.cpp +++ b/src/creatures/npcs/npc.cpp @@ -521,7 +521,7 @@ void Npc::onThinkWalk(uint32_t interval) { } if (Direction newDirection; - getRandomStep(newDirection)) { + getRandomStep(newDirection)) { listWalkDir.push_front(newDirection); addEventWalk(); } @@ -633,7 +633,7 @@ bool Npc::getRandomStep(Direction &moveDirection) { std::ranges::shuffle(directionvector, getRandomGenerator()); for (const Position &creaturePos = getPosition(); - Direction direction : directionvector) { + Direction direction : directionvector) { if (canWalkTo(creaturePos, direction)) { moveDirection = direction; return true; diff --git a/src/creatures/players/achievement/player_achievement.cpp b/src/creatures/players/achievement/player_achievement.cpp index 2db53dbe776..69d1d7ab1fa 100644 --- a/src/creatures/players/achievement/player_achievement.cpp +++ b/src/creatures/players/achievement/player_achievement.cpp @@ -53,7 +53,7 @@ bool PlayerAchievement::remove(uint16_t id) { if (auto it = std::find_if(m_achievementsUnlocked.begin(), m_achievementsUnlocked.end(), [id](auto achievement_it) { return achievement_it.first == id; }); - it != m_achievementsUnlocked.end()) { + it != m_achievementsUnlocked.end()) { getUnlockedKV()->remove(achievement.name); m_achievementsUnlocked.erase(it); removePoints(achievement.points); @@ -72,7 +72,7 @@ bool PlayerAchievement::isUnlocked(uint16_t id) const { if (auto it = std::find_if(m_achievementsUnlocked.begin(), m_achievementsUnlocked.end(), [id](auto achievement_it) { return achievement_it.first == id; }); - it != m_achievementsUnlocked.end()) { + it != m_achievementsUnlocked.end()) { return true; } diff --git a/src/creatures/players/cyclopedia/player_badge.cpp b/src/creatures/players/cyclopedia/player_badge.cpp index 9b892a6164c..639640b2ffe 100644 --- a/src/creatures/players/cyclopedia/player_badge.cpp +++ b/src/creatures/players/cyclopedia/player_badge.cpp @@ -26,7 +26,7 @@ bool PlayerBadge::hasBadge(uint8_t id) const { if (auto it = std::find_if(m_badgesUnlocked.begin(), m_badgesUnlocked.end(), [id](auto badge_it) { return badge_it.first.m_id == id; }); - it != m_badgesUnlocked.end()) { + it != m_badgesUnlocked.end()) { return true; } diff --git a/src/creatures/players/cyclopedia/player_title.cpp b/src/creatures/players/cyclopedia/player_title.cpp index 624b0313457..a6b44f3d3c4 100644 --- a/src/creatures/players/cyclopedia/player_title.cpp +++ b/src/creatures/players/cyclopedia/player_title.cpp @@ -26,7 +26,7 @@ bool PlayerTitle::isTitleUnlocked(uint8_t id) const { if (auto it = std::find_if(m_titlesUnlocked.begin(), m_titlesUnlocked.end(), [id](auto title_it) { return title_it.first.m_id == id; }); - it != m_titlesUnlocked.end()) { + it != m_titlesUnlocked.end()) { return true; } diff --git a/src/creatures/players/grouping/familiars.cpp b/src/creatures/players/grouping/familiars.cpp index 6e923b823dc..6312aaa285d 100644 --- a/src/creatures/players/grouping/familiars.cpp +++ b/src/creatures/players/grouping/familiars.cpp @@ -77,7 +77,7 @@ std::shared_ptr Familiars::getFamiliarByLookType(uint16_t vocation, ui if (auto it = std::find_if(familiars[vocation].begin(), familiars[vocation].end(), [lookType](auto familiar_it) { return familiar_it->lookType == lookType; }); - it != familiars[vocation].end()) { + it != familiars[vocation].end()) { return *it; } return nullptr; diff --git a/src/creatures/players/grouping/groups.cpp b/src/creatures/players/grouping/groups.cpp index 937fa848f3f..c4dab4a9039 100644 --- a/src/creatures/players/grouping/groups.cpp +++ b/src/creatures/players/grouping/groups.cpp @@ -103,7 +103,7 @@ std::shared_ptr Groups::getGroup(uint16_t id) const { if (auto it = std::find_if(groups_vector.begin(), groups_vector.end(), [id](auto group_it) { return group_it->id == id; }); - it != groups_vector.end()) { + it != groups_vector.end()) { return *it; } return nullptr; diff --git a/src/creatures/players/grouping/party.hpp b/src/creatures/players/grouping/party.hpp index 10663a278bf..6aaecc56190 100644 --- a/src/creatures/players/grouping/party.hpp +++ b/src/creatures/players/grouping/party.hpp @@ -108,7 +108,7 @@ class Party : public SharedObject { if (auto it = std::find_if(membersData.begin(), membersData.end(), [playerId](const std::shared_ptr &preyIt) { return preyIt->id == playerId; }); - it != membersData.end()) { + it != membersData.end()) { return *it; } diff --git a/src/creatures/players/imbuements/imbuements.cpp b/src/creatures/players/imbuements/imbuements.cpp index ed312dbf8e1..4bfb0de836b 100644 --- a/src/creatures/players/imbuements/imbuements.cpp +++ b/src/creatures/players/imbuements/imbuements.cpp @@ -347,9 +347,9 @@ std::vector Imbuements::getImbuements(std::shared_ptr player // Parse the storages for each imbuement in imbuements.xml and config.lua (enable/disable storage) if (g_configManager().getBoolean(TOGGLE_IMBUEMENT_SHRINE_STORAGE, __FUNCTION__) - && imbuement->getStorage() != 0 - && player->getStorageValue(imbuement->getStorage() == -1) - && imbuement->getBaseID() >= 1 && imbuement->getBaseID() <= 3) { + && imbuement->getStorage() != 0 + && player->getStorageValue(imbuement->getStorage() == -1) + && imbuement->getBaseID() >= 1 && imbuement->getBaseID() <= 3) { continue; } diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 49c553f1326..a9320ffba5f 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -284,7 +284,7 @@ std::shared_ptr Player::getQuiverAmmoOfType(const ItemType &it) const { std::shared_ptr quiver = inventory[CONST_SLOT_RIGHT]; for (std::shared_ptr container = quiver->getContainer(); - auto ammoItem : container->getItemList()) { + auto ammoItem : container->getItemList()) { if (ammoItem->getAmmoType() == it.ammoType) { if (level >= Item::items[ammoItem->getID()].minReqLevel) { return ammoItem; @@ -3835,7 +3835,7 @@ bool Player::hasItemCountById(uint16_t itemId, uint32_t itemAmount, bool checkSt // Check items from stash for (StashItemList stashToSend = getStashItems(); - auto [stashItemId, itemCount] : stashToSend) { + auto [stashItemId, itemCount] : stashToSend) { if (!checkStash) { break; } @@ -5392,7 +5392,7 @@ uint16_t Player::getSkillLevel(skills_t skill) const { skillLevel = std::max(0, skillLevel + varSkills[skill]); if (auto it = maxValuePerSkill.find(skill); - it != maxValuePerSkill.end()) { + it != maxValuePerSkill.end()) { skillLevel = std::min(it->second, skillLevel); } @@ -6228,7 +6228,7 @@ std::pair Player::getForgeSliversAndCores() const { // Check items from stash for (StashItemList stashToSend = getStashItems(); - auto [itemId, itemCount] : stashToSend) { + auto [itemId, itemCount] : stashToSend) { if (itemId == ITEM_FORGE_SLIVER) { sliverCount += itemCount; } @@ -6624,7 +6624,7 @@ std::string Player::getBlessingsName() const { for (uint8_t i = 1; i <= 8; i++) { if (hasBlessing(i)) { if (auto blessName = BlessingNames.find(static_cast(i)); - blessName != BlessingNames.end()) { + blessName != BlessingNames.end()) { os << (*blessName).second; } else { continue; @@ -6817,7 +6817,7 @@ void Player::requestDepotSearchItem(uint16_t itemId, uint8_t tier) { uint32_t stashCount = 0; if (const ItemType &iType = Item::items[itemId]; - iType.stackable && iType.wareId > 0) { + iType.stackable && iType.wareId > 0) { stashCount = getStashItemCount(itemId); } @@ -6866,10 +6866,10 @@ void Player::retrieveAllItemsFromDepotSearch(uint16_t itemId, uint8_t tier, bool for (const std::shared_ptr &locker : depotLocker->getItemList()) { std::shared_ptr c = locker->getContainer(); if (!c || c->empty() || - // Retrieve from inbox. - (c->isInbox() && isDepot) || - // Retrieve from depot. - (!c->isInbox() && !isDepot)) { + // Retrieve from inbox. + (c->isInbox() && isDepot) || + // Retrieve from depot. + (!c->isInbox() && !isDepot)) { continue; } @@ -6935,7 +6935,7 @@ std::shared_ptr Player::getItemFromDepotSearch(uint16_t itemId, const Posi for (const std::shared_ptr &locker : depotLocker->getItemList()) { std::shared_ptr c = locker->getContainer(); if (!c || c->empty() || (c->isInbox() && pos.y != 0x21) || // From inbox. - (!c->isInbox() && pos.y != 0x20)) { // From depot. + (!c->isInbox() && pos.y != 0x20)) { // From depot. continue; } @@ -7119,7 +7119,7 @@ void Player::forgeFuseItems(ForgeAction_t actionType, uint16_t firstItemId, uint return; } if (returnValue = g_game().internalRemoveItem(secondForgingItem, 1); - returnValue != RETURNVALUE_NOERROR) { + returnValue != RETURNVALUE_NOERROR) { g_logger().error("[Log 2] Failed to remove forge item {} from player with name {}", secondItemId, getName()); sendCancelMessage(getReturnMessage(returnValue)); sendForgeError(RETURNVALUE_CONTACTADMINISTRATOR); @@ -7362,7 +7362,7 @@ void Player::forgeTransferItemTier(ForgeAction_t actionType, uint16_t donorItemI return; } if (returnValue = g_game().internalRemoveItem(receiveItem, 1); - returnValue != RETURNVALUE_NOERROR) { + returnValue != RETURNVALUE_NOERROR) { g_logger().error("[Log 2] Failed to remove transfer item {} from player with name {}", receiveItemId, getName()); sendCancelMessage(getReturnMessage(returnValue)); sendForgeError(RETURNVALUE_CONTACTADMINISTRATOR); @@ -7502,7 +7502,7 @@ void Player::forgeResourceConversion(ForgeAction_t actionType) { } if (std::shared_ptr item = Item::CreateItem(ITEM_FORGE_CORE, 1); - item) { + item) { returnValue = g_game().internalPlayerAddItem(static_self_cast(), item); } if (returnValue != RETURNVALUE_NOERROR) { @@ -7524,7 +7524,7 @@ void Player::forgeResourceConversion(ForgeAction_t actionType) { auto upgradeCost = dustLevel - 75; if (auto dusts = getForgeDusts(); - upgradeCost > dusts) { + upgradeCost > dusts) { g_logger().error("[{}] Not enough dust", __FUNCTION__); sendForgeError(RETURNVALUE_CONTACTADMINISTRATOR); return; @@ -8100,7 +8100,7 @@ bool Player::hasPermittedConditionInPZ() const { uint16_t Player::getDodgeChance() const { uint16_t chance = 0; if (auto playerArmor = getInventoryItem(CONST_SLOT_ARMOR); - playerArmor != nullptr && playerArmor->getTier()) { + playerArmor != nullptr && playerArmor->getTier()) { chance += static_cast(playerArmor->getDodgeChance() * 100); } diff --git a/src/creatures/players/player.hpp b/src/creatures/players/player.hpp index 141caafacd9..04b6a139a02 100644 --- a/src/creatures/players/player.hpp +++ b/src/creatures/players/player.hpp @@ -1956,7 +1956,7 @@ class Player final : public Creature, public Cylinder, public Bankable { bool isImmuneCleanse(ConditionType_t conditiontype) { uint64_t timenow = OTSYS_TIME(); if ((cleanseCondition.first == conditiontype) - && (timenow <= cleanseCondition.second)) { + && (timenow <= cleanseCondition.second)) { return true; } return false; @@ -2154,7 +2154,7 @@ class Player final : public Creature, public Cylinder, public Bankable { if (auto it = std::find_if(preys.begin(), preys.end(), [slotid](const std::unique_ptr &preyIt) { return preyIt->id == slotid; }); - it != preys.end()) { + it != preys.end()) { return *it; } @@ -2221,7 +2221,7 @@ class Player final : public Creature, public Cylinder, public Bankable { if (auto it = std::find_if(preys.begin(), preys.end(), [raceId](const std::unique_ptr &it) { return it->selectedRaceId == raceId; }); - it != preys.end()) { + it != preys.end()) { return *it; } @@ -2252,7 +2252,7 @@ class Player final : public Creature, public Cylinder, public Bankable { if (auto it = std::find_if(taskHunting.begin(), taskHunting.end(), [slotid](const std::unique_ptr &itTask) { return itTask->id == slotid; }); - it != taskHunting.end()) { + it != taskHunting.end()) { return *it; } @@ -2321,7 +2321,7 @@ class Player final : public Creature, public Cylinder, public Bankable { if (auto it = std::find_if(taskHunting.begin(), taskHunting.end(), [raceId](const std::unique_ptr &itTask) { return itTask->selectedRaceId == raceId; }); - it != taskHunting.end()) { + it != taskHunting.end()) { return *it; } diff --git a/src/creatures/players/vocations/vocation.cpp b/src/creatures/players/vocations/vocation.cpp index 98dbaeb1bea..6fec2725164 100644 --- a/src/creatures/players/vocations/vocation.cpp +++ b/src/creatures/players/vocations/vocation.cpp @@ -129,13 +129,13 @@ bool Vocations::loadFromXml() { voc->skillMultipliers[skill_id] = pugi::cast(childNode.attribute("multiplier").value()); } else { g_logger().warn("[Vocations::loadFromXml] - " - "No valid skill id: {} for vocation: {}", - skill_id, voc->id); + "No valid skill id: {} for vocation: {}", + skill_id, voc->id); } } else { g_logger().warn("[Vocations::loadFromXml] - " - "Missing skill id for vocation: {}", - voc->id); + "Missing skill id for vocation: {}", + voc->id); } } else if (strcasecmp(childNode.name(), "mitigation") == 0) { pugi::xml_attribute factorAttribute = childNode.attribute("multiplier"); @@ -198,8 +198,8 @@ std::shared_ptr Vocations::getVocation(uint16_t id) { auto it = vocationsMap.find(id); if (it == vocationsMap.end()) { g_logger().warn("[Vocations::getVocation] - " - "Vocation {} not found", - id); + "Vocation {} not found", + id); return nullptr; } return it->second; diff --git a/src/database/databasemanager.cpp b/src/database/databasemanager.cpp index cbcc116dd9a..dfbb7d9a64a 100644 --- a/src/database/databasemanager.cpp +++ b/src/database/databasemanager.cpp @@ -89,8 +89,8 @@ void DatabaseManager::updateDatabase() { ss << g_configManager().getString(DATA_DIRECTORY, __FUNCTION__) + "/migrations/" << version << ".lua"; if (luaL_dofile(L, ss.str().c_str()) != 0) { g_logger().error("DatabaseManager::updateDatabase - Version: {}" - "] {}", - version, lua_tostring(L, -1)); + "] {}", + version, lua_tostring(L, -1)); break; } diff --git a/src/game/game.cpp b/src/game/game.cpp index 984e675407c..bae7975a295 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -386,7 +386,7 @@ void Game::loadBoostedCreature() { const auto result = db.storeQuery("SELECT * FROM `boosted_creature`"); if (!result) { g_logger().warn("[Game::loadBoostedCreature] - " - "Failed to detect boosted creature database. (CODE 01)"); + "Failed to detect boosted creature database. (CODE 01)"); return; } @@ -423,15 +423,15 @@ void Game::loadBoostedCreature() { if (selectedMonster.raceId == 0) { g_logger().warn("[Game::loadBoostedCreature] - " - "It was not possible to generate a new boosted creature->"); + "It was not possible to generate a new boosted creature->"); return; } const auto monsterType = g_monsters().getMonsterType(selectedMonster.name); if (!monsterType) { g_logger().warn("[Game::loadBoostedCreature] - " - "It was not possible to generate a new boosted creature-> Monster '{}' not found.", - selectedMonster.name); + "It was not possible to generate a new boosted creature-> Monster '{}' not found.", + selectedMonster.name); return; } @@ -451,7 +451,7 @@ void Game::loadBoostedCreature() { if (!db.executeQuery(query)) { g_logger().warn("[Game::loadBoostedCreature] - " - "Failed to detect boosted creature database. (CODE 02)"); + "Failed to detect boosted creature database. (CODE 02)"); } } @@ -1703,7 +1703,7 @@ void Game::playerMoveItem(std::shared_ptr player, const Position &fromPo uint8_t itemStackPos = fromStackPos; if (fromPos.x != 0xFFFF && Position::areInRange<1, 1>(mapFromPos, playerPos) - && !Position::areInRange<1, 1, 0>(mapFromPos, walkPos)) { + && !Position::areInRange<1, 1, 0>(mapFromPos, walkPos)) { // need to pickup the item first std::shared_ptr moveItem = nullptr; @@ -2093,20 +2093,20 @@ ReturnValue Game::internalMoveItem(std::shared_ptr fromCylinder, std:: std::shared_ptr quiver = toCylinder->getItem(); if (quiver && quiver->isQuiver() - && quiver->getHoldingPlayer() - && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { + && quiver->getHoldingPlayer() + && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { quiver->getHoldingPlayer()->sendInventoryItem(CONST_SLOT_RIGHT, quiver); } else { quiver = fromCylinder->getItem(); if (quiver && quiver->isQuiver() - && quiver->getHoldingPlayer() - && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { + && quiver->getHoldingPlayer() + && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { quiver->getHoldingPlayer()->sendInventoryItem(CONST_SLOT_RIGHT, quiver); } } if (SoundEffect_t soundEffect = item->getMovementSound(toCylinder); - toCylinder && soundEffect != SoundEffect_t::SILENCE) { + toCylinder && soundEffect != SoundEffect_t::SILENCE) { if (toCylinder->getContainer() && actor && actor->getPlayer() && (toCylinder->getContainer()->isInsideDepot(true) || toCylinder->getContainer()->getHoldingPlayer())) { actor->getPlayer()->sendSingleSoundEffect(toCylinder->getPosition(), soundEffect, SourceEffect_t::OWN); } else { @@ -2239,8 +2239,8 @@ ReturnValue Game::internalAddItem(std::shared_ptr toCylinder, std::sha } if (addedItem && addedItem->isQuiver() - && addedItem->getHoldingPlayer() - && addedItem->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == addedItem) { + && addedItem->getHoldingPlayer() + && addedItem->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == addedItem) { addedItem->getHoldingPlayer()->sendInventoryItem(CONST_SLOT_RIGHT, addedItem); } @@ -2300,8 +2300,8 @@ ReturnValue Game::internalRemoveItem(std::shared_ptr item, int32_t count / std::shared_ptr quiver = cylinder->getItem(); if (quiver && quiver->isQuiver() - && quiver->getHoldingPlayer() - && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { + && quiver->getHoldingPlayer() + && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { quiver->getHoldingPlayer()->sendInventoryItem(CONST_SLOT_RIGHT, quiver); } @@ -2760,8 +2760,8 @@ std::shared_ptr Game::transformItem(std::shared_ptr item, uint16_t n std::shared_ptr quiver = cylinder->getItem(); if (quiver && quiver->isQuiver() - && quiver->getHoldingPlayer() - && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { + && quiver->getHoldingPlayer() + && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { quiver->getHoldingPlayer()->sendInventoryItem(CONST_SLOT_RIGHT, quiver); } item->startDecaying(); @@ -2772,8 +2772,8 @@ std::shared_ptr Game::transformItem(std::shared_ptr item, uint16_t n std::shared_ptr quiver = cylinder->getItem(); if (quiver && quiver->isQuiver() - && quiver->getHoldingPlayer() - && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { + && quiver->getHoldingPlayer() + && quiver->getHoldingPlayer()->getThing(CONST_SLOT_RIGHT) == quiver) { quiver->getHoldingPlayer()->sendInventoryItem(CONST_SLOT_RIGHT, quiver); } @@ -3699,7 +3699,7 @@ void Game::playerUseItemEx(uint32_t playerId, const Position &fromPos, uint8_t f mustReloadDepotSearch = true; } else { if (auto targetThing = internalGetThing(player, toPos, toStackPos, toItemId, STACKPOS_FIND_THING); - targetThing && targetThing->getItem() && targetThing->getItem()->isInsideDepot(true)) { + targetThing && targetThing->getItem() && targetThing->getItem()->isInsideDepot(true)) { mustReloadDepotSearch = true; } } @@ -4235,7 +4235,7 @@ void Game::playerSetShowOffSocket(uint32_t playerId, Outfit_t &outfit, const Pos item->setCustomAttribute("LookFeet", static_cast(outfit.lookFeet)); item->setCustomAttribute("LookAddons", static_cast(outfit.lookAddons)); } else if (auto pastLookType = item->getCustomAttribute("PastLookType"); - pastLookType && pastLookType->getInteger() > 0) { + pastLookType && pastLookType->getInteger() > 0) { item->removeCustomAttribute("LookType"); item->removeCustomAttribute("PastLookType"); } @@ -4247,7 +4247,7 @@ void Game::playerSetShowOffSocket(uint32_t playerId, Outfit_t &outfit, const Pos item->setCustomAttribute("LookMountLegs", static_cast(outfit.lookMountLegs)); item->setCustomAttribute("LookMountFeet", static_cast(outfit.lookMountFeet)); } else if (auto pastLookMount = item->getCustomAttribute("PastLookMount"); - pastLookMount && pastLookMount->getInteger() > 0) { + pastLookMount && pastLookMount->getInteger() > 0) { item->removeCustomAttribute("LookMount"); item->removeCustomAttribute("PastLookMount"); } @@ -5496,8 +5496,8 @@ void Game::playerLootAllCorpses(std::shared_ptr player, const Position & } if (!tileCorpse->isRewardCorpse() - && tileCorpse->getCorpseOwner() != 0 - && !player->canOpenCorpse(tileCorpse->getCorpseOwner())) { + && tileCorpse->getCorpseOwner() != 0 + && !player->canOpenCorpse(tileCorpse->getCorpseOwner())) { player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE); g_logger().debug("Player {} cannot loot corpse from id {} in position {}", player->getName(), tileItem->getID(), tileItem->getPosition().toString()); continue; @@ -7120,9 +7120,9 @@ bool Game::combatChangeHealth(std::shared_ptr attacker, std::shared_pt if (!damage.extension && attackerMonster && targetPlayer) { // Charm rune (target as player) if (charmRune_t activeCharm = g_iobestiary().getCharmFromTarget(targetPlayer, g_monsters().getMonsterTypeByRaceId(attackerMonster->getRaceId())); - activeCharm != CHARM_NONE && activeCharm != CHARM_CLEANSE) { + activeCharm != CHARM_NONE && activeCharm != CHARM_CLEANSE) { if (const auto charm = g_iobestiary().getBestiaryCharm(activeCharm); - charm->type == CHARM_DEFENSIVE && charm->chance > normal_random(0, 100) && g_iobestiary().parseCharmCombat(charm, targetPlayer, attacker, (damage.primary.value + damage.secondary.value))) { + charm->type == CHARM_DEFENSIVE && charm->chance > normal_random(0, 100) && g_iobestiary().parseCharmCombat(charm, targetPlayer, attacker, (damage.primary.value + damage.secondary.value))) { return false; // Dodge charm } } @@ -7508,7 +7508,7 @@ void Game::applyCharmRune( return; } if (charmRune_t activeCharm = g_iobestiary().getCharmFromTarget(attackerPlayer, g_monsters().getMonsterTypeByRaceId(targetMonster->getRaceId())); - activeCharm != CHARM_NONE) { + activeCharm != CHARM_NONE) { const auto charm = g_iobestiary().getBestiaryCharm(activeCharm); int8_t chance = charm->id == CHARM_CRIPPLE ? charm->chance : charm->chance + attackerPlayer->getCharmChanceModifier(); g_logger().debug("charm chance: {}, base: {}, bonus: {}", chance, charm->chance, attackerPlayer->getCharmChanceModifier()); @@ -7534,7 +7534,7 @@ void Game::applyManaLeech( // Void charm rune if (targetMonster) { if (uint16_t playerCharmRaceidVoid = attackerPlayer->parseRacebyCharm(CHARM_VOID, false, 0); - playerCharmRaceidVoid != 0 && playerCharmRaceidVoid == targetMonster->getRace()) { + playerCharmRaceidVoid != 0 && playerCharmRaceidVoid == targetMonster->getRace()) { if (const auto charm = g_iobestiary().getBestiaryCharm(CHARM_VOID)) { manaSkill += charm->percent; } @@ -7565,7 +7565,7 @@ void Game::applyLifeLeech( } if (targetMonster) { if (uint16_t playerCharmRaceidVamp = attackerPlayer->parseRacebyCharm(CHARM_VAMP, false, 0); - playerCharmRaceidVamp != 0 && playerCharmRaceidVamp == targetMonster->getRaceId()) { + playerCharmRaceidVamp != 0 && playerCharmRaceidVamp == targetMonster->getRaceId()) { if (const auto lifec = g_iobestiary().getBestiaryCharm(CHARM_VAMP)) { lifeSkill += lifec->percent; } @@ -9523,7 +9523,7 @@ void Game::playerBosstiarySlot(uint32_t playerId, uint8_t slotId, uint32_t selec uint32_t bossIdSlot = player->getSlotBossId(slotId); if (uint32_t boostedBossId = g_ioBosstiary().getBoostedBossId(); - selectedBossId == 0 && bossIdSlot != boostedBossId) { + selectedBossId == 0 && bossIdSlot != boostedBossId) { uint8_t removeTimes = player->getRemoveTimes(); uint32_t removePrice = g_ioBosstiary().calculteRemoveBoss(removeTimes); g_game().removeMoney(player, removePrice, 0, true); @@ -9559,7 +9559,7 @@ void Game::playerSetMonsterPodium(uint32_t playerId, uint32_t monsterRaceId, con if (!Position::areInRange<1, 1, 0>(pos, player->getPosition())) { if (stdext::arraylist listDir(128); - player->getPathTo(pos, listDir, 0, 1, true, false)) { + player->getPathTo(pos, listDir, 0, 1, true, false)) { g_dispatcher().addEvent([this, playerId = player->getID(), listDir = listDir.data()] { playerAutoWalk(playerId, listDir); }, "Game::playerAutoWalk"); std::shared_ptr task = createPlayerTask( 400, [this, playerId, pos] { playerBrowseField(playerId, pos); }, "Game::playerBrowseField" @@ -9597,7 +9597,7 @@ void Game::playerSetMonsterPodium(uint32_t playerId, uint32_t monsterRaceId, con const auto [podiumVisible, monsterVisible] = podiumAndMonsterVisible; bool changeTentuglyName = false; if (auto monsterOutfit = mType->info.outfit; - (monsterOutfit.lookType != 0 || monsterOutfit.lookTypeEx != 0) && monsterVisible) { + (monsterOutfit.lookType != 0 || monsterOutfit.lookTypeEx != 0) && monsterVisible) { // "Tantugly's Head" boss have to send other looktype to the podium if (monsterOutfit.lookTypeEx == 35105) { monsterOutfit.lookTypeEx = 39003; @@ -9659,7 +9659,7 @@ void Game::playerRotatePodium(uint32_t playerId, const Position &pos, uint8_t st if (pos.x != 0xFFFF && !Position::areInRange<1, 1, 0>(pos, player->getPosition())) { if (stdext::arraylist listDir(128); - player->getPathTo(pos, listDir, 0, 1, true, true)) { + player->getPathTo(pos, listDir, 0, 1, true, true)) { g_dispatcher().addEvent([this, playerId = player->getID(), listDir = listDir.data()] { playerAutoWalk(playerId, listDir); }, "Game::playerAutoWalk"); std::shared_ptr task = createPlayerTask( 400, [this, playerId, pos, stackPos, itemId] { @@ -10031,8 +10031,8 @@ void Game::sendUpdateCreature(std::shared_ptr creature) { uint32_t Game::makeInfluencedMonster() { if (auto influencedLimit = g_configManager().getNumber(FORGE_INFLUENCED_CREATURES_LIMIT, __FUNCTION__); - // Condition - forgeableMonsters.empty() || influencedMonsters.size() >= influencedLimit) { + // Condition + forgeableMonsters.empty() || influencedMonsters.size() >= influencedLimit) { return 0; } @@ -10112,8 +10112,8 @@ uint32_t Game::makeFiendishMonster(uint32_t forgeableMonsterId /* = 0*/, bool cr } if (auto fiendishLimit = g_configManager().getNumber(FORGE_FIENDISH_CREATURES_LIMIT, __FUNCTION__); - // Condition - forgeableMonsters.empty() || fiendishMonsters.size() >= fiendishLimit) { + // Condition + forgeableMonsters.empty() || fiendishMonsters.size() >= fiendishLimit) { return 0; } @@ -10217,8 +10217,8 @@ bool Game::removeForgeMonster(uint32_t id, ForgeClassifications_t monsterForgeCl bool Game::removeInfluencedMonster(uint32_t id, bool create /* = false*/) { if (auto find = influencedMonsters.find(id); - // Condition - find != influencedMonsters.end()) { + // Condition + find != influencedMonsters.end()) { influencedMonsters.erase(find); if (create) { @@ -10234,8 +10234,8 @@ bool Game::removeInfluencedMonster(uint32_t id, bool create /* = false*/) { bool Game::removeFiendishMonster(uint32_t id, bool create /* = true*/) { if (auto find = fiendishMonsters.find(id); - // Condition - find != fiendishMonsters.end()) { + // Condition + find != fiendishMonsters.end()) { fiendishMonsters.erase(find); checkForgeEventId(id); @@ -10286,8 +10286,8 @@ void Game::createFiendishMonsters() { } if (auto ret = makeFiendishMonster(); - // Condition - ret == 0) { + // Condition + ret == 0) { return; } @@ -10305,8 +10305,8 @@ void Game::createInfluencedMonsters() { } if (auto ret = makeInfluencedMonster(); - // If condition - ret == 0) { + // If condition + ret == 0) { return; } @@ -10325,8 +10325,8 @@ void Game::checkForgeEventId(uint32_t monsterId) { bool Game::addInfluencedMonster(std::shared_ptr monster) { if (monster && monster->canBeForgeMonster()) { if (auto maxInfluencedMonsters = static_cast(g_configManager().getNumber(FORGE_INFLUENCED_CREATURES_LIMIT, __FUNCTION__)); - // If condition - (influencedMonsters.size() + 1) > maxInfluencedMonsters) { + // If condition + (influencedMonsters.size() + 1) > maxInfluencedMonsters) { return false; } diff --git a/src/game/movement/teleport.cpp b/src/game/movement/teleport.cpp index d5a3a73daf1..44050100eb6 100644 --- a/src/game/movement/teleport.cpp +++ b/src/game/movement/teleport.cpp @@ -80,8 +80,8 @@ void Teleport::addThing(int32_t, std::shared_ptr thing) { if (checkInfinityLoop(destTile)) { const Position &pos = getPosition(); g_logger().warn("[Teleport:addThing] - " - "Infinity loop teleport at position: {}", - pos.toString()); + "Infinity loop teleport at position: {}", + pos.toString()); return; } diff --git a/src/io/io_bosstiary.cpp b/src/io/io_bosstiary.cpp index 0090c0b3ebb..2f625cdb7cc 100644 --- a/src/io/io_bosstiary.cpp +++ b/src/io/io_bosstiary.cpp @@ -89,7 +89,7 @@ void IOBosstiary::loadBoostedBoss() { query << "`date` = '" << today << "',"; query << "`boostname` = " << database.escapeString(bossName) << ","; if (const auto bossType = getMonsterTypeByBossRaceId(bossId); - bossType) { + bossType) { query << "`looktypeEx` = " << static_cast(bossType->info.outfit.lookTypeEx) << ","; query << "`looktype` = " << static_cast(bossType->info.outfit.lookType) << ","; query << "`lookfeet` = " << static_cast(bossType->info.outfit.lookFeet) << ","; @@ -124,7 +124,7 @@ void IOBosstiary::loadBoostedBoss() { void IOBosstiary::addBosstiaryMonster(uint16_t raceId, const std::string &name) { if (auto it = bosstiaryMap.find(raceId); - it != bosstiaryMap.end()) { + it != bosstiaryMap.end()) { return; } @@ -282,7 +282,7 @@ uint8_t IOBosstiary::getBossCurrentLevel(std::shared_ptr player, uint16_ auto bossRace = mType->info.bosstiaryRace; uint8_t level = 0; if (auto it = levelInfos.find(bossRace); - it != levelInfos.end()) { + it != levelInfos.end()) { const std::vector &infoForCurrentRace = it->second; for (const auto &raceInfo : infoForCurrentRace) { if (currentKills >= raceInfo.kills) { diff --git a/src/io/iobestiary.cpp b/src/io/iobestiary.cpp index c544021367e..9cd964e7c7c 100644 --- a/src/io/iobestiary.cpp +++ b/src/io/iobestiary.cpp @@ -225,9 +225,9 @@ void IOBestiary::addBestiaryKill(std::shared_ptr player, const std::shar player->addBestiaryKillCount(raceid, amount); if ((curCount == 0) || // Initial kill stage - (curCount < mtype->info.bestiaryFirstUnlock && (curCount + amount) >= mtype->info.bestiaryFirstUnlock) || // First kill stage reached - (curCount < mtype->info.bestiarySecondUnlock && (curCount + amount) >= mtype->info.bestiarySecondUnlock) || // Second kill stage reached - (curCount < mtype->info.bestiaryToUnlock && (curCount + amount) >= mtype->info.bestiaryToUnlock)) { // Final kill stage reached + (curCount < mtype->info.bestiaryFirstUnlock && (curCount + amount) >= mtype->info.bestiaryFirstUnlock) || // First kill stage reached + (curCount < mtype->info.bestiarySecondUnlock && (curCount + amount) >= mtype->info.bestiarySecondUnlock) || // Second kill stage reached + (curCount < mtype->info.bestiaryToUnlock && (curCount + amount) >= mtype->info.bestiaryToUnlock)) { // Final kill stage reached ss << "You unlocked details for the creature '" << mtype->name << "'"; player->sendTextMessage(MESSAGE_STATUS, ss.str()); player->sendBestiaryEntryChanged(raceid); diff --git a/src/io/iomap.cpp b/src/io/iomap.cpp index d50d9b2804f..c17978e8d1d 100644 --- a/src/io/iomap.cpp +++ b/src/io/iomap.cpp @@ -14,27 +14,27 @@ #include "io/filestream.hpp" /* - OTBM_ROOTV1 - | - |--- OTBM_MAP_DATA - | | - | |--- OTBM_TILE_AREA - | | |--- OTBM_TILE - | | |--- OTBM_TILE_SQUARE (not implemented) - | | |--- OTBM_TILE_REF (not implemented) - | | |--- OTBM_HOUSETILE - | | - | |--- OTBM_SPAWNS (not implemented) - | | |--- OTBM_SPAWN_AREA (not implemented) - | | |--- OTBM_MONSTER (not implemented) - | | - | |--- OTBM_TOWNS - | | |--- OTBM_TOWN - | | - | |--- OTBM_WAYPOINTS - | |--- OTBM_WAYPOINT - | - |--- OTBM_ITEM_DEF (not implemented) + OTBM_ROOTV1 + | + |--- OTBM_MAP_DATA + | | + | |--- OTBM_TILE_AREA + | | |--- OTBM_TILE + | | |--- OTBM_TILE_SQUARE (not implemented) + | | |--- OTBM_TILE_REF (not implemented) + | | |--- OTBM_HOUSETILE + | | + | |--- OTBM_SPAWNS (not implemented) + | | |--- OTBM_SPAWN_AREA (not implemented) + | | |--- OTBM_MONSTER (not implemented) + | | + | |--- OTBM_TOWNS + | | |--- OTBM_TOWN + | | + | |--- OTBM_WAYPOINTS + | |--- OTBM_WAYPOINT + | + |--- OTBM_ITEM_DEF (not implemented) */ void IOMap::loadMap(Map* map, const Position &pos) { @@ -170,9 +170,9 @@ void IOMap::parseTileArea(FileStream &stream, Map &map, const Position &pos) { if (tile->isHouse() && iType.movable) { g_logger().warn("[IOMap::loadMap] - " - "Movable item with ID: {}, in house: {}, " - "at position: x {}, y {}, z {}", - id, tile->houseId, x, y, z); + "Movable item with ID: {}, in house: {}, " + "at position: x {}, y {}, z {}", + id, tile->houseId, x, y, z); } else if (iType.isGroundTile()) { tile->ground = map.tryReplaceItemFromCache(item); } else { @@ -200,9 +200,9 @@ void IOMap::parseTileArea(FileStream &stream, Map &map, const Position &pos) { // nothing } else if (tile->isHouse() && iType.movable) { g_logger().warn("[IOMap::loadMap] - " - "Movable item with ID: {}, in house: {}, " - "at position: x {}, y {}, z {}", - id, tile->houseId, x, y, z); + "Movable item with ID: {}, in house: {}, " + "at position: x {}, y {}, z {}", + id, tile->houseId, x, y, z); } else if (iType.isGroundTile()) { tile->ground = map.tryReplaceItemFromCache(item); } else { diff --git a/src/io/ioprey.cpp b/src/io/ioprey.cpp index 642423c2abd..6b2816355ff 100644 --- a/src/io/ioprey.cpp +++ b/src/io/ioprey.cpp @@ -73,7 +73,7 @@ void PreySlot::reloadMonsterGrid(std::vector blackList, uint32_t level uint8_t stageThree; uint8_t stageFour; if (auto levelStage = static_cast(std::floor(level / 100)); - levelStage == 0) { // From level 0 to 99 + levelStage == 0) { // From level 0 to 99 stageOne = 3; stageTwo = 3; stageThree = 2; @@ -154,7 +154,7 @@ void TaskHuntingSlot::reloadMonsterGrid(std::vector blackList, uint32_ uint8_t stageThree; uint8_t stageFour; if (auto levelStage = static_cast(std::floor(level / 100)); - levelStage == 0) { // From level 0 to 99 + levelStage == 0) { // From level 0 to 99 stageOne = 3; stageTwo = 3; stageThree = 2; @@ -253,7 +253,7 @@ void IOPrey::checkPlayerPreys(std::shared_ptr player, uint8_t amount) co for (uint8_t slotId = PreySlot_First; slotId <= PreySlot_Last; slotId++) { if (const auto &slot = player->getPreySlotById(static_cast(slotId)); - slot && slot->isOccupied()) { + slot && slot->isOccupied()) { if (slot->bonusTimeLeft <= amount) { if (slot->option == PreyOption_AutomaticReroll) { if (player->usePreyCards(static_cast(g_configManager().getNumber(PREY_BONUS_REROLL_PRICE, __FUNCTION__)))) { diff --git a/src/items/decay/decay.cpp b/src/items/decay/decay.cpp index 848acffbf68..5eaff61a7a9 100644 --- a/src/items/decay/decay.cpp +++ b/src/items/decay/decay.cpp @@ -156,8 +156,8 @@ void Decay::internalDecayItem(std::shared_ptr item) { auto player = item->getHoldingPlayer(); if (player) { g_logger().error("[{}] - internalDecayItem failed to player {}, item id is same from transform equip/deequip, " - " item id: {}, equip to id: '{}', deequip to id '{}'", - __FUNCTION__, player->getName(), it.id, it.transformEquipTo, it.transformDeEquipTo); + " item id: {}, equip to id: '{}', deequip to id '{}'", + __FUNCTION__, player->getName(), it.id, it.transformEquipTo, it.transformDeEquipTo); } return; } @@ -207,8 +207,8 @@ void Decay::internalDecayItem(std::shared_ptr item) { ReturnValue ret = g_game().internalRemoveItem(item); if (ret != RETURNVALUE_NOERROR) { g_logger().error("[Decay::internalDecayItem] - internalDecayItem failed, " - "error code: {}, item id: {}", - static_cast(ret), item->getID()); + "error code: {}, item id: {}", + static_cast(ret), item->getID()); } } } diff --git a/src/items/functions/item/item_parse.cpp b/src/items/functions/item/item_parse.cpp index 1f247b611bc..9b63b9aee0e 100644 --- a/src/items/functions/item/item_parse.cpp +++ b/src/items/functions/item/item_parse.cpp @@ -400,7 +400,7 @@ void ItemParse::parseTransform(const std::string &tmpStrValue, pugi::xml_attribu itemType.decayTo = 0; } if (ItemType &transform = Item::items.getItemType(itemType.transformEquipTo); - transform.type == ITEM_TYPE_NONE) { + transform.type == ITEM_TYPE_NONE) { transform.type = itemType.type; } } else if (stringValue == "transformdeequipto") { @@ -1140,7 +1140,7 @@ void ItemParse::createAndRegisterScript(ItemType &itemType, pugi::xml_node attri token.erase(std::find_if(token.rbegin(), token.rend(), [](unsigned char ch) { return !std::isspace(ch); }).base(), - token.end()); + token.end()); std::string v1; bool showInDescription = false; diff --git a/src/items/item.cpp b/src/items/item.cpp index 823eb13b393..dd2d5c965a6 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -132,7 +132,7 @@ bool Item::hasImbuementCategoryId(uint16_t categoryId) const { ImbuementInfo imbuementInfo; if (getImbuementInfo(slotid, &imbuementInfo)) { if (const CategoryImbuement* categoryImbuement = g_imbuements().getCategoryByID(imbuementInfo.imbuement->getCategory()); - categoryImbuement->id == categoryId) { + categoryImbuement->id == categoryId) { return true; } } @@ -142,14 +142,14 @@ bool Item::hasImbuementCategoryId(uint16_t categoryId) const { std::shared_ptr Item::CreateItemAsContainer(const uint16_t type, uint16_t size) { if (const ItemType &it = Item::items[type]; - it.id == 0 - || it.stackable - || it.multiUse - || it.movable - || it.pickupable - || it.isDepot() - || it.isSplash() - || it.isDoor()) { + it.id == 0 + || it.stackable + || it.multiUse + || it.movable + || it.pickupable + || it.isDepot() + || it.isSplash() + || it.isDoor()) { return nullptr; } @@ -883,7 +883,7 @@ void Item::serializeAttr(PropWriteStream &propWriteStream) const { } if (const std::string &text = getString(ItemAttribute_t::TEXT); - !text.empty()) { + !text.empty()) { propWriteStream.write(ATTR_TEXT); propWriteStream.writeString(text); } @@ -911,7 +911,7 @@ void Item::serializeAttr(PropWriteStream &propWriteStream) const { } if (auto decayState = getDecaying(); - decayState == DECAYING_TRUE || decayState == DECAYING_PENDING) { + decayState == DECAYING_TRUE || decayState == DECAYING_PENDING) { propWriteStream.write(ATTR_DECAYING_STATE); propWriteStream.write(decayState); } @@ -1166,7 +1166,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr separator = true; } if (int32_t hitChance = item->getHitChance(); - hitChance != 0) { + hitChance != 0) { if (separator) { ss << ", "; } @@ -1174,7 +1174,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr separator = true; } if (int32_t shootRange = item->getShootRange(); - shootRange != 0) { + shootRange != 0) { if (separator) { ss << ", "; } @@ -1579,7 +1579,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr separator = true; } if (int32_t hitChance = it.hitChance; - hitChance != 0) { + hitChance != 0) { if (separator) { ss << ", "; } @@ -1587,7 +1587,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr separator = true; } if (int32_t shootRange = it.shootRange; - shootRange != 0) { + shootRange != 0) { if (separator) { ss << ", "; } @@ -1950,7 +1950,7 @@ SoundEffect_t Item::getMovementSound(std::shared_ptr toCylinder) const } if (std::shared_ptr toContainer = toCylinder->getContainer(); - toContainer && toContainer->getHoldingPlayer()) { + toContainer && toContainer->getHoldingPlayer()) { return SoundEffect_t::ITEM_MOVE_BACKPACK; } diff --git a/src/items/items.cpp b/src/items/items.cpp index 7d8ff0cf7c0..2d4020c5416 100644 --- a/src/items/items.cpp +++ b/src/items/items.cpp @@ -260,8 +260,8 @@ bool Items::loadFromXml() { auto toIdAttribute = itemNode.attribute("toid"); if (!toIdAttribute) { g_logger().warn("[Items::loadFromXml] - " - "tag fromid: {} without toid", - fromIdAttribute.value()); + "tag fromid: {} without toid", + fromIdAttribute.value()); continue; } @@ -302,12 +302,12 @@ void Items::parseItemNode(const pugi::xml_node &itemNode, uint16_t id) { } if (std::string xmlName = itemNode.attribute("name").as_string(); - !xmlName.empty() && itemType.name != xmlName) { + !xmlName.empty() && itemType.name != xmlName) { if (!itemType.name.empty()) { if (auto it = std::find_if(nameToItems.begin(), nameToItems.end(), [id](const auto nameMapIt) { return nameMapIt.second == id; }); - it != nameToItems.end()) { + it != nameToItems.end()) { nameToItems.erase(it); } } diff --git a/src/items/tile.cpp b/src/items/tile.cpp index f2006f627e1..fc16dd5799c 100644 --- a/src/items/tile.cpp +++ b/src/items/tile.cpp @@ -393,7 +393,7 @@ void Tile::onAddTileItem(std::shared_ptr item) { } if ((!hasFlag(TILESTATE_PROTECTIONZONE) || g_configManager().getBoolean(CLEAN_PROTECTION_ZONES, __FUNCTION__)) - && item->isCleanable()) { + && item->isCleanable()) { if (!this->getHouse()) { g_game().addTileToClean(static_self_cast()); } diff --git a/src/items/weapons/weapons.cpp b/src/items/weapons/weapons.cpp index 6c0d56d882e..69d20d43e06 100644 --- a/src/items/weapons/weapons.cpp +++ b/src/items/weapons/weapons.cpp @@ -360,8 +360,8 @@ bool Weapon::executeUseWeapon(std::shared_ptr player, const LuaVariant & if (!getScriptInterface()->reserveScriptEnv()) { std::string playerName = player ? player->getName() : "Player nullptr"; g_logger().error("[Weapon::executeUseWeapon - Player {} weaponId {}]" - "Call stack overflow. Too many lua script calls being nested.", - playerName, getID()); + "Call stack overflow. Too many lua script calls being nested.", + playerName, getID()); return false; } diff --git a/src/lua/callbacks/event_callback.cpp b/src/lua/callbacks/event_callback.cpp index d2b88c30f3a..38e7654d8d5 100644 --- a/src/lua/callbacks/event_callback.cpp +++ b/src/lua/callbacks/event_callback.cpp @@ -50,8 +50,8 @@ void EventCallback::setType(EventCallback_t type) { bool EventCallback::creatureOnChangeOutfit(std::shared_ptr creature, const Outfit_t &outfit) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::creatureOnChangeOutfit - Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName()); return false; } @@ -72,9 +72,9 @@ bool EventCallback::creatureOnChangeOutfit(std::shared_ptr creature, c ReturnValue EventCallback::creatureOnAreaCombat(std::shared_ptr creature, std::shared_ptr tile, bool aggressive) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::creatureOnAreaCombat - " - "Creature {} on tile position {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), tile->getPosition().toString()); + "Creature {} on tile position {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), tile->getPosition().toString()); return RETURNVALUE_NOTPOSSIBLE; } @@ -112,9 +112,9 @@ ReturnValue EventCallback::creatureOnAreaCombat(std::shared_ptr creatu ReturnValue EventCallback::creatureOnTargetCombat(std::shared_ptr creature, std::shared_ptr target) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::creatureOnTargetCombat - " - "Creature {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), target->getName()); + "Creature {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), target->getName()); return RETURNVALUE_NOTPOSSIBLE; } @@ -150,9 +150,9 @@ ReturnValue EventCallback::creatureOnTargetCombat(std::shared_ptr crea void EventCallback::creatureOnHear(std::shared_ptr creature, std::shared_ptr speaker, const std::string &words, SpeakClasses type) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::creatureOnHear - " - "Creature {} speaker {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), speaker->getName()); + "Creature {} speaker {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), speaker->getName()); return; } @@ -177,9 +177,9 @@ void EventCallback::creatureOnHear(std::shared_ptr creature, std::shar void EventCallback::creatureOnDrainHealth(std::shared_ptr creature, std::shared_ptr attacker, CombatType_t &typePrimary, int32_t &damagePrimary, CombatType_t &typeSecondary, int32_t &damageSecondary, TextColor_t &colorPrimary, TextColor_t &colorSecondary) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::creatureOnDrainHealth - " - "Creature {} attacker {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), attacker->getName()); + "Creature {} attacker {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), attacker->getName()); return; } @@ -229,9 +229,9 @@ void EventCallback::creatureOnDrainHealth(std::shared_ptr creature, st bool EventCallback::partyOnJoin(std::shared_ptr party, std::shared_ptr player) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::partyOnJoin - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -253,9 +253,9 @@ bool EventCallback::partyOnJoin(std::shared_ptr party, std::shared_ptr party, std::shared_ptr player) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::partyOnLeave - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -277,8 +277,8 @@ bool EventCallback::partyOnLeave(std::shared_ptr party, std::shared_ptr

party) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::partyOnDisband - Party leader {}] Call stack " - "overflow. Too many lua script calls being nested.", - party->getLeader() ? party->getLeader()->getName() : "unknown"); + "overflow. Too many lua script calls being nested.", + party->getLeader() ? party->getLeader()->getName() : "unknown"); return false; } @@ -325,9 +325,9 @@ void EventCallback::partyOnShareExperience(std::shared_ptr party, uint64_ bool EventCallback::playerOnBrowseField(std::shared_ptr player, const Position &position) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnBrowseField - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -348,9 +348,9 @@ bool EventCallback::playerOnBrowseField(std::shared_ptr player, const Po void EventCallback::playerOnLook(std::shared_ptr player, const Position &position, std::shared_ptr thing, uint8_t stackpos, int32_t lookDistance) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnLook - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -382,9 +382,9 @@ void EventCallback::playerOnLook(std::shared_ptr player, const Position void EventCallback::playerOnLookInBattleList(std::shared_ptr player, std::shared_ptr creature, int32_t lookDistance) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnLookInBattleList - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -408,9 +408,9 @@ void EventCallback::playerOnLookInBattleList(std::shared_ptr player, std void EventCallback::playerOnLookInTrade(std::shared_ptr player, std::shared_ptr partner, std::shared_ptr item, int32_t lookDistance) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnLookInTrade - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -437,9 +437,9 @@ void EventCallback::playerOnLookInTrade(std::shared_ptr player, std::sha bool EventCallback::playerOnLookInShop(std::shared_ptr player, const ItemType* itemType, uint8_t count) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnLookInShop - " - "Player {} itemType {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), itemType->getPluralName()); + "Player {} itemType {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), itemType->getPluralName()); return false; } @@ -463,9 +463,9 @@ bool EventCallback::playerOnLookInShop(std::shared_ptr player, const Ite void EventCallback::playerOnRemoveCount(std::shared_ptr player, std::shared_ptr item) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnMove - " - "Player {} item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Player {} item {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return; } @@ -492,8 +492,8 @@ bool EventCallback::playerOnMoveItem(std::shared_ptr player, std::shared if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[Action::executeUse - Player {}, on item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return false; } @@ -522,9 +522,9 @@ bool EventCallback::playerOnMoveItem(std::shared_ptr player, std::shared void EventCallback::playerOnItemMoved(std::shared_ptr player, std::shared_ptr item, uint16_t count, const Position &fromPosition, const Position &toPosition, std::shared_ptr fromCylinder, std::shared_ptr toCylinder) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnItemMoved - " - "Player {} item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Player {} item {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return; } @@ -553,9 +553,9 @@ void EventCallback::playerOnItemMoved(std::shared_ptr player, std::share void EventCallback::playerOnChangeZone(std::shared_ptr player, ZoneType_t zone) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnChangeZone - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -575,9 +575,9 @@ void EventCallback::playerOnChangeZone(std::shared_ptr player, ZoneType_ bool EventCallback::playerOnMoveCreature(std::shared_ptr player, std::shared_ptr creature, const Position &fromPosition, const Position &toPosition) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnMoveCreature - " - "Player {} creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), creature->getName()); + "Player {} creature {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), creature->getName()); return false; } @@ -602,9 +602,9 @@ bool EventCallback::playerOnMoveCreature(std::shared_ptr player, std::sh void EventCallback::playerOnReportRuleViolation(std::shared_ptr player, const std::string &targetName, uint8_t reportType, uint8_t reportReason, const std::string &comment, const std::string &translation) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnReportRuleViolation - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -631,9 +631,9 @@ void EventCallback::playerOnReportRuleViolation(std::shared_ptr player, void EventCallback::playerOnReportBug(std::shared_ptr player, const std::string &message, const Position &position, uint8_t category) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnReportBug - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -656,9 +656,9 @@ void EventCallback::playerOnReportBug(std::shared_ptr player, const std: bool EventCallback::playerOnTurn(std::shared_ptr player, Direction direction) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnTurn - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -679,9 +679,9 @@ bool EventCallback::playerOnTurn(std::shared_ptr player, Direction direc bool EventCallback::playerOnTradeRequest(std::shared_ptr player, std::shared_ptr target, std::shared_ptr item) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnTradeRequest - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return false; } @@ -706,9 +706,9 @@ bool EventCallback::playerOnTradeRequest(std::shared_ptr player, std::sh bool EventCallback::playerOnTradeAccept(std::shared_ptr player, std::shared_ptr target, std::shared_ptr item, std::shared_ptr targetItem) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnTradeAccept - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return false; } @@ -736,9 +736,9 @@ bool EventCallback::playerOnTradeAccept(std::shared_ptr player, std::sha void EventCallback::playerOnGainExperience(std::shared_ptr player, std::shared_ptr target, uint64_t &exp, uint64_t rawExp) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnGainExperience - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return; } @@ -774,9 +774,9 @@ void EventCallback::playerOnGainExperience(std::shared_ptr player, std:: void EventCallback::playerOnLoseExperience(std::shared_ptr player, uint64_t &exp) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnLoseExperience - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -804,9 +804,9 @@ void EventCallback::playerOnLoseExperience(std::shared_ptr player, uint6 void EventCallback::playerOnGainSkillTries(std::shared_ptr player, skills_t skill, uint64_t &tries) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnGainSkillTries - " - "Player {} skill {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), fmt::underlying(skill)); + "Player {} skill {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), fmt::underlying(skill)); return; } @@ -835,9 +835,9 @@ void EventCallback::playerOnGainSkillTries(std::shared_ptr player, skill void EventCallback::playerOnCombat(std::shared_ptr player, std::shared_ptr target, std::shared_ptr item, CombatDamage &damage) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnCombat - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return; } @@ -880,7 +880,7 @@ void EventCallback::playerOnCombat(std::shared_ptr player, std::shared_p damage.secondary.value = -damage.secondary.value; } /* - Only EK with dealing physical damage will get elemental damage on skill + Only EK with dealing physical damage will get elemental damage on skill */ if (damage.origin == ORIGIN_SPELL) { if (player->getVocationId() != 4 && player->getVocationId() != 8) { @@ -897,9 +897,9 @@ void EventCallback::playerOnCombat(std::shared_ptr player, std::shared_p void EventCallback::playerOnRequestQuestLog(std::shared_ptr player) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnRequestQuestLog - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -918,9 +918,9 @@ void EventCallback::playerOnRequestQuestLog(std::shared_ptr player) cons void EventCallback::playerOnRequestQuestLine(std::shared_ptr player, uint16_t questId) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::playerOnRequestQuestLine - " - "Player {} questId {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), questId); + "Player {} questId {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), questId); return; } @@ -988,9 +988,9 @@ bool EventCallback::playerOnRotateItem(std::shared_ptr player, std::shar void EventCallback::playerOnWalk(std::shared_ptr player, Direction &dir) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::eventOnWalk - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -1011,9 +1011,9 @@ void EventCallback::playerOnWalk(std::shared_ptr player, Direction &dir) void EventCallback::playerOnStorageUpdate(std::shared_ptr player, const uint32_t key, const int32_t value, int32_t oldValue, uint64_t currentTime) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::eventOnStorageUpdate - " - "Player {} key {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), key); + "Player {} key {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), key); return; } @@ -1038,9 +1038,9 @@ void EventCallback::playerOnStorageUpdate(std::shared_ptr player, const void EventCallback::monsterOnDropLoot(std::shared_ptr monster, std::shared_ptr corpse) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::monsterOnDropLoot - " - "Monster corpse {}] " - "Call stack overflow. Too many lua script calls being nested.", - corpse->getName()); + "Monster corpse {}] " + "Call stack overflow. Too many lua script calls being nested.", + corpse->getName()); return; } @@ -1062,9 +1062,9 @@ void EventCallback::monsterOnDropLoot(std::shared_ptr monster, std::sha void EventCallback::monsterPostDropLoot(std::shared_ptr monster, std::shared_ptr corpse) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::monsterPostDropLoot - " - "Monster corpse {}] " - "Call stack overflow. Too many lua script calls being nested.", - corpse->getName()); + "Monster corpse {}] " + "Call stack overflow. Too many lua script calls being nested.", + corpse->getName()); return; } @@ -1086,9 +1086,9 @@ void EventCallback::monsterPostDropLoot(std::shared_ptr monster, std::s void EventCallback::monsterOnSpawn(std::shared_ptr monster, const Position &position) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("{} - " - "Position {}" - ". Call stack overflow. Too many lua script calls being nested.", - __FUNCTION__, position.toString()); + "Position {}" + ". Call stack overflow. Too many lua script calls being nested.", + __FUNCTION__, position.toString()); return; } @@ -1115,9 +1115,9 @@ void EventCallback::monsterOnSpawn(std::shared_ptr monster, const Posit void EventCallback::npcOnSpawn(std::shared_ptr npc, const Position &position) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("{} - " - "Position {}" - ". Call stack overflow. Too many lua script calls being nested.", - __FUNCTION__, position.toString()); + "Position {}" + ". Call stack overflow. Too many lua script calls being nested.", + __FUNCTION__, position.toString()); return; } @@ -1143,9 +1143,9 @@ void EventCallback::npcOnSpawn(std::shared_ptr npc, const Position &positio bool EventCallback::zoneBeforeCreatureEnter(std::shared_ptr zone, std::shared_ptr creature) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::zoneBeforeCreatureEnter - " - "Zone {} Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - zone->getName(), creature->getName()); + "Zone {} Creature {}] " + "Call stack overflow. Too many lua script calls being nested.", + zone->getName(), creature->getName()); return false; } @@ -1167,9 +1167,9 @@ bool EventCallback::zoneBeforeCreatureEnter(std::shared_ptr zone, std::sha bool EventCallback::zoneBeforeCreatureLeave(std::shared_ptr zone, std::shared_ptr creature) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::zoneBeforeCreatureLeave - " - "Zone {} Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - zone->getName(), creature->getName()); + "Zone {} Creature {}] " + "Call stack overflow. Too many lua script calls being nested.", + zone->getName(), creature->getName()); return false; } @@ -1191,9 +1191,9 @@ bool EventCallback::zoneBeforeCreatureLeave(std::shared_ptr zone, std::sha void EventCallback::zoneAfterCreatureEnter(std::shared_ptr zone, std::shared_ptr creature) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::zoneAfterCreatureEnter - " - "Zone {} Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - zone->getName(), creature->getName()); + "Zone {} Creature {}] " + "Call stack overflow. Too many lua script calls being nested.", + zone->getName(), creature->getName()); return; } @@ -1215,9 +1215,9 @@ void EventCallback::zoneAfterCreatureEnter(std::shared_ptr zone, std::shar void EventCallback::zoneAfterCreatureLeave(std::shared_ptr zone, std::shared_ptr creature) const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[EventCallback::zoneAfterCreatureLeave - " - "Zone {} Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - zone->getName(), creature->getName()); + "Zone {} Creature {}] " + "Call stack overflow. Too many lua script calls being nested.", + zone->getName(), creature->getName()); return; } diff --git a/src/lua/creature/actions.cpp b/src/lua/creature/actions.cpp index 42f3e12c865..485509cae06 100644 --- a/src/lua/creature/actions.cpp +++ b/src/lua/creature/actions.cpp @@ -231,11 +231,11 @@ std::shared_ptr Actions::getAction(std::shared_ptr item) { } if (auto iteratePositions = actionPositionMap.find(item->getPosition()); - iteratePositions != actionPositionMap.end()) { + iteratePositions != actionPositionMap.end()) { if (std::shared_ptr tile = item->getTile(); - tile) { + tile) { if (std::shared_ptr player = item->getHoldingPlayer(); - player && item->getTopParent() == player) { + player && item->getTopParent() == player) { g_logger().debug("[Actions::getAction] - The position only is valid for use item in the map, player name {}", player->getName()); return nullptr; } @@ -515,8 +515,8 @@ bool Action::executeUse(std::shared_ptr player, std::shared_ptr it // onUse(player, item, fromPosition, target, toPosition, isHotkey) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[Action::executeUse - Player {}, on item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return false; } diff --git a/src/lua/creature/actions.hpp b/src/lua/creature/actions.hpp index 80fd2ea54e9..81a7754a5b1 100644 --- a/src/lua/creature/actions.hpp +++ b/src/lua/creature/actions.hpp @@ -161,7 +161,7 @@ class Actions final : public Scripts { private: bool hasPosition(Position position) const { if (auto it = actionPositionMap.find(position); - it != actionPositionMap.end()) { + it != actionPositionMap.end()) { return true; } return false; @@ -177,7 +177,7 @@ class Actions final : public Scripts { bool hasItemId(uint16_t itemId) const { if (auto it = useItemMap.find(itemId); - it != useItemMap.end()) { + it != useItemMap.end()) { return true; } return false; @@ -189,7 +189,7 @@ class Actions final : public Scripts { bool hasUniqueId(uint16_t uniqueId) const { if (auto it = uniqueItemMap.find(uniqueId); - it != uniqueItemMap.end()) { + it != uniqueItemMap.end()) { return true; } return false; @@ -201,7 +201,7 @@ class Actions final : public Scripts { bool hasActionId(uint16_t actionId) const { if (auto it = actionItemMap.find(actionId); - it != actionItemMap.end()) { + it != actionItemMap.end()) { return true; } return false; diff --git a/src/lua/creature/creatureevent.cpp b/src/lua/creature/creatureevent.cpp index fe2a782b914..09dbdf086ce 100644 --- a/src/lua/creature/creatureevent.cpp +++ b/src/lua/creature/creatureevent.cpp @@ -173,8 +173,8 @@ bool CreatureEvent::executeOnLogin(std::shared_ptr player) const { // onLogin(player) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeOnLogin - Player {} event {}]" - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), getName()); return false; } @@ -193,8 +193,8 @@ bool CreatureEvent::executeOnLogout(std::shared_ptr player) const { // onLogout(player) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeOnLogout - Player {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), getName()); return false; } @@ -213,8 +213,8 @@ bool CreatureEvent::executeOnThink(std::shared_ptr creature, uint32_t // onThink(creature, interval) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeOnThink - Creature {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), getName()); return false; } @@ -235,8 +235,8 @@ bool CreatureEvent::executeOnPrepareDeath(std::shared_ptr creature, st // onPrepareDeath(creature, killer) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeOnPrepareDeath - Creature {} killer {}" - " event {}] Call stack overflow. Too many lua script calls being nested.", - creature->getName(), killer->getName(), getName()); + " event {}] Call stack overflow. Too many lua script calls being nested.", + creature->getName(), killer->getName(), getName()); return false; } @@ -264,8 +264,8 @@ bool CreatureEvent::executeOnDeath(std::shared_ptr creature, std::shar // onDeath(creature, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeOnDeath - Creature {} killer {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), killer->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), killer->getName(), getName()); return false; } @@ -304,8 +304,8 @@ bool CreatureEvent::executeAdvance(std::shared_ptr player, skills_t skil // onAdvance(player, skill, oldLevel, newLevel) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeAdvance - Player {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), getName()); return false; } @@ -330,12 +330,12 @@ bool CreatureEvent::executeAdvance(std::shared_ptr player, skills_t skil void CreatureEvent::executeOnKill(std::shared_ptr creature, std::shared_ptr target, bool lastHit) const { // onKill(creature, target, lastHit) g_logger().warn("[CreatureEvent::executeOnKill - Creature {} target {} event {}] " - "Deprecated use of onKill event. Use registered onDeath events instead for better performance.", - creature->getName(), target->getName(), getName()); + "Deprecated use of onKill event. Use registered onDeath events instead for better performance.", + creature->getName(), target->getName(), getName()); if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeOnKill - Creature {} target {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), target->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), target->getName(), getName()); return; } @@ -357,9 +357,9 @@ void CreatureEvent::executeModalWindow(std::shared_ptr player, uint32_t // onModalWindow(player, modalWindowId, buttonId, choiceId) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeModalWindow - " - "Player {} modaw window id {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), modalWindowId, getName()); + "Player {} modaw window id {} event {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), modalWindowId, getName()); return; } @@ -383,8 +383,8 @@ bool CreatureEvent::executeTextEdit(std::shared_ptr player, std::shared_ // onTextEdit(player, item, text) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeTextEdit - Player {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), getName()); return false; } @@ -407,9 +407,9 @@ void CreatureEvent::executeHealthChange(std::shared_ptr creature, std: // onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeHealthChange - " - "Creature {} attacker {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), attacker->getName(), getName()); + "Creature {} attacker {} event {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), attacker->getName(), getName()); return; } @@ -452,9 +452,9 @@ void CreatureEvent::executeManaChange(std::shared_ptr creature, std::s // onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeManaChange - " - "Creature {} attacker {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), attacker->getName(), getName()); + "Creature {} attacker {} event {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), attacker->getName(), getName()); return; } @@ -492,9 +492,9 @@ void CreatureEvent::executeExtendedOpcode(std::shared_ptr player, uint8_ // onExtendedOpcode(player, opcode, buffer) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[CreatureEvent::executeExtendedOpcode - " - "Player {} event {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), getName()); + "Player {} event {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), getName()); return; } diff --git a/src/lua/creature/events.cpp b/src/lua/creature/events.cpp index 2917d128b8a..8bdd53465b3 100644 --- a/src/lua/creature/events.cpp +++ b/src/lua/creature/events.cpp @@ -158,9 +158,9 @@ void Events::eventMonsterOnSpawn(std::shared_ptr monster, const Positio if (!scriptInterface.reserveScriptEnv()) { g_logger().error("{} - " - "Position {}" - ". Call stack overflow. Too many lua script calls being nested.", - __FUNCTION__, position.toString()); + "Position {}" + ". Call stack overflow. Too many lua script calls being nested.", + __FUNCTION__, position.toString()); return; } @@ -192,9 +192,9 @@ void Events::eventNpcOnSpawn(std::shared_ptr npc, const Position &position) if (!scriptInterface.reserveScriptEnv()) { g_logger().error("{} - " - "Position {}" - ". Call stack overflow. Too many lua script calls being nested.", - __FUNCTION__, position.toString()); + "Position {}" + ". Call stack overflow. Too many lua script calls being nested.", + __FUNCTION__, position.toString()); return; } @@ -226,8 +226,8 @@ bool Events::eventCreatureOnChangeOutfit(std::shared_ptr creature, con if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventCreatureOnChangeOutfit - Creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName()); return false; } @@ -253,9 +253,9 @@ ReturnValue Events::eventCreatureOnAreaCombat(std::shared_ptr creature if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventCreatureOnAreaCombat - " - "Creature {} on tile position {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), tile->getPosition().toString()); + "Creature {} on tile position {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), tile->getPosition().toString()); return RETURNVALUE_NOTPOSSIBLE; } @@ -298,9 +298,9 @@ ReturnValue Events::eventCreatureOnTargetCombat(std::shared_ptr creatu if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventCreatureOnTargetCombat - " - "Creature {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), target->getName()); + "Creature {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), target->getName()); return RETURNVALUE_NOTPOSSIBLE; } @@ -341,9 +341,9 @@ void Events::eventCreatureOnHear(std::shared_ptr creature, std::shared if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventCreatureOnHear - " - "Creature {} speaker {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), speaker->getName()); + "Creature {} speaker {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), speaker->getName()); return; } @@ -372,9 +372,9 @@ void Events::eventCreatureOnDrainHealth(std::shared_ptr creature, std: if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventCreatureOnDrainHealth - " - "Creature {} attacker {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), attacker->getName()); + "Creature {} attacker {}] " + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), attacker->getName()); return; } @@ -429,9 +429,9 @@ bool Events::eventPartyOnJoin(std::shared_ptr party, std::shared_ptrgetName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -458,9 +458,9 @@ bool Events::eventPartyOnLeave(std::shared_ptr party, std::shared_ptrgetName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -487,8 +487,8 @@ bool Events::eventPartyOnDisband(std::shared_ptr party) { if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPartyOnDisband - Party leader {}] Call stack " - "overflow. Too many lua script calls being nested.", - party->getLeader() ? party->getLeader()->getName() : "unknown"); + "overflow. Too many lua script calls being nested.", + party->getLeader() ? party->getLeader()->getName() : "unknown"); return false; } @@ -545,9 +545,9 @@ bool Events::eventPlayerOnBrowseField(std::shared_ptr player, const Posi if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnBrowseField - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -573,9 +573,9 @@ void Events::eventPlayerOnLook(std::shared_ptr player, const Position &p if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnLook - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -612,9 +612,9 @@ void Events::eventPlayerOnLookInBattleList(std::shared_ptr player, std:: if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnLookInBattleList - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -643,9 +643,9 @@ void Events::eventPlayerOnLookInTrade(std::shared_ptr player, std::share if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnLookInTrade - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -677,9 +677,9 @@ bool Events::eventPlayerOnLookInShop(std::shared_ptr player, const ItemT if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnLookInShop - " - "Player {} itemType {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), itemType->getPluralName()); + "Player {} itemType {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), itemType->getPluralName()); return false; } @@ -708,9 +708,9 @@ bool Events::eventPlayerOnRemoveCount(std::shared_ptr player, std::share if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnMove - " - "Player {} item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Player {} item {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return false; } @@ -737,9 +737,9 @@ bool Events::eventPlayerOnMoveItem(std::shared_ptr player, std::shared_p if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnMoveItem - " - "Player {} item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Player {} item {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return false; } @@ -773,9 +773,9 @@ void Events::eventPlayerOnItemMoved(std::shared_ptr player, std::shared_ if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnItemMoved - " - "Player {} item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Player {} item {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return; } @@ -809,9 +809,9 @@ void Events::eventPlayerOnChangeZone(std::shared_ptr player, ZoneType_t if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnChangeZone - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -836,9 +836,9 @@ bool Events::eventPlayerOnMoveCreature(std::shared_ptr player, std::shar if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnMoveCreature - " - "Player {} creature {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), creature->getName()); + "Player {} creature {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), creature->getName()); return false; } @@ -868,9 +868,9 @@ void Events::eventPlayerOnReportRuleViolation(std::shared_ptr player, co if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnReportRuleViolation - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -902,9 +902,9 @@ bool Events::eventPlayerOnReportBug(std::shared_ptr player, const std::s if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnReportBug - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -932,9 +932,9 @@ bool Events::eventPlayerOnTurn(std::shared_ptr player, Direction directi if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnTurn - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return false; } @@ -960,9 +960,9 @@ bool Events::eventPlayerOnTradeRequest(std::shared_ptr player, std::shar if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnTradeRequest - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return false; } @@ -992,9 +992,9 @@ bool Events::eventPlayerOnTradeAccept(std::shared_ptr player, std::share if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnTradeAccept - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return false; } @@ -1028,9 +1028,9 @@ void Events::eventPlayerOnGainExperience(std::shared_ptr player, std::sh if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnGainExperience - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return; } @@ -1071,9 +1071,9 @@ void Events::eventPlayerOnLoseExperience(std::shared_ptr player, uint64_ if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnLoseExperience - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -1106,9 +1106,9 @@ void Events::eventPlayerOnGainSkillTries(std::shared_ptr player, skills_ if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnGainSkillTries - " - "Player {} skill {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), fmt::underlying(skill)); + "Player {} skill {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), fmt::underlying(skill)); return; } @@ -1142,9 +1142,9 @@ void Events::eventPlayerOnCombat(std::shared_ptr player, std::shared_ptr if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnCombat - " - "Player {} target {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), target->getName()); + "Player {} target {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), target->getName()); return; } @@ -1199,9 +1199,9 @@ void Events::eventPlayerOnRequestQuestLog(std::shared_ptr player) { if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnRequestQuestLog - " - "Player {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName()); + "Player {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName()); return; } @@ -1225,9 +1225,9 @@ void Events::eventPlayerOnRequestQuestLine(std::shared_ptr player, uint1 if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventPlayerOnRequestQuestLine - " - "Player {} questId {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), questId); + "Player {} questId {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), questId); return; } @@ -1282,9 +1282,9 @@ void Events::eventOnStorageUpdate(std::shared_ptr player, const uint32_t if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventOnStorageUpdate - " - "Player {} key {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), key); + "Player {} key {}] " + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), key); return; } @@ -1314,9 +1314,9 @@ void Events::eventMonsterOnDropLoot(std::shared_ptr monster, std::share if (!scriptInterface.reserveScriptEnv()) { g_logger().error("[Events::eventMonsterOnDropLoot - " - "Monster corpse {}] " - "Call stack overflow. Too many lua script calls being nested.", - corpse->getName()); + "Monster corpse {}] " + "Call stack overflow. Too many lua script calls being nested.", + corpse->getName()); return; } diff --git a/src/lua/creature/movement.cpp b/src/lua/creature/movement.cpp index b302877b3d3..b75ff31c661 100644 --- a/src/lua/creature/movement.cpp +++ b/src/lua/creature/movement.cpp @@ -133,9 +133,9 @@ bool MoveEvents::registerLuaPositionEvent(const std::shared_ptr moveE bool MoveEvents::registerLuaEvent(const std::shared_ptr moveEvent) { // Check if event is correct if (registerLuaItemEvent(moveEvent) - || registerLuaUniqueEvent(moveEvent) - || registerLuaActionEvent(moveEvent) - || registerLuaPositionEvent(moveEvent)) { + || registerLuaUniqueEvent(moveEvent) + || registerLuaActionEvent(moveEvent) + || registerLuaPositionEvent(moveEvent)) { return true; } else { g_logger().warn( @@ -292,7 +292,7 @@ bool MoveEvents::registerEvent(const std::shared_ptr moveEvent, const std::shared_ptr MoveEvents::getEvent(const std::shared_ptr &tile, MoveEvent_t eventType) { if (auto it = positionsMap.find(tile->getPosition()); - it != positionsMap.end()) { + it != positionsMap.end()) { std::list> &moveEventList = it->second.moveEvent[eventType]; if (!moveEventList.empty()) { return *moveEventList.begin(); @@ -727,12 +727,12 @@ bool MoveEvent::executeStep(const std::shared_ptr &creature, std::shar if (!getScriptInterface()->reserveScriptEnv()) { if (item != nullptr) { g_logger().error("[MoveEvent::executeStep - Creature {} item {}, position {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), item->getName(), pos.toString()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), item->getName(), pos.toString()); } else { g_logger().error("[MoveEvent::executeStep - Creature {}, position {}] " - "Call stack overflow. Too many lua script calls being nested.", - creature->getName(), pos.toString()); + "Call stack overflow. Too many lua script calls being nested.", + creature->getName(), pos.toString()); } return false; } @@ -770,8 +770,8 @@ bool MoveEvent::executeEquip(const std::shared_ptr &player, const std::s // onDeEquip(player, item, slot, isCheck) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[MoveEvent::executeEquip - Player {} item {}] " - "Call stack overflow. Too many lua script calls being nested.", - player->getName(), item->getName()); + "Call stack overflow. Too many lua script calls being nested.", + player->getName(), item->getName()); return false; } @@ -803,9 +803,9 @@ bool MoveEvent::executeAddRemItem(const std::shared_ptr &item, const std:: // onRemoveItem(moveitem, tileitem, pos) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[MoveEvent::executeAddRemItem - " - "Item {} item on tile x: {} y: {} z: {}] " - "Call stack overflow. Too many lua script calls being nested.", - item->getName(), pos.getX(), pos.getY(), pos.getZ()); + "Item {} item on tile x: {} y: {} z: {}] " + "Call stack overflow. Too many lua script calls being nested.", + item->getName(), pos.getX(), pos.getY(), pos.getZ()); return false; } @@ -835,9 +835,9 @@ bool MoveEvent::executeAddRemItem(const std::shared_ptr &item, const Posit // onRemoveItem(moveitem, pos) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[MoveEvent::executeAddRemItem - " - "Item {} item on tile x: {} y: {} z: {}] " - "Call stack overflow. Too many lua script calls being nested.", - item->getName(), pos.getX(), pos.getY(), pos.getZ()); + "Item {} item on tile x: {} y: {} z: {}] " + "Call stack overflow. Too many lua script calls being nested.", + item->getName(), pos.getX(), pos.getY(), pos.getZ()); return false; } diff --git a/src/lua/creature/movement.hpp b/src/lua/creature/movement.hpp index 4ce4297b0f5..b8168f58521 100644 --- a/src/lua/creature/movement.hpp +++ b/src/lua/creature/movement.hpp @@ -47,7 +47,7 @@ class MoveEvents final : public Scripts { bool hasPosition(Position position) const { if (auto it = positionsMap.find(position); - it != positionsMap.end()) { + it != positionsMap.end()) { return true; } return false; @@ -63,7 +63,7 @@ class MoveEvents final : public Scripts { bool hasItemId(int32_t itemId) const { if (auto it = itemIdMap.find(itemId); - it != itemIdMap.end()) { + it != itemIdMap.end()) { return true; } return false; @@ -79,7 +79,7 @@ class MoveEvents final : public Scripts { bool hasUniqueId(int32_t uniqueId) const { if (auto it = uniqueIdMap.find(uniqueId); - it != uniqueIdMap.end()) { + it != uniqueIdMap.end()) { return true; } return false; @@ -95,7 +95,7 @@ class MoveEvents final : public Scripts { bool hasActionId(int32_t actionId) const { if (auto it = actionIdMap.find(actionId); - it != actionIdMap.end()) { + it != actionIdMap.end()) { return true; } return false; diff --git a/src/lua/creature/raids.cpp b/src/lua/creature/raids.cpp index a4500d126ba..8064bf52b81 100644 --- a/src/lua/creature/raids.cpp +++ b/src/lua/creature/raids.cpp @@ -52,16 +52,16 @@ bool Raids::loadFromXml() { ss << "raids/" << name << ".xml"; file = ss.str(); g_logger().warn("{} - " - "'file' tag missing for raid: {} using default: {}", - __FUNCTION__, name, file); + "'file' tag missing for raid: {} using default: {}", + __FUNCTION__, name, file); } interval = pugi::cast(raidNode.attribute("interval2").value()) * 60; if (interval == 0) { g_logger().error("{} - " - "'interval2' tag missing or zero " - "(would divide by 0) for raid: {}", - __FUNCTION__, name); + "'interval2' tag missing or zero " + "(would divide by 0) for raid: {}", + __FUNCTION__, name); continue; } @@ -69,8 +69,8 @@ bool Raids::loadFromXml() { margin = pugi::cast(attr.value()) * 60 * 1000; } else { g_logger().warn("{} - " - "'margin' tag missing for raid: {}", - __FUNCTION__, name); + "'margin' tag missing for raid: {}", + __FUNCTION__, name); margin = 0; } @@ -202,8 +202,8 @@ bool Raid::loadFromXml(const std::string &filename) { raidEvents.push_back(event); } else { g_logger().error("{} - " - "In file: {}, eventNode: {}", - __FUNCTION__, filename, eventNode.name()); + "In file: {}, eventNode: {}", + __FUNCTION__, filename, eventNode.name()); } } @@ -288,8 +288,8 @@ bool AnnounceEvent::configureRaidEvent(const pugi::xml_node &eventNode) { pugi::xml_attribute messageAttribute = eventNode.attribute("message"); if (!messageAttribute) { g_logger().error("{} - " - "'message' tag missing for announce event", - __FUNCTION__); + "'message' tag missing for announce event", + __FUNCTION__); return false; } message = messageAttribute.as_string(); @@ -311,16 +311,16 @@ bool AnnounceEvent::configureRaidEvent(const pugi::xml_node &eventNode) { messageType = MESSAGE_GAMEMASTER_CONSOLE; } else { g_logger().warn("{} - " - "Unknown type tag missing for announce event, " - "using default: {}", - __FUNCTION__, static_cast(messageType)); + "Unknown type tag missing for announce event, " + "using default: {}", + __FUNCTION__, static_cast(messageType)); } } else { messageType = MESSAGE_EVENT_ADVANCE; g_logger().warn("{} - " - "Type tag missing for announce event, " - "using default: {}", - __FUNCTION__, static_cast(messageType)); + "Type tag missing for announce event, " + "using default: {}", + __FUNCTION__, static_cast(messageType)); } return true; } @@ -341,8 +341,8 @@ bool SingleSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { monsterName = attr.as_string(); } else { g_logger().error("{} - " - "'Name' tag missing for singlespawn event", - __FUNCTION__); + "'Name' tag missing for singlespawn event", + __FUNCTION__); return false; } @@ -350,8 +350,8 @@ bool SingleSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { position.x = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'X' tag missing for singlespawn event", - __FUNCTION__); + "'X' tag missing for singlespawn event", + __FUNCTION__); return false; } @@ -359,8 +359,8 @@ bool SingleSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { position.y = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'Y' tag missing for singlespawn event", - __FUNCTION__); + "'Y' tag missing for singlespawn event", + __FUNCTION__); return false; } @@ -368,8 +368,8 @@ bool SingleSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { position.z = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'Z' tag missing for singlespawn event", - __FUNCTION__); + "'Z' tag missing for singlespawn event", + __FUNCTION__); return false; } return true; @@ -405,9 +405,9 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { centerPos.x = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "" - "'centerx' tag missing for areaspawn event", - __FUNCTION__); + "" + "'centerx' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -415,8 +415,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { centerPos.y = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'centery' tag missing for areaspawn event", - __FUNCTION__); + "'centery' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -424,8 +424,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { centerPos.z = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "centerz' tag missing for areaspawn event", - __FUNCTION__); + "centerz' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -441,8 +441,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { fromPos.x = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'fromx' tag missing for areaspawn event", - __FUNCTION__); + "'fromx' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -450,8 +450,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { fromPos.y = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'fromy' tag missing for areaspawn event", - __FUNCTION__); + "'fromy' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -459,8 +459,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { fromPos.z = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'fromz' tag missing for areaspawn event", - __FUNCTION__); + "'fromz' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -468,8 +468,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { toPos.x = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'tox' tag missing for areaspawn event", - __FUNCTION__); + "'tox' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -477,8 +477,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { toPos.y = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'toy' tag missing for areaspawn event", - __FUNCTION__); + "'toy' tag missing for areaspawn event", + __FUNCTION__); return false; } @@ -486,8 +486,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { toPos.z = pugi::cast(attr.value()); } else { g_logger().error("{} - " - "'toz' tag missing for areaspawn event", - __FUNCTION__); + "'toz' tag missing for areaspawn event", + __FUNCTION__); return false; } } @@ -499,8 +499,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { name = attr.value(); } else { g_logger().error("{} - " - "'name' tag missing for monster node", - __FUNCTION__); + "'name' tag missing for monster node", + __FUNCTION__); return false; } @@ -524,8 +524,8 @@ bool AreaSpawnEvent::configureRaidEvent(const pugi::xml_node &eventNode) { maxAmount = minAmount; } else { g_logger().error("{} - " - "'amount' tag missing for monster node", - __FUNCTION__); + "'amount' tag missing for monster node", + __FUNCTION__); return false; } } @@ -570,8 +570,8 @@ bool ScriptEvent::configureRaidEvent(const pugi::xml_node &eventNode) { pugi::xml_attribute scriptAttribute = eventNode.attribute("script"); if (!scriptAttribute) { g_logger().error("{} - " - "No script file found for raid", - __FUNCTION__); + "No script file found for raid", + __FUNCTION__); return false; } @@ -595,8 +595,8 @@ bool ScriptEvent::executeEvent() { // onRaid() if (!scriptInterface->reserveScriptEnv()) { g_logger().error("{} - Script with name {} " - "Call stack overflow. Too many lua script calls being nested.", - __FUNCTION__, getScriptName()); + "Call stack overflow. Too many lua script calls being nested.", + __FUNCTION__, getScriptName()); return false; } diff --git a/src/lua/creature/talkaction.cpp b/src/lua/creature/talkaction.cpp index 3586bdbceea..c1b8c028ddc 100644 --- a/src/lua/creature/talkaction.cpp +++ b/src/lua/creature/talkaction.cpp @@ -83,8 +83,8 @@ bool TalkAction::executeSay(std::shared_ptr player, const std::string &w // onSay(player, words, param, type) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[TalkAction::executeSay - Player {} words {}] " - "Call stack overflow. Too many lua script calls being nested. Script name {}", - player->getName(), getWords(), getScriptInterface()->getLoadingScriptName()); + "Call stack overflow. Too many lua script calls being nested. Script name {}", + player->getName(), getWords(), getScriptInterface()->getLoadingScriptName()); return false; } diff --git a/src/lua/functions/core/game/game_functions.cpp b/src/lua/functions/core/game/game_functions.cpp index 4858b3ab264..ec5c5102794 100644 --- a/src/lua/functions/core/game/game_functions.cpp +++ b/src/lua/functions/core/game/game_functions.cpp @@ -728,8 +728,8 @@ int GameFunctions::luaGameGetDummies(lua_State* L) { * @details This function provides a table containing two sub-tables: one for free dummies and one for house (or premium) dummies. * @note usage on lua: - local dummies = Game.getDummies() - local rate = dummies[1] -- Retrieve dummy rate + local dummies = Game.getDummies() + local rate = dummies[1] -- Retrieve dummy rate */ const auto &dummies = Item::items.getDummys(); diff --git a/src/lua/functions/creatures/combat/spell_functions.cpp b/src/lua/functions/creatures/combat/spell_functions.cpp index 0bcf7c9c11a..a24407c1682 100644 --- a/src/lua/functions/creatures/combat/spell_functions.cpp +++ b/src/lua/functions/creatures/combat/spell_functions.cpp @@ -18,7 +18,7 @@ int SpellFunctions::luaSpellCreate(lua_State* L) { // Spell(type) ex: Spell(SPELL_INSTANT) or Spell(SPELL_RUNE) to create a new spell if (lua_gettop(L) == 1) { g_logger().error("[SpellFunctions::luaSpellCreate] - " - "There is no parameter set!"); + "There is no parameter set!"); lua_pushnil(L); return 1; } @@ -209,16 +209,16 @@ int SpellFunctions::luaSpellGroup(lua_State* L) { spell->setGroup(group); } else { g_logger().warn("[SpellFunctions::luaSpellGroup] - " - "Unknown group: {}", - getString(L, 2)); + "Unknown group: {}", + getString(L, 2)); pushBoolean(L, false); return 1; } pushBoolean(L, true); } else { g_logger().warn("[SpellFunctions::luaSpellGroup] - " - "Unknown group: {}", - getString(L, 2)); + "Unknown group: {}", + getString(L, 2)); pushBoolean(L, false); return 1; } @@ -235,8 +235,8 @@ int SpellFunctions::luaSpellGroup(lua_State* L) { spell->setGroup(primaryGroup); } else { g_logger().warn("[SpellFunctions::luaSpellGroup] - " - "Unknown primaryGroup: {}", - getString(L, 2)); + "Unknown primaryGroup: {}", + getString(L, 2)); pushBoolean(L, false); return 1; } @@ -245,16 +245,16 @@ int SpellFunctions::luaSpellGroup(lua_State* L) { spell->setSecondaryGroup(secondaryGroup); } else { g_logger().warn("[SpellFunctions::luaSpellGroup] - " - "Unknown secondaryGroup: {}", - getString(L, 3)); + "Unknown secondaryGroup: {}", + getString(L, 3)); pushBoolean(L, false); return 1; } pushBoolean(L, true); } else { g_logger().warn("[SpellFunctions::luaSpellGroup] - " - "Unknown primaryGroup: {} or secondaryGroup: {}", - getString(L, 2), getString(L, 3)); + "Unknown primaryGroup: {} or secondaryGroup: {}", + getString(L, 2), getString(L, 3)); pushBoolean(L, false); return 1; } diff --git a/src/lua/functions/creatures/creature_functions.cpp b/src/lua/functions/creatures/creature_functions.cpp index 7a40cc426f1..4ae5da0e132 100644 --- a/src/lua/functions/creatures/creature_functions.cpp +++ b/src/lua/functions/creatures/creature_functions.cpp @@ -793,7 +793,7 @@ int CreatureFunctions::luaCreatureTeleportTo(lua_State* L) { const Position oldPosition = creature->getPosition(); if (auto ret = g_game().internalTeleport(creature, position, pushMovement); - ret != RETURNVALUE_NOERROR) { + ret != RETURNVALUE_NOERROR) { g_logger().debug("[{}] Failed to teleport creature {}, on position {}, error code: {}", __FUNCTION__, creature->getName(), oldPosition.toString(), getReturnMessage(ret)); pushBoolean(L, false); return 1; diff --git a/src/lua/functions/creatures/monster/loot_functions.cpp b/src/lua/functions/creatures/monster/loot_functions.cpp index 3fe3a188368..47e0d8778e3 100644 --- a/src/lua/functions/creatures/monster/loot_functions.cpp +++ b/src/lua/functions/creatures/monster/loot_functions.cpp @@ -29,7 +29,7 @@ int LootFunctions::luaLootSetId(lua_State* L) { pushBoolean(L, true); } else { g_logger().warn("[LootFunctions::luaLootSetId] - " - "Unknown loot item loot, int value expected"); + "Unknown loot item loot, int value expected"); lua_pushnil(L); } } else { @@ -47,16 +47,16 @@ int LootFunctions::luaLootSetIdFromName(lua_State* L) { if (ids.first == Item::items.nameToItems.cend()) { g_logger().warn("[LootFunctions::luaLootSetIdFromName] - " - "Unknown loot item {}", - name); + "Unknown loot item {}", + name); lua_pushnil(L); return 1; } if (std::next(ids.first) != ids.second) { g_logger().warn("[LootFunctions::luaLootSetIdFromName] - " - "Non-unique loot item {}", - name); + "Non-unique loot item {}", + name); lua_pushnil(L); return 1; } @@ -65,7 +65,7 @@ int LootFunctions::luaLootSetIdFromName(lua_State* L) { pushBoolean(L, true); } else { g_logger().warn("[LootFunctions::luaLootSetIdFromName] - " - "Unknown loot item loot, string value expected"); + "Unknown loot item loot, string value expected"); lua_pushnil(L); } return 1; diff --git a/src/lua/functions/creatures/monster/monster_type_functions.cpp b/src/lua/functions/creatures/monster/monster_type_functions.cpp index b937083fddb..ded7c2054db 100644 --- a/src/lua/functions/creatures/monster/monster_type_functions.cpp +++ b/src/lua/functions/creatures/monster/monster_type_functions.cpp @@ -681,8 +681,8 @@ int MonsterTypeFunctions::luaMonsterTypeCombatImmunities(lua_State* L) { combatType = COMBAT_NEUTRALDAMAGE; } else { g_logger().warn("[MonsterTypeFunctions::luaMonsterTypeCombatImmunities] - " - "Unknown immunity name {} for monster: {}", - immunity, monsterType->name); + "Unknown immunity name {} for monster: {}", + immunity, monsterType->name); lua_pushnil(L); } @@ -739,8 +739,8 @@ int MonsterTypeFunctions::luaMonsterTypeConditionImmunities(lua_State* L) { conditionType = CONDITION_BLEEDING; } else { g_logger().warn("[MonsterTypeFunctions::luaMonsterTypeConditionImmunities] - " - "Unknown immunity name: {} for monster: {}", - immunity, monsterType->name); + "Unknown immunity name: {} for monster: {}", + immunity, monsterType->name); lua_pushnil(L); } @@ -1195,8 +1195,8 @@ int MonsterTypeFunctions::luaMonsterTypeRace(lua_State* L) { monsterType->info.race = RACE_INK; } else { g_logger().warn("[MonsterTypeFunctions::luaMonsterTypeRace] - " - "Unknown race type {}", - race); + "Unknown race type {}", + race); lua_pushnil(L); return 1; } diff --git a/src/lua/functions/creatures/npc/shop_functions.cpp b/src/lua/functions/creatures/npc/shop_functions.cpp index ee848e0bf47..122e249a8db 100644 --- a/src/lua/functions/creatures/npc/shop_functions.cpp +++ b/src/lua/functions/creatures/npc/shop_functions.cpp @@ -28,7 +28,7 @@ int ShopFunctions::luaShopSetId(lua_State* L) { pushBoolean(L, true); } else { g_logger().warn("[ShopFunctions::luaShopSetId] - " - "Unknown shop item shop, int value expected"); + "Unknown shop item shop, int value expected"); lua_pushnil(L); } } else { @@ -46,16 +46,16 @@ int ShopFunctions::luaShopSetIdFromName(lua_State* L) { if (ids.first == Item::items.nameToItems.cend()) { g_logger().warn("[ShopFunctions::luaShopSetIdFromName] - " - "Unknown shop item {}", - name); + "Unknown shop item {}", + name); lua_pushnil(L); return 1; } if (std::next(ids.first) != ids.second) { g_logger().warn("[ShopFunctions::luaShopSetIdFromName] - " - "Non-unique shop item {}", - name); + "Non-unique shop item {}", + name); lua_pushnil(L); return 1; } @@ -64,7 +64,7 @@ int ShopFunctions::luaShopSetIdFromName(lua_State* L) { pushBoolean(L, true); } else { g_logger().warn("[ShopFunctions::luaShopSetIdFromName] - " - "Unknown shop item shop, string value expected"); + "Unknown shop item shop, string value expected"); lua_pushnil(L); } return 1; diff --git a/src/lua/functions/creatures/player/player_functions.cpp b/src/lua/functions/creatures/player/player_functions.cpp index 5f14db6ea99..9cc5434abd5 100644 --- a/src/lua/functions/creatures/player/player_functions.cpp +++ b/src/lua/functions/creatures/player/player_functions.cpp @@ -407,7 +407,7 @@ int PlayerFunctions::luaPlayerGetPreyExperiencePercentage(lua_State* L) { // player:getPreyExperiencePercentage(raceId) if (std::shared_ptr player = getUserdataShared(L, 1)) { if (const std::unique_ptr &slot = player->getPreyWithMonster(getNumber(L, 2, 0)); - slot && slot->isOccupied() && slot->bonus == PreyBonus_Experience && slot->bonusTimeLeft > 0) { + slot && slot->isOccupied() && slot->bonus == PreyBonus_Experience && slot->bonusTimeLeft > 0) { lua_pushnumber(L, static_cast(100 + slot->bonusPercentage)); } else { lua_pushnumber(L, 100); @@ -457,7 +457,7 @@ int PlayerFunctions::luaPlayerGetPreyLootPercentage(lua_State* L) { // player:getPreyLootPercentage(raceid) if (std::shared_ptr player = getUserdataShared(L, 1)) { if (const std::unique_ptr &slot = player->getPreyWithMonster(getNumber(L, 2, 0)); - slot && slot->isOccupied() && slot->bonus == PreyBonus_Loot) { + slot && slot->isOccupied() && slot->bonus == PreyBonus_Loot) { lua_pushnumber(L, slot->bonusPercentage); } else { lua_pushnumber(L, 0); @@ -472,7 +472,7 @@ int PlayerFunctions::luaPlayerisMonsterPrey(lua_State* L) { // player:isMonsterPrey(raceid) if (std::shared_ptr player = getUserdataShared(L, 1)) { if (const std::unique_ptr &slot = player->getPreyWithMonster(getNumber(L, 2, 0)); - slot && slot->isOccupied()) { + slot && slot->isOccupied()) { pushBoolean(L, true); } else { pushBoolean(L, false); @@ -486,7 +486,7 @@ int PlayerFunctions::luaPlayerisMonsterPrey(lua_State* L) { int PlayerFunctions::luaPlayerPreyThirdSlot(lua_State* L) { // get: player:preyThirdSlot() set: player:preyThirdSlot(bool) if (std::shared_ptr player = getUserdataShared(L, 1); - const auto &slot = player->getPreySlotById(PreySlot_Three)) { + const auto &slot = player->getPreySlotById(PreySlot_Three)) { if (!slot) { lua_pushnil(L); } else if (lua_gettop(L) == 1) { @@ -513,7 +513,7 @@ int PlayerFunctions::luaPlayerPreyThirdSlot(lua_State* L) { int PlayerFunctions::luaPlayerTaskThirdSlot(lua_State* L) { // get: player:taskHuntingThirdSlot() set: player:taskHuntingThirdSlot(bool) if (std::shared_ptr player = getUserdataShared(L, 1); - const auto &slot = player->getTaskHuntingSlotById(PreySlot_Three)) { + const auto &slot = player->getTaskHuntingSlotById(PreySlot_Three)) { if (lua_gettop(L) == 1) { pushBoolean(L, slot->state != PreyTaskDataState_Locked); } else { @@ -3574,7 +3574,7 @@ int PlayerFunctions::luaPlayerBosstiaryCooldownTimer(lua_State* L) { int PlayerFunctions::luaPlayerGetBosstiaryLevel(lua_State* L) { // player:getBosstiaryLevel(name) if (std::shared_ptr player = getUserdataShared(L, 1); - player) { + player) { const auto mtype = g_monsters().getMonsterType(getString(L, 2)); if (mtype) { uint32_t bossId = mtype->info.raceid; @@ -3596,7 +3596,7 @@ int PlayerFunctions::luaPlayerGetBosstiaryLevel(lua_State* L) { int PlayerFunctions::luaPlayerGetBosstiaryKills(lua_State* L) { // player:getBosstiaryKills(name) if (std::shared_ptr player = getUserdataShared(L, 1); - player) { + player) { const auto mtype = g_monsters().getMonsterType(getString(L, 2)); if (mtype) { uint32_t bossId = mtype->info.raceid; @@ -3618,7 +3618,7 @@ int PlayerFunctions::luaPlayerGetBosstiaryKills(lua_State* L) { int PlayerFunctions::luaPlayerAddBosstiaryKill(lua_State* L) { // player:addBosstiaryKill(name[, amount = 1]) if (std::shared_ptr player = getUserdataShared(L, 1); - player) { + player) { const auto mtype = g_monsters().getMonsterType(getString(L, 2)); if (mtype) { g_ioBosstiary().addBosstiaryKill(player, mtype, getNumber(L, 3, 1)); diff --git a/src/lua/functions/events/action_functions.cpp b/src/lua/functions/events/action_functions.cpp index c1fd581f8bd..31b202465c7 100644 --- a/src/lua/functions/events/action_functions.cpp +++ b/src/lua/functions/events/action_functions.cpp @@ -133,7 +133,7 @@ int ActionFunctions::luaActionPosition(lua_State* L) { // The parameter "- 1" because self is a parameter aswell, which we want to skip L 1 (UserData) // isNumber(L, 2) is for skip the itemId if (int parameters = lua_gettop(L) - 1; - parameters > 1 && isNumber(L, 2)) { + parameters > 1 && isNumber(L, 2)) { for (int i = 0; i < parameters; ++i) { action->setPositionsVector(getPosition(L, 2 + i)); } diff --git a/src/lua/functions/events/creature_event_functions.cpp b/src/lua/functions/events/creature_event_functions.cpp index 7b5e25a12f3..7edbabad1d3 100644 --- a/src/lua/functions/events/creature_event_functions.cpp +++ b/src/lua/functions/events/creature_event_functions.cpp @@ -54,8 +54,8 @@ int CreatureEventFunctions::luaCreatureEventType(lua_State* L) { creatureEvent->setEventType(CREATURE_EVENT_EXTENDED_OPCODE); } else { g_logger().error("[CreatureEventFunctions::luaCreatureEventType] - " - "Invalid type for creature event: {}", - typeName); + "Invalid type for creature event: {}", + typeName); pushBoolean(L, false); } creatureEvent->setLoaded(true); diff --git a/src/lua/functions/events/global_event_functions.cpp b/src/lua/functions/events/global_event_functions.cpp index 8f54e5b03fd..ea6a5f7df03 100644 --- a/src/lua/functions/events/global_event_functions.cpp +++ b/src/lua/functions/events/global_event_functions.cpp @@ -42,7 +42,7 @@ int GlobalEventFunctions::luaGlobalEventType(lua_State* L) { global->setEventType(GLOBALEVENT_ON_THINK); } else { g_logger().error("[GlobalEventFunctions::luaGlobalEventType] - " - "Invalid type for global event: {}"); + "Invalid type for global event: {}"); pushBoolean(L, false); } pushBoolean(L, true); @@ -97,8 +97,8 @@ int GlobalEventFunctions::luaGlobalEventTime(lua_State* L) { int32_t hour = params.front(); if (hour < 0 || hour > 23) { g_logger().error("[GlobalEventFunctions::luaGlobalEventTime] - " - "Invalid hour {} for globalevent with name: {}", - timer, globalevent->getName()); + "Invalid hour {} for globalevent with name: {}", + timer, globalevent->getName()); pushBoolean(L, false); return 1; } @@ -111,8 +111,8 @@ int GlobalEventFunctions::luaGlobalEventTime(lua_State* L) { min = params[1]; if (min < 0 || min > 59) { g_logger().error("[GlobalEventFunctions::luaGlobalEventTime] - " - "Invalid minute: {} for globalevent with name: {}", - timer, globalevent->getName()); + "Invalid minute: {} for globalevent with name: {}", + timer, globalevent->getName()); pushBoolean(L, false); return 1; } @@ -121,8 +121,8 @@ int GlobalEventFunctions::luaGlobalEventTime(lua_State* L) { sec = params[2]; if (sec < 0 || sec > 59) { g_logger().error("[GlobalEventFunctions::luaGlobalEventTime] - " - "Invalid minute: {} for globalevent with name: {}", - timer, globalevent->getName()); + "Invalid minute: {} for globalevent with name: {}", + timer, globalevent->getName()); pushBoolean(L, false); return 1; } diff --git a/src/lua/functions/events/move_event_functions.cpp b/src/lua/functions/events/move_event_functions.cpp index 5de49c26f59..8340dded92f 100644 --- a/src/lua/functions/events/move_event_functions.cpp +++ b/src/lua/functions/events/move_event_functions.cpp @@ -47,8 +47,8 @@ int MoveEventFunctions::luaMoveEventType(lua_State* L) { moveevent->moveFunction = moveevent->RemoveItemField; } else { g_logger().error("[MoveEventFunctions::luaMoveEventType] - " - "No valid event name: {}", - typeName); + "No valid event name: {}", + typeName); pushBoolean(L, false); } pushBoolean(L, true); @@ -126,8 +126,8 @@ int MoveEventFunctions::luaMoveEventSlot(lua_State* L) { moveevent->setSlot(SLOTP_AMMO); } else { g_logger().warn("[MoveEventFunctions::luaMoveEventSlot] - " - "Unknown slot type: {}", - slotName); + "Unknown slot type: {}", + slotName); pushBoolean(L, false); return 1; } diff --git a/src/lua/functions/items/item_functions.cpp b/src/lua/functions/items/item_functions.cpp index 71ab040f47d..361a469da32 100644 --- a/src/lua/functions/items/item_functions.cpp +++ b/src/lua/functions/items/item_functions.cpp @@ -398,7 +398,7 @@ int ItemFunctions::luaItemSetAttribute(lua_State* L) { switch (attribute) { case ItemAttribute_t::DECAYSTATE: { if (ItemDecayState_t decayState = getNumber(L, 3); - decayState == DECAYING_FALSE || decayState == DECAYING_STOPPING) { + decayState == DECAYING_FALSE || decayState == DECAYING_STOPPING) { g_decay().stopDecay(item); } else { g_decay().startDecay(item); diff --git a/src/lua/functions/items/weapon_functions.cpp b/src/lua/functions/items/weapon_functions.cpp index 962c1181fe4..61eff2dfb66 100644 --- a/src/lua/functions/items/weapon_functions.cpp +++ b/src/lua/functions/items/weapon_functions.cpp @@ -77,8 +77,8 @@ int WeaponFunctions::luaWeaponAction(lua_State* L) { weapon->action = WEAPONACTION_MOVE; } else { g_logger().error("[WeaponFunctions::luaWeaponAction] - " - "No valid action {}", - typeName); + "No valid action {}", + typeName); pushBoolean(L, false); } pushBoolean(L, true); @@ -285,8 +285,8 @@ int WeaponFunctions::luaWeaponElement(lua_State* L) { weapon->params.combatType = COMBAT_HOLYDAMAGE; } else { g_logger().warn("[WeaponFunctions:luaWeaponElement] - " - "Type {} does not exist", - element); + "Type {} does not exist", + element); } } else { weapon->params.combatType = getNumber(L, 2); @@ -539,8 +539,8 @@ int WeaponFunctions::luaWeaponAmmoType(lua_State* L) { it.ammoType = AMMO_BOLT; } else { g_logger().warn("[WeaponFunctions:luaWeaponAmmoType] - " - "Type {} does not exist", - type); + "Type {} does not exist", + type); lua_pushnil(L); return 1; } @@ -604,8 +604,8 @@ int WeaponFunctions::luaWeaponExtraElement(lua_State* L) { it.abilities->elementType = COMBAT_HOLYDAMAGE; } else { g_logger().warn("[WeaponFunctions:luaWeaponExtraElement] - " - "Type {} does not exist", - element); + "Type {} does not exist", + element); } } else { it.abilities->elementType = getNumber(L, 3); diff --git a/src/lua/functions/lua_functions_loader.cpp b/src/lua/functions/lua_functions_loader.cpp index 69ee85dd865..c2dedfb57b6 100644 --- a/src/lua/functions/lua_functions_loader.cpp +++ b/src/lua/functions/lua_functions_loader.cpp @@ -289,13 +289,13 @@ void LuaFunctionsLoader::setWeakMetatable(lua_State* L, int32_t index, const std int metatable = lua_gettop(L); for (static const std::vector methodKeys = { "__index", "__metatable", "__eq" }; - const std::string &metaKey : methodKeys) { + const std::string &metaKey : methodKeys) { lua_getfield(L, childMetatable, metaKey.c_str()); lua_setfield(L, metatable, metaKey.c_str()); } for (static const std::vector methodIndexes = { 'h', 'p', 't' }; - int metaIndex : methodIndexes) { + int metaIndex : methodIndexes) { lua_rawgeti(L, childMetatable, metaIndex); lua_rawseti(L, metatable, metaIndex); } diff --git a/src/lua/global/baseevents.cpp b/src/lua/global/baseevents.cpp index 9728342f7ed..3b312100d3b 100644 --- a/src/lua/global/baseevents.cpp +++ b/src/lua/global/baseevents.cpp @@ -25,7 +25,7 @@ bool BaseEvents::loadFromXml() { basePath + "lib/" + scriptsName + ".lua", scriptsName + ".lua" ) - == -1) { + == -1) { g_logger().warn(__FUNCTION__, scriptsName, scriptsName); } @@ -107,8 +107,8 @@ bool Event::checkScript(const std::string &basePath, const std::string &scriptsN int32_t id = testInterface->getEvent(getScriptEventName()); if (id == -1) { g_logger().warn("[Event::checkScript] - Event " - "{} not found {}", - getScriptEventName(), scriptFile); + "{} not found {}", + getScriptEventName(), scriptFile); return false; } return true; diff --git a/src/lua/global/globalevent.cpp b/src/lua/global/globalevent.cpp index 9626173dc9f..04420431def 100644 --- a/src/lua/global/globalevent.cpp +++ b/src/lua/global/globalevent.cpp @@ -126,8 +126,8 @@ void GlobalEvents::think() { if (!globalEvent->executeEvent()) { g_logger().error("[GlobalEvents::think] - " - "Failed to execute event: {}", - globalEvent->getName()); + "Failed to execute event: {}", + globalEvent->getName()); } nextExecutionTime = globalEvent->getInterval(); @@ -206,8 +206,8 @@ bool GlobalEvent::executePeriodChange(LightState_t lightState, LightInfo lightIn // onPeriodChange(lightState, lightTime) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[GlobalEvent::executePeriodChange - {}] " - "Call stack overflow. Too many lua script calls being nested.", - getName()); + "Call stack overflow. Too many lua script calls being nested.", + getName()); return false; } @@ -226,8 +226,8 @@ bool GlobalEvent::executeRecord(uint32_t current, uint32_t old) { // onRecord(current, old) if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[GlobalEvent::executeRecord - {}] " - "Call stack overflow. Too many lua script calls being nested.", - getName()); + "Call stack overflow. Too many lua script calls being nested.", + getName()); return false; } @@ -245,8 +245,8 @@ bool GlobalEvent::executeRecord(uint32_t current, uint32_t old) { bool GlobalEvent::executeEvent() const { if (!getScriptInterface()->reserveScriptEnv()) { g_logger().error("[GlobalEvent::executeEvent - {}] " - "Call stack overflow. Too many lua script calls being nested.", - getName()); + "Call stack overflow. Too many lua script calls being nested.", + getName()); return false; } diff --git a/src/lua/scripts/lua_environment.cpp b/src/lua/scripts/lua_environment.cpp index f3d2273df34..cd5023a8d4b 100644 --- a/src/lua/scripts/lua_environment.cpp +++ b/src/lua/scripts/lua_environment.cpp @@ -174,8 +174,8 @@ void LuaEnvironment::executeTimerEvent(uint32_t eventIndex) { callFunction(timerEventDesc.parameters.size()); } else { g_logger().error("[LuaEnvironment::executeTimerEvent - Lua file {}] " - "Call stack overflow. Too many lua script calls being nested", - getLoadingFile()); + "Call stack overflow. Too many lua script calls being nested", + getLoadingFile()); } // free resources diff --git a/src/lua/scripts/scripts.cpp b/src/lua/scripts/scripts.cpp index 1d395cdd096..cb92c1cc29a 100644 --- a/src/lua/scripts/scripts.cpp +++ b/src/lua/scripts/scripts.cpp @@ -88,7 +88,7 @@ bool Scripts::loadScripts(std::string loadPath, bool isLib, bool reload) { // Check if file start with "#" if (std::string disable("#"); - file.front() == disable.front()) { + file.front() == disable.front()) { // Send log of disabled script if (g_configManager().getBoolean(SCRIPTS_CONSOLE_LOGS, __FUNCTION__)) { g_logger().info("[script]: {} [disabled]", realPath.filename().string()); diff --git a/src/map/house/house.cpp b/src/map/house/house.cpp index 842622b2af5..261147fff40 100644 --- a/src/map/house/house.cpp +++ b/src/map/house/house.cpp @@ -753,8 +753,8 @@ bool Houses::loadHousesXML(const std::string &filename) { ); if (entryPos.x == 0 && entryPos.y == 0 && entryPos.z == 0) { g_logger().warn("[Houses::loadHousesXML] - Entry not set for house " - "name: {} with id: {}", - house->getName(), houseId); + "name: {} with id: {}", + house->getName(), houseId); } house->setEntryPos(entryPos); diff --git a/src/map/house/housetile.cpp b/src/map/house/housetile.cpp index 6b301f0e817..5e728a14ea3 100644 --- a/src/map/house/housetile.cpp +++ b/src/map/house/housetile.cpp @@ -95,9 +95,9 @@ std::shared_ptr HouseTile::queryDestination(int32_t &index, const std: std::shared_ptr destTile = g_game().map.getTile(entryPos); if (!destTile) { g_logger().error("[HouseTile::queryDestination] - " - "Entry not correct for house name: {} " - "with id: {} not found tile: {}", - house->getName(), house->getId(), entryPos.toString()); + "Entry not correct for house name: {} " + "with id: {} not found tile: {}", + house->getName(), house->getId(), entryPos.toString()); destTile = g_game().map.getTile(player->getTemplePosition()); if (!destTile) { destTile = Tile::nullptr_tile; diff --git a/src/map/mapcache.cpp b/src/map/mapcache.cpp index 0448615ee99..cb3e95eb30e 100644 --- a/src/map/mapcache.cpp +++ b/src/map/mapcache.cpp @@ -70,7 +70,7 @@ void MapCache::parseItemAttr(const std::shared_ptr &BasicItem, std::s } /* if (BasicItem.description != 0) - item->setAttribute(ItemAttribute_t::DESCRIPTION, STRING_CACHE[BasicItem.description]);*/ + item->setAttribute(ItemAttribute_t::DESCRIPTION, STRING_CACHE[BasicItem.description]);*/ } std::shared_ptr MapCache::createItem(const std::shared_ptr &BasicItem, Position position) { diff --git a/src/map/spectators.cpp b/src/map/spectators.cpp index 10aaf0faf87..405119b83e9 100644 --- a/src/map/spectators.cpp +++ b/src/map/spectators.cpp @@ -59,11 +59,11 @@ bool Spectators::checkCache(const SpectatorsCache::FloorData &specData, bool onl for (const auto &creature : *list) { const auto &specPos = creature->getPosition(); if (centerPos.x - specPos.x >= minRangeX - && centerPos.y - specPos.y >= minRangeY - && centerPos.x - specPos.x <= maxRangeX - && centerPos.y - specPos.y <= maxRangeY - && (multifloor || specPos.z == centerPos.z) - && (!onlyPlayers || creature->getPlayer())) { + && centerPos.y - specPos.y >= minRangeY + && centerPos.x - specPos.x <= maxRangeX + && centerPos.y - specPos.y <= maxRangeY + && (multifloor || specPos.z == centerPos.z) + && (!onlyPlayers || creature->getPlayer())) { spectators.emplace_back(creature); } } diff --git a/src/server/network/connection/connection.cpp b/src/server/network/connection/connection.cpp index 3effd52f829..3072384420d 100644 --- a/src/server/network/connection/connection.cpp +++ b/src/server/network/connection/connection.cpp @@ -241,7 +241,7 @@ void Connection::parsePacket(const std::error_code &error) { // Check packet checksum uint32_t checksum; if (int32_t len = msg.getLength() - msg.getBufferPosition() - CHECKSUM_LENGTH; - len > 0) { + len > 0) { checksum = adlerChecksum(msg.getBuffer() + msg.getBufferPosition() + CHECKSUM_LENGTH, len); } else { checksum = 0; diff --git a/src/server/network/protocol/protocol.cpp b/src/server/network/protocol/protocol.cpp index 78cff72fab4..255899f2f99 100644 --- a/src/server/network/protocol/protocol.cpp +++ b/src/server/network/protocol/protocol.cpp @@ -78,7 +78,7 @@ bool Protocol::onRecvMessage(NetworkMessage &msg) { } else { uint32_t checksum; if (int32_t len = msg.getLength() - msg.getBufferPosition(); - len > 0) { + len > 0) { checksum = adlerChecksum(msg.getBuffer() + msg.getBufferPosition(), len); } else { checksum = 0; diff --git a/src/server/network/protocol/protocol.hpp b/src/server/network/protocol/protocol.hpp index c264f49bf01..54e3dcfd4c3 100644 --- a/src/server/network/protocol/protocol.hpp +++ b/src/server/network/protocol/protocol.hpp @@ -50,7 +50,7 @@ class Protocol : public std::enable_shared_from_this { void send(OutputMessage_ptr msg) const { if (auto connection = getConnection(); - connection != nullptr) { + connection != nullptr) { connection->send(msg); } } diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 58f06eee5ae..1476f255135 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -1485,7 +1485,7 @@ void ProtocolGame::GetFloorDescription(NetworkMessage &msg, int32_t x, int32_t y void ProtocolGame::checkCreatureAsKnown(uint32_t id, bool &known, uint32_t &removedKnown) { if (auto [creatureKnown, creatureInserted] = knownCreatureSet.insert(id); - !creatureInserted) { + !creatureInserted) { known = true; return; } @@ -1499,7 +1499,7 @@ void ProtocolGame::checkCreatureAsKnown(uint32_t id, bool &known, uint32_t &remo // We need to protect party players from removing std::shared_ptr creature = g_game().getCreatureByID(*it); if (std::shared_ptr checkPlayer; - creature && (checkPlayer = creature->getPlayer()) != nullptr) { + creature && (checkPlayer = creature->getPlayer()) != nullptr) { if (player->getParty() != checkPlayer->getParty() && !canSee(creature)) { removedKnown = *it; knownCreatureSet.erase(it); @@ -2334,7 +2334,7 @@ void ProtocolGame::parseBestiarysendMonsterData(NetworkMessage &msg) { if (!mtype) { g_logger().warn("[ProtocolGame::parseBestiarysendMonsterData] - " - "MonsterType was not found"); + "MonsterType was not found"); return; } @@ -2944,8 +2944,8 @@ void ProtocolGame::parseBestiarysendCreatures(NetworkMessage &msg) { if (race.empty()) { g_logger().warn("[ProtocolGame::parseBestiarysendCreature] - " - "Race was not found: {}, search: {}", - raceName, search); + "Race was not found: {}, search: {}", + raceName, search); return; } text = raceName; @@ -4887,7 +4887,7 @@ void ProtocolGame::updateCoinBalance() { threadPlayer->sendCoinBalance(); } }, - "ProtocolGame::updateCoinBalance"); + "ProtocolGame::updateCoinBalance"); } void ProtocolGame::sendMarketLeave() { @@ -5282,9 +5282,9 @@ void ProtocolGame::sendOpenForge() { for each convergence fusion (1 per item slot, only class 4): 1 byte: count fusable items for each fusable item: - 2 bytes: item id - 1 byte: tier - 2 bytes: count + 2 bytes: item id + 1 byte: tier + 2 bytes: count */ for (const auto &[slot, itemMap] : convergenceItemsMap) { uint8_t totalItemsCount = 0; @@ -5364,15 +5364,15 @@ void ProtocolGame::sendOpenForge() { /* for each convergence transfer: - 2 bytes: count donors - for each donor: - 2 bytes: item id - 1 byte: tier - 2 bytes: count - 2 bytes: count receivers - for each receiver: - 2 bytes: item id - 2 bytes: count + 2 bytes: count donors + for each donor: + 2 bytes: item id + 1 byte: tier + 2 bytes: count + 2 bytes: count receivers + for each receiver: + 2 bytes: item id + 2 bytes: count */ for (const auto &[slot, itemMap] : convergenceItemsMap) { uint16_t donorCount = 0; @@ -7694,7 +7694,7 @@ void ProtocolGame::addImbuementInfo(NetworkMessage &msg, uint16_t imbuementId) c msg.add(imbuementId); msg.addString(baseImbuement->name + " " + imbuement->getName(), "ProtocolGame::addImbuementInfo - baseImbuement->name + " - " + imbuement->getName()"); + " + imbuement->getName()"); msg.addString(imbuement->getDescription(), "ProtocolGame::addImbuementInfo - imbuement->getDescription()"); msg.addString(categoryImbuement->name + imbuement->getSubGroup(), "ProtocolGame::addImbuementInfo - categoryImbuement->name + imbuement->getSubGroup()"); @@ -7832,7 +7832,7 @@ void ProtocolGame::updatePartyTrackerAnalyzer(const std::shared_ptr party for (const std::shared_ptr &analyzer : party->membersData) { msg.add(analyzer->id); if (std::shared_ptr member = g_game().getPlayerByID(analyzer->id); - !member || !member->getParty() || member->getParty() != party) { + !member || !member->getParty() || member->getParty() != party) { msg.addByte(0); } else { msg.addByte(1); @@ -8226,7 +8226,7 @@ void ProtocolGame::sendInventoryImbuements(const std::mapgetBaseID()); msg.addByte(0x01); msg.addString(baseImbuement->name + " " + imbuement->getName(), "ProtocolGame::sendInventoryImbuements - baseImbuement->name + " - " + imbuement->getName()"); + " + imbuement->getName()"); msg.add(imbuement->getIconID()); msg.add(imbuementInfo.duration); @@ -8714,7 +8714,7 @@ void ProtocolGame::parseSendBosstiarySlots() { auto bossesUnlockedList = g_ioBosstiary().getBosstiaryFinished(player); if (auto it = std::ranges::find(bossesUnlockedList.begin(), bossesUnlockedList.end(), boostedBossId); - it != bossesUnlockedList.end()) { + it != bossesUnlockedList.end()) { bossesUnlockedList.erase(it); } auto bossesUnlockedSize = static_cast(bossesUnlockedList.size()); @@ -8930,7 +8930,7 @@ void ProtocolGame::sendBosstiaryCooldownTimer() { msg.skipBytes(2); // Boss count uint16_t bossesCount = 0; for (std::map bossesMap = g_ioBosstiary().getBosstiaryMap(); - const auto &[bossRaceId, _] : bossesMap) { + const auto &[bossRaceId, _] : bossesMap) { const auto mType = g_ioBosstiary().getMonsterTypeByBossRaceId(bossRaceId); if (!mType) { continue; diff --git a/src/server/network/protocol/protocollogin.cpp b/src/server/network/protocol/protocollogin.cpp index b59a3704429..d6e9e3cb9f1 100644 --- a/src/server/network/protocol/protocollogin.cpp +++ b/src/server/network/protocol/protocollogin.cpp @@ -177,5 +177,5 @@ void ProtocolLogin::onRecvFirstMessage(NetworkMessage &msg) { g_dispatcher().addEvent([self = std::static_pointer_cast(shared_from_this()), accountDescriptor, password] { self->getCharacterList(accountDescriptor, password); }, - "ProtocolLogin::getCharacterList"); + "ProtocolLogin::getCharacterList"); } diff --git a/src/server/network/protocol/protocolstatus.cpp b/src/server/network/protocol/protocolstatus.cpp index a4dfe1651d6..1674b80a2b5 100644 --- a/src/server/network/protocol/protocolstatus.cpp +++ b/src/server/network/protocol/protocolstatus.cpp @@ -47,7 +47,7 @@ void ProtocolStatus::onRecvFirstMessage(NetworkMessage &msg) { g_dispatcher().addEvent([self = std::static_pointer_cast(shared_from_this())] { self->sendStatusString(); }, - "ProtocolStatus::sendStatusString"); + "ProtocolStatus::sendStatusString"); return; } break; @@ -63,7 +63,7 @@ void ProtocolStatus::onRecvFirstMessage(NetworkMessage &msg) { g_dispatcher().addEvent([self = std::static_pointer_cast(shared_from_this()), requestedInfo, characterName] { self->sendInfo(requestedInfo, characterName); }, - "ProtocolStatus::sendInfo"); + "ProtocolStatus::sendInfo"); return; } diff --git a/src/server/server.hpp b/src/server/server.hpp index 054ec2607c8..42134f765b0 100644 --- a/src/server/server.hpp +++ b/src/server/server.hpp @@ -114,8 +114,8 @@ template bool ServiceManager::add(uint16_t port) { if (port == 0) { g_logger().error("[ServiceManager::add] - " - "No port provided for service {}, service disabled", - ProtocolType::protocol_name()); + "No port provided for service {}, service disabled", + ProtocolType::protocol_name()); return false; } @@ -132,8 +132,8 @@ bool ServiceManager::add(uint16_t port) { if (service_port->is_single_socket() || ProtocolType::SERVER_SENDS_FIRST) { g_logger().error("[ServiceManager::add] - " - "{} and {} cannot use the same port {}", - ProtocolType::protocol_name(), service_port->get_protocol_names(), port); + "{} and {} cannot use the same port {}", + ProtocolType::protocol_name(), service_port->get_protocol_names(), port); return false; } } diff --git a/src/server/signals.cpp b/src/server/signals.cpp index 978b589eb38..c85b21312eb 100644 --- a/src/server/signals.cpp +++ b/src/server/signals.cpp @@ -38,8 +38,8 @@ void Signals::asyncWait() { set.async_wait([this](std::error_code err, int signal) { if (err) { g_logger().error("[Signals::asyncWait] - " - "Signal handling error: {}", - err.message()); + "Signal handling error: {}", + err.message()); return; } dispatchSignalHandler(signal); diff --git a/src/utils/simd.hpp b/src/utils/simd.hpp index 3961d51e708..7e57e75bfad 100644 --- a/src/utils/simd.hpp +++ b/src/utils/simd.hpp @@ -13,7 +13,7 @@ #if defined(__DISABLE_VECTORIZATION__) // You might want to disable vectorization on some compilers - // it can just get buggy and the engine will crashes + // it can just get buggy and the engine will crashes #undef __NEON__ #undef __ARM_NEON__ #undef __ARM_FEATURE_SIMD32